@shijiu/jsview 1.9.878 → 1.9.882
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
/* eslint-disable */ import{parseGIF as t,decompressFrames as e}from"gifuct-js";void 0===window.Forge&&(window.Forge={});var i=window.Forge;class n{static getTextPixelWith(t,e){null===n.sCanvas&&(n.sCanvas=window.originDocument.createElement("canvas"));const i=n.sCanvas.getContext("2d");i.font=e;const s=i.measureText(t);return Math.ceil(s.width)}static GetTextWidth(t){let e="";t.bold&&(e="bold");let i="";return t.italic&&(i="italic"),this.getTextPixelWith(t.str,`${e} ${i} ${t.size}px ${t.font}`)}static GetTextRect(t,e,i,n,s){let r=Math.ceil(i.size*t.length/e.width)*s;r>e.height&&(r=e.height);return{width:e.width,height:r}}static GetCursorOffset(t,e,i,n,s,r,a){let o="";i.bold&&(o="bold");let l="";i.italic&&(l="italic");let h=0;if("right"===i.alignment){const n=this.getTextPixelWith(t,`${o} ${l} ${i.size}px ${i.font}`);(r-=e.width-n)<0&&(r=0)}let u=0;for(;r>=u&&h!==t.length;)u=this.getTextPixelWith(t.substr(0,h+1),`${o} ${l} ${i.size}px ${i.font}`),r>=u&&h++;return h}static GetCursorPosition(t,e,i,n,s,r){let a="";i.bold&&(a="bold");let o="";i.italic&&(o="italic");let l=0,h=t;if(r<t.length&&(h=h.substr(0,r)),l=this.getTextPixelWith(h,`${a} ${o} ${i.size}px ${i.font}`),"right"===i.alignment){const n=this.getTextPixelWith(t,`${a} ${o} ${i.size}px ${i.font}`);l=e.width-n+l}return{x:l,y:0}}}n.sCanvas=null,window.PlatformUtils=n;class s{constructor(t){this.state={},this.type=t,this._AutoPlay=!1}buildPlatformInstance(){this.Ele=window.originDocument.createElement(this.type),this.Ele.addEventListener("loadedmetadata",(()=>{this.hasOwnProperty("onload")&&this.onload(),this.hasOwnProperty("onloadedmetadata")&&this.onloadedmetadata()}))}set autoplay(t){void 0!==t&&(this._AutoPlay=!0,this.Ele.paused&&setTimeout((()=>{this.play()}),0))}get currentTime(){return this.Ele.currentTime}set currentTime(t){this.Ele.currentTime=t,this.setState("seek",t,"number")}get duration(){return this.Ele.duration}set loop(t){this.Ele.loop="boolean"==typeof t||void 0!==t}get muted(){return this.getState("muted")}set muted(t){this.setState("muted",t,"boolean")}get paused(){return this.Ele.paused}get playbackRate(){return this.getState("playbackRate")}set playbackRate(t){this.setState("playbackRate",t,"number")}set src(t){this.setState("src",t,"string"),t&&this._AutoPlay&&setTimeout((()=>{this.play()}),0)}get style(){const t=this;return{set bottom(e){t.setState("style",`{"bottom":"${e}"}`,"string")},set left(e){t.setState("style",`{"left":"${e}"}`,"string")},set right(e){t.setState("style",`{"right":"${e}"}`,"string")},set top(e){t.setState("style",`{"top":"${e}"}`,"string")},set height(e){t.setState("style",`{"height":"${e}"}`,"string")},set width(e){t.setState("style",`{"width":"${e}"}`,"string")}}}get volume(){return this.getState("volume")}set volume(t){this.setState("volume",t,"number")}get playableDuration(){return this.Ele.playableDuration}addEventListener(t,e){this[`on${t}`]=e,this.Ele.addEventListener(t,(e=>{this[`on${t}`](e)}))}load(){this.Ele.load()}pause(){this.Ele.pause(),this.setState("paused",!0,"boolean"),this.hasOwnProperty("onpause")&&this.onpause()}play(){this.setState("paused",!1,"boolean"),this.Ele.play(),this.hasOwnProperty("onplay")&&this.onplay()}unload(){this.setState("paused",!0,"boolean"),this.Ele.pause(),this.Ele.removeAttribute("src"),this.Ele.load()}setState(t,e,i){typeof e===i?("playbackRate"==t?this.Ele.playbackRate=e:this.Ele.setAttribute(t,e),this.state[t]=e,console.log(`set ${t} = ${e}`)):console.warn(`invalid paramter type to set ${t}. value is not ${i}`)}getState(t){let e=this.state[t];return console.log(`get ${t} = ${e}`),void 0===e&&(e=this.Ele.getAttribute(t),this.state[t]=e),e}onEnd(t){this.setState("paused",!0,"boolean"),this.hasOwnProperty("onended")&&this.onended()}onError(t){this.hasOwnProperty("onerror")&&this.onerror(t.currentTarget.error.code)}mediaHandler(){return this.Ele}static setDesignMapWidth(t){"number"==typeof t?s.prototype.designMapWidth=t:console.warn(`Invalid paramter type to set ${t}. It is not number.`)}}s.prototype.designMapWidth=0;class r extends s{constructor(t){super(t),super.buildPlatformInstance(t)}}class a extends r{constructor(){super("audio")}}window._ExtAudio=a;class o extends r{constructor(){super("video"),this.state.height=0,this.state.width=0,this.state.aspectRatiow="origin"}get height(){return this.getState("height")}set height(t){this.style.height=t,this.state.height=t}get poster(){return console.log("Video.poster() TODO"),null}set poster(t){console.log("Video.poster() TODO")}get videoAspectRatio(){return this.getState("aspectRatio")}set videoAspectRatio(t){this.setState("aspectRatio",t,"string")}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}get width(){return this.getState("width")}set width(t){this.style.width=t,this.state.width=t}onLoad(t){super.onLoad(t)}setRotation(t,e,i,n){let s=function(){let s=`rotate3d(0, 0, 1, ${t}deg)`;if(90==t||-90==t){let t,r;if(n?(t=i/e,r=e/i):(t=this.videoHeight/this.videoWidth,r=this.videoWidth/this.videoHeight),isNaN(t)||isNaN(r))return!1;s+=` scale3d(${t}, ${r}, 1)`}return this.Ele.style.transform=s,this.Ele.parentNode&&(this.Ele.parentNode.style.overflow="hidden"),!0};s=s.bind(this);s()||this.Ele.addEventListener("loadedmetadata",(()=>{s()}))}}window._ExtVideo=o;class l extends s{constructor(){super("video"),this._ReleaseCallbacks=[],this._ResourceTerminater=null,super.buildPlatformInstance()}setResourceTerminator(t){this._ResourceTerminater=t}hasTerminator(){return null!==this._ResourceTerminater}listenToRelease(t){this._ReleaseCallbacks.push(t)}unload(){super.unload(),null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}releaseResource(){for(let t=0;t<this._ReleaseCallbacks.length;t++)this._ReleaseCallbacks[t]();null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}confirmInitSetup(){}setRotation(){console.log("media.setRotation no implemented")}onPlatformDestroy(){}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}}window._ExtOVP=l,window.Audio=a,window.Video=o,window.OffscreenVideoPlayer=l;class h{constructor(t,e){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!t)return;if(!0===t.startsWith("url")){const e=t.indexOf("(")+1,i=t.lastIndexOf(")");t=t.substring(e,i).trim()}if(!0===t.startsWith("data:"))return void(this.href=t);if(!0===t.startsWith("/")&&(t=document.location.origin+t),!0===t.startsWith("./")){const e=document.location.pathname.lastIndexOf("/");let i="";e>0&&(i=document.location.pathname.substring(0,e)),t=document.location.origin+i+t.substring(1)}if(this.href=t,!e)return;let i=this.href.indexOf("?");const n=i>0?this.href.substring(0,i):this.href;this.search=i>1?this.href.substring(i):"",i=n.indexOf("://"),this.protocol=i>0?n.substring(0,i+1):"";const s=i>1?n.substring(i+3):"";i=s.indexOf("/"),this.host=i>0?s.substring(0,i):"",this.pathname=i>1?s.substring(i):"",this.origin=i>0?`${this.protocol}//${this.host}`:"",i=this.host.indexOf(":"),this.hostname=i>0?this.host.substring(0,i):this.host,this.port=i>1?this.host.substring(i+1):"",console.log("create total parse URL, this=",this)}replace(t){this.href=t}}const u=window.AudioContext||window.webkitAudioContext;if(u){const t=new u;let e=0,i=0;class n{constructor(t,e,i){this._Context=t,this._BufferSource=e,this._Gain=i,this._BufferSource.connect(this._Gain),this._Gain.connect(this._Context.destination)}start(t,e,i){this._BufferSource.start(t,e,i)}setVolume(t){this._Gain.gain.setValueAtTime(t,this._Context.currentTime)}stop(t){this._BufferSource.stop(t)}}class s{constructor(){this._SoundBufferMap={},this._StreamMap={}}load(i,n,s,r){const a=new h(i).href,o=e++;return this._requestBuffer(a,((e,i)=>{0===e?t.decodeAudioData(i,(t=>{this._SoundBufferMap[o]=t,r(o,0)})):r(-1,-1)})),o}unload(t){delete this._SoundBufferMap[t]}autoPause(){}autoResume(){}play(e,s,r,a,o,l){if(this._SoundBufferMap[e]){const r=i++,a=t.createBufferSource();a.buffer=this._SoundBufferMap[e],a.playbackRate.value=l,a.onended=t=>{this.stop(r)},o>0&&(a.loop=!0);const h=t.createGain();h.gain.setValueAtTime(s,t.currentTime);const u=new n(t,a,h);return this._StreamMap[r]=u,console.log("loop test",(o+1)*this._SoundBufferMap[e].duration),u.start(0,0,(o+1)*this._SoundBufferMap[e].duration),r}return-1}pause(t){}resume(t){}stop(t){this._StreamMap[t]&&(this._StreamMap[t].stop(),delete this._StreamMap[t])}release(){this._SoundBufferMap={},this._StreamMap={}}setVolume(t,e,i){this._StreamMap[t]&&this._StreamMap[t].setVolume(e)}setPriority(t,e){}setRate(t,e){}setLoop(t,e){}_requestBuffer(t,e){const i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=()=>{200===i.status?(console.log("http request succeed"),e(0,i.response)):(console.error(`download audio ${t} failed.`,i.status),e(-1,null))},i.send()}}window.SoundPool=s}else window.SoundPool=null;i.LogF=function(t){},i.LogE=function(t){},i.LogW=function(t){},i.LogI=function(t){},i.LogD=function(t){},i.LogM=function(t){},i.ThrowError=function(t){throw new Error(t)},i.Assert=function(t){if(!t)throw new Error("ASSERT!!!!!")},i.EnableLog=function(t){i.LogM=console.log.bind(console),t>0&&(i.LogF=console.error.bind(console)),t>1&&(i.LogE=console.error.bind(console)),t>2&&(i.LogW=console.warn.bind(console)),t>3&&(i.LogI=console.log.bind(console)),t>4&&(i.LogD=console.debug.bind(console))};i.RectArea=class{constructor(t,e,i,n){this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0,("number"!=typeof i||i<0)&&(i=0),this.width=i,("number"!=typeof n||n<0)&&(n=0),this.height=n}Equals(t){return null!==t&&(t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height)}};i.Coordinate=class{constructor(t,e){this.x=t,this.y=e}};i.Size=class{constructor(t,e){this.width=t,this.height=e}};i.RectUtils=class{FormatRectArea(t){let e=null;if(t instanceof i.RectArea)e=t;else if("object"==typeof t&&null!==t){if(isNaN(t.width)||isNaN(t.height))throw new Error("ERROR: target_size format should be {width:XXXX, height:XXXX}");e=new i.RectArea(0,0,t.width,t.height)}return e}},i.sRectUitls=new i.RectUtils,i.TextShaderType={LinearGradient:0,Image:1};i.TextShader=class{constructor(t,e){this.Type=t,this.Params=e}};class c{constructor(){const t=(new i.LayoutView).GetRenderer();this._Renderer=t,this.StringWithFont=i.sTextUtils.StringWithFont("",0,void 0,"center","middle",void 0,!1,!1,void 0,void 0,"top"),this.RectArea=new i.RectArea(0,0,0,0),this.TextAttr=i.sTextUtils.TextAttr("ellipsis","none"),this.Marquee=null,this.Shader=null,this.IsInstantLoad=!0,this.LineHeight=0,this.LatexMode=!1}SetInstantLoad(t){return this.IsInstantLoad=t,this}SetStringWithFont(t){return this.StringWithFont=t,this}SetLatexMode(t){return this.LatexMode=t,this}SetFontStyle(t,e,n,s,r,a,o,l,h,u){return this.StringWithFont="object"==typeof t?i.sTextUtils.StringWithFont("",void 0!==t.size?t.size:10,void 0!==t.font?t.font:"宋体",void 0!==t.hAlign?t.hAlign:"center",void 0!==t.vAlign?t.vAlign:"middle",void 0!==t.textColor?t.textColor:"#000000",void 0!==t.italic&&t.italic,void 0!==t.bold&&t.bold,void 0!==t.shadow?t.shadow:null,void 0!==t.strokeWidth?t.strokeWidth:null,void 0!==t.vAreaAlign?t.vAreaAlign:"top"):i.sTextUtils.StringWithFont("",t,e,n,s,r,a,o,l,h,u),this}SetRectArea(t){return t instanceof i.RectArea?this.RectArea=t:this.RectArea=new i.RectArea(t.x,t.y,t.width,t.height),this}SetViewSize(t){return t instanceof i.RectArea||(t=new i.RectArea(t.x,t.y,t.width,t.height)),this.SetRectArea(t),0===this.LineHeight&&0!==t.height&&(this.LineHeight=t.height),this}SetTextAttr(t){let e,i;return e=t.hasOwnProperty("textOverflow")?t.textOverflow:t.hasOwnProperty("text_overflow")?t.text_overflow:"clip",i=t.hasOwnProperty("wordWrap")?t.wordWrap:t.hasOwnProperty("word_wrap")?t.word_wrap:"none",this.TextAttr={word_wrap:i,text_overflow:e},this}SetMarquee(t){return t&&(this.Marquee={repetition:"infinite",direction:"left",speed:"normal"},t.repetition&&(this.Marquee.repetition=t.repetition),t.direction&&(this.Marquee.direction=t.direction),t.speed&&(this.Marquee.speed=t.speed)),this}SetShader(t){return this.Shader=t,this}SetLineHeight(t){return this.LineHeight=t,this}EnableDuplicateBuilder(){this.BuildCopyBag=!0}Clone(){const t=new c(null);return t.StringWithFont=this.StringWithFont,t.RectArea=this.RectArea,t.TextAttr=this.TextAttr,t.LineHeight=this.LineHeight,t}}i.TextViewParams=c,window.TextViewParams=i.TextViewParams;class d{constructor(t,e,n,s,r){this._layoutView=null,this._textWidth=0,this._textViewReahHeight=0,this._marqueeRunning=!0,this._marqueePause=!1,this._marqueeCurrentNum=2,this._textView=null,this._TextViewParams=e,this._NeedQuick=void 0!==s&&s,this._marquee=e.Marquee,this._rectArea=e.RectArea,this._DrawCount=0,this._ShowInterval=0,this._TextureManager=t,this._LatexMode=e.LatexMode,this._Shader=e.Shader,this._IsInstantLoad=e.IsInstantLoad?1:0,this._AutoHeight=!1,this._EnableTextureOnloadCallback=!!r,this._DuplicateBag=e.BuildCopyBag?{Set:null,Swf:null,Siz:null}:null;const a=this;let o=null;const l=e.RectArea.width,h=e.RectArea.height;let u=null,c=null;null!==this._marquee?(c=new i.ClipView,c.Init(),c.SetClipRect(0,0,l,h,!0),c.SetId("matrixClipLayoutview"),c.OnDettachFromSystem=function(){a._marqueeRunning=!1,i.ClipView.prototype.OnDettachFromSystem.call(this)}):(c=new i.LayoutView,c.OnDettachFromSystem=function(){this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null)}),o=c.GetRenderer(),this._Renderer=o;let d=n;d||(d=e.StringWithFont.str),d=this._ConvertEscToString(d);let _=!1;e.StringWithFont.italic.length>0&&(_=!0);let f=!1;e.StringWithFont.bold.length>0&&(f=!0),u=i.sTextUtils.StringWithFont(d,e.StringWithFont.size,e.StringWithFont.font,e.StringWithFont.alignment,e.StringWithFont.vertical_align,e.StringWithFont.textColour,_,f,e.StringWithFont.shadow,e.StringWithFont.stroke_width,e.StringWithFont.vertical_area_align),void 0!==e.Marquee&&null!==e.Marquee?this._textWidth=i.sTextUtils.GetTextWidth(u):this._NeedQuick?this._textWidth=e.RectArea.width-2*e.RectArea.x:this._textWidth=i.sTextUtils.GetTextWidth(u),this.addTextView(c,u,e.TextAttr,e.RectArea,e.Marquee,e.LineHeight),this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null),this._TextureOnloadCallbacksTimer=setTimeout((()=>{r&&r({width:this._textView.Element.clientWidth,height:this._textView.Element.clientHeight})}),0),this._layoutView=c,this._TextTexture=null,this._MarqueeTimer=null}_ConvertEscToString(t){let e=`${t}`;return-1!==e.indexOf(""")&&(e=e.replace(/"/gi,'"')),-1!==e.indexOf("&")&&(e=e.replace(/&/gi,"&")),-1!==e.indexOf("<")&&(e=e.replace(/</gi,">")),-1!==e.indexOf(">")&&(e=e.replace(/>/gi,"<")),-1!==e.indexOf(" ")&&(e=e.replace(/ /gi," ")),e}EnableAutoHeight(){this._AutoHeight=!0,this._textView.EnableAutoHeight()}addTextView(t,e,n,s,r,a){const o=s.height;let l;const h=i.Clone(s);let u=null;0!==e.str.length?(l=this._TextureManager.GetTextTextureByMultiRows(e,n,h,a,this._NeedQuick,this._Shader,this._IsInstantLoad,this._LatexMode,this._DuplicateBag),this._TextTexture=l.texture,this._textViewReahHeight=l.real_height,u=new i.LayoutView,u.Init(new i.TextureSetting(l.texture,null,null,!0)),u.SetId(`Text-${e.str}`),"middle"!==e.vertical_area_align&&"bottom"!==e.vertical_area_align||(u.Element.style.display="table-cell",u.Element.style.position="static",t.Element.style.display="table",t.Element.style.position="static"),t.AddView(u,new i.LayoutParams({x:0,y:0,width:h.width,height:o})),this._textView=u):(this._textViewReahHeight=0,i.LogI("t_StringWithFont.str.length is 0"))}GetDuplicateBuilder(){return this._DuplicateBag}GetLayoutView(){return this._layoutView}GetTextWidth(){return this._textView?this._textView.Element.clientWidth:Math.floor(this._textWidth+.5)}StartAnimation(t){t&&null!==this._textView&&this._textView.StartAnimation(t)}}i.TextViewEx=d,i.TextViewControl=d;i.CopiedTextViewEx=class{constructor(t,e,n,s,r){const a={x:0,y:0,width:n.width,height:n.height};this._ContainerView=new i.LayoutView,this._TextView=this._AddTextView(t,e,a,this._ContainerView,s,r)}_AddTextView(t,e,n,s,r,a){let o=null;if(e&&0!==e.length){const l=t.GetCopiedTextTexture(e,n,r,a);o=new i.LayoutView,o.Init(new i.TextureSetting(l,null,null,!0)),e.length<15?o.SetId(`Text-${e}`):o.SetId(`Text-Long${e.length}`),s.AddView(o,new i.LayoutParams({x:0,y:0,width:n.width,height:n.height})),a&&l.RegisterLoadImageCallback(null,a,null)}return o}EnableAutoHeight(){this._TextView&&this._TextView.EnableAutoHeight()}GetLayoutView(){return this._ContainerView}},i.Clone=function(t){return JSON.parse(JSON.stringify(t))},window.Clone=i.Clone;i.PersistTimer=new class{constructor(){this._AlreadyExited=!1,window.PersistTimer&&(this._AlreadyExited=!0)}setTimeout(t,e){return this._AlreadyExited&&window.PersistTimer.setTimeout?window.PersistTimer.setTimeout(t,e):window.setTimeout(t,e)}clearTimeout(t){this._AlreadyExited&&window.PersistTimer.clearTimeout?window.PersistTimer.clearTimeout(t):window.clearTimeout(t)}setInterval(t,e){if(!this._AlreadyExited||!window.PersistTimer.setInterval)return window.setInterval(t,e);window.PersistTimer.setInterval(t,e)}clearInterval(t){this._AlreadyExited&&window.PersistTimer.clearInterval?window.PersistTimer.clearInterval(t):window.clearInterval(t)}};i.ForegroundTimer=new class{setTimeout(t,e){return window.setTimeout(t,e)}clearTimeout(t){window.clearTimeout(t)}setInterval(t,e){return window.setInterval(t,e)}clearInterval(t){window.clearInterval(t)}},i.EasingTypeIn=0,i.EasingTypeOut=1,i.EasingTypeInOut=2,i.EasingTypeBezier=3,i.EasingTypeBlink=4,i.EasingTypeDeceleration=5,i.EasingTypeSteps=6;i.EasingBase=class{constructor(){this.Pacakge=this.Package}Package(){}_GetBasePackage(t){return{T:t,St:null}}};class _ extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeIn)}}i.EasingIn=_;class f extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeOut)}}i.EasingOut=f;class g extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeInOut)}}i.EasingInOut=g;class m extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeDeceleration)}}i.EasingDeceleration=m;class p extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeBlink)}}i.EasingBlink=p;class w extends i.EasingBase{constructor(t,e,i,n,s){super(),this._Inited=!1,this._X1=t,this._X2=i,this._Y1=e,this._Y2=n,this._Duration=s}Package(){const t=this._GetBasePackage(i.EasingTypeBezier);return t.St={X1:this._X1,X2:this._X2,Y1:this._Y1,Y2:this._Y2,Dur:this._Duration},t}}i.BezierEasing=w;class b extends i.EasingBase{constructor(t,e){super(),this._Steps=t,this._Type=e}Package(){const t=this._GetBasePackage(i.EasingTypeSteps);return t.St={S:this._Steps,T:this._Type},t}}i.StepsEasing=b,i.Easing={Circular:{In:new i.EasingIn,Out:new i.EasingOut,InOut:new i.EasingInOut,Deceleration:new i.EasingDeceleration}},window.Easing=i.Easing,i.ColorSpace={RGBA_8888:"RGBA_8888",RGBA_4444:"RGBA_4444",RGBA_5551:"RGBA_5551",RGB_565:"RGB_565",RGB_ETC1:"RGB_ETC1",RGBA_ETC1:"RGBA_ETC1"},i.QRCodeLevel={L:1,M:0,Q:3,H:2};class T{constructor(t,e,n){if(this._Manager=t,n){i.sRenderTextureDelegateManager.CreateTextureStatus().SetResourceInfo(n)}this.RenderTexture=i.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(e),this._CallbackIdToken=0,this._OnLoadCallback=[],i.ForgeDebug.EnableTextureTracer&&(t._ImageTextureTracer.push(this),this._TracerDescript="")}get Unloaded(){return null===this.RenderTexture||this.RenderTexture.Unloaded}set Unloaded(t){}get LoadTime(){return null!==this.RenderTexture?this.RenderTexture.LoadTime:0}set LoadTime(t){}get Width(){return null!==this.RenderTexture?this.RenderTexture.Width:0}set Width(t){}get Height(){return null!==this.RenderTexture?this.RenderTexture.Height:0}set Height(t){}UnloadTex(){this._OnLoadCallback=[],null!==this.RenderTexture&&(this._CallbackIdToken>0&&(this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken),this._CallbackIdToken=0),this.RenderTexture.UndoRef(),this.RenderTexture=null),this._TracerDescript=""}RegisterLoadImageCallback(t,e,n){if(this.IsLoaded()&&null!=e)return this.RenderTexture&&e({width:this.RenderTexture.Width,height:this.RenderTexture.Height},n),null;let s=null;return null!=e&&(s={callback:e,params:n},this._OnLoadCallback.push(s),0===this._CallbackIdToken&&(i.Assert(null!==this.RenderTexture),this._CallbackIdToken=this.RenderTexture.RegisterOnloadCallback(T.prototype._InvokeOnLoadCallbacks.bind(this)))),s}UnregisterLoadImageCallback(t){t&&this._OnLoadCallback.some(((e,i,n)=>{if(e===t)return n.splice(i,1),!0}))}EnableBackgroundLoad(t){}DisableBackgroundLoad(t){}_InvokeOnLoadCallbacks(){const t=this._OnLoadCallback;this._OnLoadCallback=[];for(let e=0;e<t.length;e++){const i=t[e];i.callback(i.params)}this.RenderTexture&&this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}SetTextureTracerDescript(t){this._TracerDescript=t}ReallocRenderTexture(){}}i.ImageTexture=T;class S extends i.ImageTexture{constructor(t,e,n,s,r,a){const o=i.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"IMG");o.Set={URL:e,Siz:s,Clr:r||"",IsF:n?1:0,NtS:a,ILd:0},super(t,o),this.Name="IMG",this.Source=e,this.IsForever=n?1:0,this.TargetSize=s,this.ColorSpace=r||"",this.NetSetting=a||null,this._InstantLoad=0,this._ImageElement=new Image,this._ImageElement.onload=function(){this._Loaded()}.bind(this),this._ImageElement.onerror=function(){this._Loaded()}.bind(this),this._ImageElement.src=e,this.RenderTexture.NeedCheckExpired=!0}_Loaded(){this.RenderTexture.Unloaded=!1,this.RenderTexture.LoadTime=Date.now(),this.RenderTexture.Width=this._ImageElement.width,this.RenderTexture.Height=this._ImageElement.height,this.RenderTexture.InvokeOnloadCallbacks()}InstantLoad(t){if(this._InstantLoad=t?1:0,this.RenderTexture){const t=this.RenderTexture.GetResourceInfo();null!==t&&(t.Set.ILd=this._InstantLoad,this.RenderTexture.SetResourceInfo(t))}return this}ReallocRenderTexture(){if(this.IsForever)return void i.LogE("ReallocRenderTexture(): NOT need for forever texture");const t=this.Source,e=this.TargetSize,n=this.ColorSpace,s=this.IsForever,r=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Manager.GetId(),this.Name);r.Set={URL:t,Siz:e,Clr:n,IsF:s,ILd:this._InstantLoad},this.RenderTexture=i.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(r),this._Manager.CachedTextureManager.CacheTheTexture(this)}}i.UrlImageTexture=S;class y extends i.ImageTexture{constructor(t,e,n,s,r){const a=i.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"GRAD");a.Set={URL:r},super(t,a),this.Gradient=r}}i.GradientTexture=y;class x extends i.ImageTexture{constructor(t,e,n,s,r,a,o,l,h,u,c){const d=i.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"TST");let _=null;c&&(_={x:0,y:0,w:0,h:0},Object.assign(_,c)),d.Set={ST:e,IDS:n.GetIdsPack(),W:Math.floor(r.width+.5),H:Math.floor(r.height+.5),FS:a,LA:h,EM:u,LH:Math.floor(o+.5),ILD:l?1:0,TLC:s?1:0,EA:_},super(t,d),this.Name="TST",this._TextStylePack=n,n.DoRef()}UnloadTex(){this._TextStylePack.UnRef(),super.UnloadTex()}}i.TextStyleTexture=x;i.CachedTextureManager=class{constructor(t){this._TextureManager=t,this._Renderer=t.GetRenderer(),this._CachedTextureStack=[],this._LockedTextureStack=[],this._MemoryLimited=10485760,this._VisibleMark=1}SetMemoryLimited(t){this._MemoryLimited=1024*t*1024}_FindTexture(t,e,i){for(let n=this._CachedTextureStack.length-1;n>=0;n--){const s=this._CachedTextureStack[n];if(s.Source===t&&(e===s.TargetSize||null!==e&&e.Equals(s.TargetSize))&&i===s.ColorSpace){if(null===s.RenderTexture)continue;return s}}return null}CacheTheTexture(t){for(let e=this._CachedTextureStack.length-1;e>=0;e--)if(t===this._CachedTextureStack[e])return;this._CachedTextureStack.push(t)}_MarkVisibleViewTextures(t,e){t.TextureSetting&&t.TextureSetting.Texture&&(t.TextureSetting.Texture.VisibleMark=e);const i=t.ChildViews.length;for(let n=0;n<i;n++){const i=t.ChildViews[n];i&&"VISIBLE"!==i.Visibility||this._MarkVisibleViewTextures(i,e)}}ReduceInvisibleTexture(t){this._MarkVisibleViewTextures(t,++this._VisibleMark);for(let t=0;t<this._CachedTextureStack.length;t++){const e=this._CachedTextureStack[t];e.VisibleMark!==this._VisibleMark&&(e.UnloadTex(),this._CachedTextureStack.splice(t,1),t--)}}GetCacheSize(){return this._CachedTextureStack.length}};const E=new Map;let v=0;const L=new Map;let I=0;class A{constructor(){this.CachedTextureManager=new i.CachedTextureManager(this),this._ForeverCachedTextureManager=new i.CachedTextureManager(this),this._AtlasDataInfo={atlas_data:[],buffer_data_offset:0,textures:[]},this._ClearTimer=-1,this._ImageTextureTracer=[],this._Id=A.sTextureManagerToken++,this._CacheMaxSize=100,this.StartScavengerCachedTimer()}StartScavengerCachedTimer(){-1===this._ClearTimer&&(this._ClearTimer=i.ForegroundTimer.setInterval(this.ScavengerCached.bind(this),3e4))}GetId(){return this._Id}GetRenderer(){return i.sDeprecatedRenderer}GetGifImage(t,e,i){return this.GetImage(t,e,i)}GetImage(t,e,n){if(!t)return i.LogI("GetImage, url is null!"),null;return this._GetImageInternal(t,null,i.ColorSpace.RGBA_8888,e,!1,n)}GetImage2(t,e,n,s,r){if(!t)return i.LogI("GetImage2, url is null!"),null;const a=i.sRectUitls.FormatRectArea(n);"string"!=typeof s&&(s=t.indexOf(".pkm")>=0?t.indexOf(".pkma")>=0?i.ColorSpace.RGBA_ETC1:i.ColorSpace.RGB_ETC1:i.ColorSpace.RGB_565);return this._GetImageInternal(t,a,s,e,!1,r)}CreateMiniGradientTexture(t,e,n,s){return new i.GradientTexture(this,t,e,n,s)}_GetImageInternal(t,e,n,s,r,a){if(s){const i=this._ForeverCachedTextureManager._FindTexture(t,e,n);if(i)return i}else{const i=this.CachedTextureManager._FindTexture(t,e,n);if(i)return i}const o=new i.UrlImageTexture(this,t,s,e,n,a);return o.IsForever?this._ForeverCachedTextureManager.CacheTheTexture(o):this.CachedTextureManager.CacheTheTexture(o),o}GetRoundCornerMask(t,e){return this.GetCustomCornerMask(t,e,e,e,e)}GetCustomCornerMask(t,e,n,s,r){const a=i.sRectUitls.FormatRectArea(t),o=Math.max(e,n,s,r);if(o>a.width/2||o>a.height/2)return i.LogE(`TextureManager.GetRoundCornerMask(): radius is too large, radius=${o} w=${a.width} h=${a.height}`),null;const l=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CCM");l.Set={W:a.width,H:a.height,LT:e,RT:n,LB:s,RB:r};const h=new i.ImageTexture(this,l);return i.ForgeDebug.EnableTextureTracer&&h.SetTextureTracerDescript("CornerMask"),h}GetOneCornerMask(t){const e=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"OCM");e.Set={Rad:t};const n=new i.ImageTexture(this,e);return i.ForgeDebug.EnableTextureTracer&&n.SetTextureTracerDescript("OneCornerMask"),n}GetTextTextureFromStylePack(t,e,n,s,r,a,o,l,h,u){return t&&0!==t.length?new i.TextStyleTexture(this,t,e,n,s,r,a,o,l,h,u):null}_getParamsId(t,e,i){const n=t.font,s=t.size,r=t.italic,a=t.bold,o=t.alignment,l=t.vertical_align,h=t.vertical_area_align,u=t.textColour,c=t.backgroundColour,d=t.shadow;let _="";t.stroke_width&&(_=t.stroke_width);const f=e.text_overflow,g=e.word_wrap,m=[n,r,a,d,_].join(":"),p=[s,o,l,h,f,g].join(":");let w="",b="";return E.has(m)?w=E.get(m):(w=`TS${v}`,E.set(m,w),v++),L.has(p)?b=L.get(p):(b=`DS${I}`,L.set(p,b),I++),[w,b,u,c]}GetTextTextureByMultiRows(t,e,n,s,r,a,o,l,h){const u=t.str;if(null===u||0===u.length)return null;const c=i.sRenderBridge.GetScreenInfo().scaleRatio,d=Object.assign(n);d.x*=c,d.y*=c,d.width*=c,d.height*=c;const _=Object.assign(t);_.size=Math.ceil(_.size*c),s*=c;const f={ST:t.str,AT:JSON.stringify({TO:e.text_overflow,WW:e.word_wrap}),RA:JSON.stringify({X:parseInt(d.x+.5,10),Y:parseInt(d.y+.5,10),W:parseInt(d.width+.5,10),H:parseInt(d.height+.5,10)}),LA:l,LH:parseInt(s+.5,10),ILD:void 0!==o?o:1};if(a&&(f.SH=JSON.stringify({T:a.Type,P:a.Params})),void 0!==window.JsView&&void 0!==window.JsView.ForgeNativeRevision&&window.JsView.ForgeNativeRevision>0){const t=this._getParamsId(_,e,a);f.PI={FS:t[0],DS:t[1],TC:t[2],BC:t[3]}}const g=this._BuildTextTextureAndSerialStatus(f,_);if(null!==h){const t=Object.assign({},f);t.ST=null,t.TLC=0,h.Set=t,h.Swf=Object.assign({},_)}let m=d.height;if(void 0!==window.PlatformUtils&&!1===r){m=window.PlatformUtils.GetTextRect(u,d,_,e,s).height}if(m=Math.floor(m/c+.5),i.ForgeDebug.EnableTextureTracer){let e=t.str;e.length>8&&(e=`${t.str.substr(0,8)}...`),g.SetTextureTracerDescript(`[${e}]`)}return{texture:g,real_height:m}}GetCopiedTextTexture(t,e,n,s){const r=Object.assign({},n.Set);r.ST=t,r.TLC=void 0!==s&&s?1:0;const a=n.Swf,o=i.sRenderBridge.GetScreenInfo().scaleRatio;r.RA=JSON.stringify({X:parseInt(e.x*o+.5,10),Y:parseInt(e.y*o+.5,10),W:parseInt(e.width*o+.5,10),H:parseInt(e.height*o+.5,10)});const l=this._BuildTextTextureAndSerialStatus(r,a);if(i.ForgeDebug.EnableTextureTracer&&t){let e=t;e.length>8&&(e=`${t.substr(0,8)}...`),l.SetTextureTracerDescript(`[${e}]`)}return l}_BuildTextTextureAndSerialStatus(t,e){i.sRenderTextureDelegateManager.AppendFontStatusIfNeed(t,e);let n=null;t.FO&&(n={STA:{Nam:"T",Sta:t.FO}});const s=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"T");return s.Set=t,new i.ImageTexture(this,s,n)}GetColorTexture(t){const e=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CT");e.Set={Clr:t};const n=new i.ImageTexture(this,e);return i.ForgeDebug.EnableTextureTracer&&n.SetTextureTracerDescript(`Color[${t}]`),n}GetColorTextureCached(t){return this.GetColorTexture(t)}ScavengerCached(){this.CachedTextureManager.GetCacheSize()>=this._CacheMaxSize&&this.CachedTextureManager.ReduceInvisibleTexture(i.sRootView)}GetOffScreenMediaTexture(t){if(void 0===window.OffscreenVideoPlayer||!(t instanceof window.OffscreenVideoPlayer))return null;if(!t.hasTerminator()){const e=this._BuildVideoTexture(t);t.setResourceTerminator((()=>{e.UnloadTex()}))}return this._BuildVideoTexture(t)}_BuildVideoTexture(t){const e=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"VPLY");e.Set={Hdl:t.mediaHandler()};const n=new i.ImageTexture(this,e);return i.ForgeDebug.EnableTextureTracer&&n.SetTextureTracerDescript(`Video[${t.mediaHandler()}]`),n}}A.sTextureManagerToken=100,i.TextureManager=A,window.TextureManager=i.TextureManager;i.LayoutViewDebugClass=class{SetTextureTracer(t){}GetTextureTracer(){return null}},i.ForgeDebug=new i.LayoutViewDebugClass,window.ForgeDebug=i.ForgeDebug;class C{constructor(){this.Width=0,this.Height=0,this.MarginTop=0,this.MarginLeft=0,this.MarginRight=0,this.MarginBottom=0,this.Z=0,this.SizeAdjust=!1}SetPosition(t,e,i){this.MarginTop=e,this.MarginLeft=t,i&&(this.Z=i)}SetSize(t,e){this.Width=t,this.Height=e}Clone(){const t=new C(null);return t.Width=this.Width,t.Height=this.Height,t.MarginTop=this.MarginTop,t.MarginLeft=this.MarginLeft,t.MarginRight=this.MarginRight,t.MarginBottom=this.MarginBottom,t.Z=this.Z,t.SizeAdjust=this.SizeAdjust,t}Equals(t){return t.Width===this.Width&&t.Height===this.Height&&t.MarginTop===this.MarginTop&&t.MarginLeft===this.MarginLeft&&t.MarginRight===this.MarginRight&&t.MarginBottom===this.MarginBottom&&t.Z===this.Z}}i.LayoutParamsBase=C;class P extends i.LayoutParamsBase{constructor(t){super(),t instanceof i.RectArea&&(t={x:t.x,y:t.y,width:t.width,height:t.height}),t&&(t.x?this.MarginLeft=t.x:t.marginLeft&&(this.MarginLeft=t.marginLeft),t.y?this.MarginTop=t.y:t.marginTop&&(this.MarginTop=t.marginTop),t.z&&(this.Z=t.z),t.width&&(this.Width=t.width),t.height&&(this.Height=t.height),isNaN(this.MarginTop)&&(i.LogE("isNaN(this.MarginTop)!"),this.MarginTop=0),isNaN(this.MarginLeft)&&(i.LogE("isNaN(this.MarginLeft)!"),this.MarginLeft=0),"MatchParent"!==this.Width?isNaN(this.Width)&&i.LogE("isNaN(this.Width)!"):this.SizeAdjust=!0,"MatchParent"!==this.Height?isNaN(this.Height)&&i.LogE("isNaN(this.Height)!"):this.SizeAdjust=!0)}}i.LayoutParams=P,window.LayoutParams=i.LayoutParams;i.RenderTextureDelegateManager=class{constructor(){this._IdTokenGenerator=66,i.sRenderTextureDelegateManager=this,this._CheckExpiredTime=0}CreateTextureHeadStatus(){const t=new i.RenderTextureDelegate(this,0);return t.DoRef(),t}CreateTextureStatus(){const t=new i.RenderTextureDelegate(this,0);return t.DoRef(),t}CreateTexture(){const t=new i.RenderTextureDelegate(this,this._IdTokenGenerator++);return t.DoRef(),t}RecycleTexture(t){}CreateResourceInfo(t,e){return{Id:0,Nam:e,Set:null,TmId:t,NdLd:0}}AppendFontStatusIfNeed(t,e){const i={};i.Fo=e.font,i.Si=e.size,i.It=e.italic,i.Bo=e.bold,i.Al=e.alignment,i.Ve=e.vertical_align,i.Vaa=e.vertical_area_align,i.Tx=e.textColour,i.Ba=e.backgroundColour,i.En=e.enableBlend,i.Sh=e.shadow,e.stroke_width?i.Stk=e.stroke_width:i.Stk=-1,t.FO=JSON.stringify(i)}},i.sRenderTextureDelegateManager=new i.RenderTextureDelegateManager;i.RenderTextureDelegate=class{constructor(t,e){this.IdToken=e,this._Manager=t,this._Reference=0,this._SyncingResourceInfo=null,this._OnloadCallbacks={},this._OnloadCallbacksSize=0,this._OnloadCallbackIdGenerator=1,this.Unloaded=!0,this.LoadTime=0,this.RequireTime=0,this.ForceExpire=!1,this.NeedCheckExpired=!1;if(i.ForgeDebug.GetTextureTracer()){const t=new Error;this.Stack=t.stack}}DoRef(){this._Reference++}UndoRef(){this._Reference--,0===this._Reference&&(this._OnloadCallbacksSize>0&&(this._OnloadCallbacks={}),this._Manager.RecycleTexture(this))}SetResourceInfo(t){t.Id=this.IdToken,this._SyncingResourceInfo=t}GetResourceInfo(){return this._SyncingResourceInfo}ReadSyncInfo(){const t=this._SyncingResourceInfo;return this._SyncingResourceInfo=null,t}RegisterOnloadCallback(t){const e=this._OnloadCallbackIdGenerator++;return this._OnloadCallbacks[`${e}`]=t,this._OnloadCallbacksSize++,null!==this._SyncingResourceInfo&&(this._SyncingResourceInfo.NdLd=1),e}UnregisterOnloadCallback(t){delete this._OnloadCallbacks[`${t}`],this._OnloadCallbacksSize--}InvokeOnloadCallbacks(){if(this._OnloadCallbacksSize>0)for(const t in this._OnloadCallbacks)this._OnloadCallbacks.hasOwnProperty(t)&&this._OnloadCallbacks[t]()}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}};i.DeprecatedRenderer=class{constructor(){i.sDeprecatedRenderer=this,this._SharedTextureManager=this.CreateTextureManager()}SetUserId(t){i.sRenderBridge.UpdateUserId(t)}GetScreenInfo(){return i.sRenderBridge.GetScreenInfo()}StringWithFont(){return i.sTextUtils.StringWithFont.apply(this,arguments)}GetTextWidth(){return i.sTextUtils.GetTextWidth.apply(this,arguments)}GetTextUtils(){return i.sTextUtils}RectArea(t,e,n,s){return new i.RectArea(t,e,n,s)}TextAttr(){return i.sTextUtils.TextAttr.apply(this,arguments)}GarbageCollect(){i.LogM("GarbageCollect called")}TriggerFrameDraw(){i.sRenderBridge.RequestSwap()}GetSharedTextureManager(){return this._SharedTextureManager}CreateTextureManager(){return new i.TextureManager}},i.sDeprecatedRenderer=null;const R={STRING:Symbol("STRING"),FUNCTION:Symbol("FUNCTION"),LINE_FEED:Symbol("LINE_FEED"),LEFT_BRACE:Symbol("LEFT_BRACE"),RIGHT_BRACE:Symbol("RIGHT_BRACE")};const D={},O={BASE:Symbol("BASE"),COLOR:Symbol("COLOR"),BOLD:Symbol("BOLD"),ITALIC:Symbol("ITALIC"),DECORATION:Symbol("DECORATION"),SUPERSCRIPT:Symbol("SUPERSCRIPT"),SUBSCRIPT:Symbol("SUBSCRIPT")};class k{constructor(){this.style,this.styleValue=""}}class F{constructor(){this.textStyle=new k,this.childNodes=[],this.parent}}class V extends F{constructor(){super(),this.styleList=[],this.indexPair,this.lineFeedNode=!1,this.testValue}}function M(t){if(null===t||0===t.length)return null;const e=function(t){const e=[];let i=0;for(;i<t.length;)if("\\"===t[i])if(i<t.length-1)if("\\"===t[i+1]||"{"===t[i+1]||"}"===t[i+1]){const t={type:R.STRING,indexPair:[i+1,i+2]};e.push(t),i+=2}else{++i;const n=i;let s=i,r=!1;for(;i<t.length&&"{"!==t[i]&&"}"!==t[i];)" "!==t[i]&&(r=!0)," "===t[i]&&r?++i:s=++i;const a={type:R.FUNCTION,indexPair:[n,s]};e.push(a)}else console.error("backslash at end.");else if("{"===t[i]){const t={type:R.LEFT_BRACE,indexPair:null};e.push(t),++i}else if("}"===t[i]){const t={type:R.RIGHT_BRACE,indexPair:null};e.push(t),++i}else if("\n"===t[i]){const t={type:R.LINE_FEED,indexPair:null};e.push(t),++i}else{const n=i;let s=i;for(;i<t.length&&"\\"!==t[i]&&"{"!==t[i]&&"}"!==t[i]&&"\n"!==t[i];)++i,s=i;const r={type:R.STRING,indexPair:[n,s]};e.push(r)}for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.type===R.STRING){let s=!0;for(let e=n.indexPair[0];e<n.indexPair[1];e++)if(" "!==t[e]){s=!1;break}!(s&&i>0&&i<e.length-1)||e[i-1].type!==R.LEFT_BRACE&&e[i-1].type!==R.RIGHT_BRACE||e[i+1].type!==R.RIGHT_BRACE&&e[i+1].type!==R.LEFT_BRACE||e.splice(i,1)}}return e}(t),i=[],n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.type===R.STRING){const t=new V;n.push(t),t.indexPair=r.indexPair,t.textStyle.style=O.BASE,i.push(t)}else if(r.type===R.LINE_FEED){const t=new V;n.push(t),t.lineFeedNode=!0}else if(r.type===R.LEFT_BRACE)i.push(D);else if(r.type===R.RIGHT_BRACE)if(i.length>0){const t=[];let e=i.pop();for(;e!==D&&(t.push(e),i.length>0);)e=i.pop();if(i.length>0){const e=i[i.length-1];if(e.textStyle.style===O.BASE)console.error("lack of function");else for(;t.length>0;){const i=t.pop();e.childNodes.push(i),i.parent=e}}else console.error("lack of function")}else console.error("extra }");else if(r.type===R.FUNCTION){const n=t.substring(r.indexPair[0],r.indexPair[1]),a=new F;switch(n){case"textcolor":if(s<e.length-3){a.textStyle.style=O.COLOR;const i=e[s+1],n=e[s+2],r=e[s+3];i.type===R.LEFT_BRACE&&n.type===R.STRING&&r.type===R.RIGHT_BRACE?(a.textStyle.styleValue=t.substring(n.indexPair[0],n.indexPair[1]),s+=3):console.error("textcolor param format error.")}else console.error("textcolor param format error.");break;case"textb":a.textStyle.style=O.BOLD;break;case"texti":a.textStyle.style=O.ITALIC;break;case"textdecoration":if(s<e.length-3){a.textStyle.style=O.DECORATION;const i=e[s+1],n=e[s+2],r=e[s+3];i.type===R.LEFT_BRACE&&n.type===R.STRING&&r.type===R.RIGHT_BRACE?(a.textStyle.styleValue=t.substring(n.indexPair[0],n.indexPair[1]),s+=3):console.error("textdecoration param format error.")}else console.error("textdecoration param format error.");break;case"textsup":a.textStyle.style=O.SUPERSCRIPT;break;case"textsub":a.textStyle.style=O.SUBSCRIPT;break;default:console.error(`undefined style type: ${n}`)}i.push(a)}++s}return n.forEach(((t,e,i)=>{let n=t.parent;for(;n;)t.styleList.push(n.textStyle),n=n.parent})),{nodeList:n,text:t}}function G(){this.positionQueue=[],this.timeQueue=[]}G.prototype.reset=function(){this.positionQueue=[],this.timeQueue=[]},G.prototype.pruneQueue=function(t){for(;this.timeQueue.length&&this.timeQueue[0]<Date.now()-t;)this.timeQueue.shift(),this.positionQueue.shift()},G.prototype.updatePosition=function(t){this.positionQueue.push(t),this.timeQueue.push(Date.now()),this.pruneQueue(50)},G.prototype.getVelocity=function(){this.pruneQueue(1e3);const t=this.timeQueue.length;if(t<2)return 0;const e=(this.timeQueue[t-1]-this.timeQueue[0])/1e3,i=this.positionQueue[t-1]-this.positionQueue[0];return console.log(`getVelocity distance:${i}, time:${e}, velocity:${i/e}, this.timeQueue[length-1]:${this.timeQueue[t-1]}, this.timeQueue[0]:${this.timeQueue[0]}`),i/e},window.gRootView=null,i.sRootView=null;i.TextureSetting=class{constructor(t,e,n,s){this.Texture=t,this._IsTextureExternal=!1,e instanceof i.ImageTexture?(e&&e.RenderTexture&&e.RenderTexture.NeedCheckExpired&&(e.RenderTexture.RequireTime=0),this.MaskSetting=new i.ViewTextureMask(e)):this.MaskSetting=e,t&&t.RenderTexture&&t.RenderTexture.NeedCheckExpired&&(t.RenderTexture.RequireTime=0),this._IsMaskTextureExternal=!1,this.TextureBeforeImageLoad=n,this._IsPreloadImageTextureExternal=!1,void 0===s&&(s=!0),this.HasAlpha=s}SetExternal(t,e,i){this._IsTextureExternal=t,this._IsMaskTextureExternal=e,this._IsPreloadImageTextureExternal=i}ReleaseInternalTexture(t,e){!this._IsTextureExternal&&this.Texture&&(this.Texture.UnloadTex(),this.Texture=null),!this._IsMaskTextureExternal&&this.MaskSetting&&(this.MaskSetting.UnLoad(),this.MaskSetting=null),!this._IsPreloadImageTextureExternal&&this.TextureBeforeImageLoad&&(this.TextureBeforeImageLoad.UnloadTex(),this.TextureBeforeImageLoad=null)}DebugPrint(){return` _IsTextureExternal=${this._IsTextureExternal}`}},window.TextureSetting=i.TextureSetting;class N extends i.TextureSetting{constructor(t,e,i,n){super(t,e,i,n),this.SetExternal(!0,!0,!0)}}i.ExternalTextureSetting=N,window.ExternalTextureSetting=i.ExternalTextureSetting;i.PackedLayout=class{constructor(t){const e=t.RectInfo;this.RectInfo={coordX:e.coordX,coordY:e.coordY,width:e.width,height:e.height},this.LayoutParams=JSON.parse(JSON.stringify(t.LayoutParams))}ApplyToView(t){const e=this.RectInfo;t.RectInfo={coordX:e.coordX,coordY:e.coordY,width:e.width,height:e.height},t.LayoutParams=JSON.parse(JSON.stringify(this.LayoutParams))}};i.ViewMask=class{constructor(){this._MaskType="COMMON"}Type(){return this._MaskType}UnLoad(){}};class B extends i.ViewMask{constructor(t){super(),this._MaskType="TEXTURE",this.ImageTexture=t}UnLoad(){this.ImageTexture.UnloadTex()}}i.ViewTextureMask=B;class W extends i.ViewMask{constructor(t,e,i,n){super(),this._MaskType="CORNER",this._TopLeft=t,this._TopRight=isNaN(e)?t:e,this._BottomLeft=isNaN(i)?t:i,this._BottomRight=isNaN(n)?t:n,this._CornersWidth=[0,0,0,0],this._CornersDisable=[0===this._TopLeft?1:0,0===this._TopRight?1:0,0===this._BottomLeft?1:0,0===this._BottomRight?1:0]}UnLoad(){}}i.ViewRoundCornerMask=W;i.DragSetting=class{constructor(t,e,n,s,r,a){this.DragDirection=t||0,this.TriggerMovedDistance=e||0,this._EnableJsFling=n?1:0,this.SlidePile=s||new i.RectArea(0,0,1280,720),this.PageWidth=r>0?r:65535,this.EnableTabMode=r>0,this.PageEdge=a||1/4}},i.DragSetting.DIRECTION_DISABLE=0,i.DragSetting.DIRECTION_VERTICAL=1,i.DragSetting.DIRECTION_HORIZONTAL=2,i.DragSetting.DIRECTION_AUTO=i.DragSetting.DIRECTION_VERTICAL|i.DragSetting.DIRECTION_HORIZONTAL,i.DragInfo=class{constructor(){this.Settings=null,this.Listener=null,this.ListenerFlags=0,this.OverListener=null,this.OverListenerFlags=0,this.Formula=null,this.SyncString=null}SetListener(t){this.Listener=t}},i.DragInfo.INFLEXION=.35,i.DragInfo.DECELERATION_RATE=Math.log(.78)/Math.log(.9),i.DragInfo.PHYSICAL_COEF=51890.2,i.DragInfo.SCROLL_FRICTION=.06,i.DragInfo.EVENT_TYPE={OnDown:0,OnTap:1,OnLongPress:2,OnDragStart:3,OnMoved:4,OnDragEnd:5,OnRelease:6,OnFling:7};let $=0;class H{constructor(t,e){this.TextureSetting=t,t&&console.error("LayoutViewBase constructor texture_setting not undefined!"),this._dispatchLongPress=this._dispatchLongPress.bind(this),this.Visibility="VISIBLE",this.LayoutParams=null,this.ParentView=null,this.ChildViews=[],this.zIndex=0,this._Perspective=0,this._PerspectiveAnchor=[.5,.5],this._BackfaceVisibility=1,this._DebugCount=++$,this.childZIndexCount=0,this._IsChildOfRootView=!1,this._DetachFromSystemCallback=null,this.Element=null,this.InnerChildElement=null,"root"===e?(this.Element=window.originDocument.getElementById(e),this.Element||(this.Element=window.originDocument.getElementById("app"))):"svg"===e||"path"===e?this.Element=document.createElementNS("http://www.w3.org/2000/svg",e):e&&(this.Element=window.originDocument.createElement(e)),this.TransitionStore={},this.TransformAnimationObj=null,this._TextureAnimationObj=null,this._DragInfo=null,this.DragControl=null,this._Velocity={x:new G,y:new G},this._TouchSlopSquare=64,this._InDragging=null,this._InLongPress=null,this._AlwaysInTapRegion=null,this._LastFocusX=null,this._LastFocusY=null,this._DownFocusX=null,this._DownFocusY=null,this._LastTimeStamp=null,this._ObjectFitTestCache=null,this._ProxyView=null,this.Expired=!1}Init(t){this.ResetTexture(t)}SetElementProp(t,e){t&&Object.keys(t).forEach((e=>{switch(e){case"jsv_enable_fade":case"jsv_poster_on_top":case"jsv_media_usetexture":case"jsv_text_definition":break;case"jsv_innerview":{const n=i.sViewStore.get(t[e]);if(n){const t=n.view;null==this.LayoutParams&&this.ResetLayoutParams({x:0,y:0,width:0,height:0});let e=this.LayoutParams;this.ResetLayoutParams({x:0,y:0,width:0,height:0}),t&&(null===this._ProxyView?this._InsertProxyLayer(t,e):t!==this._ProxyView&&console.error("Error: Can not reset proxy view"))}break}default:i.LogE(`Error: View Unknown prop name=${e}`)}}))}InsertView(t,e,i,n){this._InsertView(t,e,i,n)}AddView(t,e,i){this._InsertView(t,null,e,i)}MoveChildView(t,e,n){if(null!=this._ProxyView&&t!=this._ProxyView)return void this._ProxyView.MoveChildView(t,e);let s=!1;for(var r=0;r<this.ChildViews.length;r++)if(this.ChildViews[r]==t){0!=t.zIndex&&this.childZIndexCount--,this.ChildViews.splice(r,1),t.ParentView=null,s=!0;break}s||i.LogE("MoveChildView(): view is not in child list stack="),e._InsertView(t,n,t.LayoutParams);let a=null;n&&(a=e.ChildViews[e.ChildViews.indexOf(n)+1]),a&&e.Element.contains(a.Element)?e.Element.insertBefore(t.Element,a.Element):e.Element.appendChild(t.Element)}_InsertView(t,e,n,s){if(n?n instanceof i.LayoutParamsBase?t.LayoutParams=n.Clone():t.LayoutParams=new i.LayoutParams(n):t.LayoutParams||(t.LayoutParams=new i.LayoutParams({x:0,y:0})),null!==t.LayoutParams&&(t.LayoutParams.MarginLeft&&(t.Element.style.left=`${t.LayoutParams.MarginLeft}px`),t.LayoutParams.MarginTop&&(t.Element.style.top=`${t.LayoutParams.MarginTop}px`),t.LayoutParams.Width&&(t.Element.style.width=`${t.LayoutParams.Width}px`),t.LayoutParams.Height?t.Element.style.height=`${t.LayoutParams.Height}px`:t.Element.style.height=""),t.ParentView=this,e){let i=this.ChildViews.indexOf(e);i<0&&(i=this.ChildViews.length),this.ChildViews.splice(i,0,t)}else this.ChildViews.push(t);this._ChildrenListDirty=!0,this._IsChildOfRootView&&t._OnAttachToSystem(),0!=t.zIndex&&this.childZIndexCount++,this.childZIndexCount>0&&this._RequestZIndexReorder()}SetZIndex(t){if(t!=this.zIndex){var e=this.zIndex;this.zIndex=t;var n=this.ParentView;n&&(0==e&&0!=t?n.childZIndexCount++:0!=e&&0==t&&n.childZIndexCount--,n.childZIndexCount<0&&i.ThrowError("ERROR: LayoutViewBase, child z-index count ERROR"),n._RequestZIndexReorder())}}_RequestZIndexReorder(){let t=[],e=[],i=0,n=this.ChildViews.length;for(var s=0;s<n;s++){let n=this.ChildViews[s].zIndex;n<0?(n<i&&(i=n),t.push(this.ChildViews[s])):n>0&&e.push(this.ChildViews[s])}i=1e3*Math.floor(-i/1e3)+1e3;let r=t.length,a=e.length;if(r>0){t.sort(((t,e)=>t.zIndex-e.zIndex));for(s=0;s<r;s++)t[s].Element.style.zIndex=t[s].zIndex+i}if(this.ChildViews.length-t.length-e.length>0)for(s=0;s<n;s++)0==this.ChildViews[s].zIndex&&(this.ChildViews[s].Element.style.zIndex=i);if(a>0){e.sort(((t,e)=>t.zIndex-e.zIndex));for(s=0;s<a;s++)e[s].Element.style.zIndex=e[s].zIndex+i}}SetPerspective(t,e){this.Element.style.perspective=`${t}px`,this.Element.style.webkitPerspective=`${t}px`,this.Element.style.perspectiveOrigin=e,this.Element.style.webkitPerspectiveOrigin=e,this._Perspective=t,this._PerspectiveOrigin=e}SetBackfaceVisibility(t){console.log("set back face",t),this.Element.style.backfaceVisibility=t?"visible":"hidden",this.Element.style.webkitBackfaceVisibility=t?"visible":"hidden",console.log(`back face style ${this.Element.style.backfaceVisibility}`),this._BackfaceVisibility=t?1:0}SetTransformStyle(t){this.Element.style.transformStyle=t,this.Element.style.webkitTransformStyle=t,this._TransformStyle=t}EnableDivTouch(t,e){t.eventHandlers&&t.eventHandlers.onClick&&(this.Element.onclick=e=>{t.eventHandlers.onClick(),e.preventDefault&&e.preventDefault()},this.Element.style.pointerEvents="auto")}_DoDragPause(t){this._DragInfo.Settings.EnableTabMode||this.DragControl&&this.DragControl.pause(((e,i)=>{if(null!==this.Element.style.transform){let n=this.GetLayoutParams();n=this._GetMovedLayoutParams(e-n.MarginLeft,i-n.MarginTop),this.ResetLayoutParams(n),this._DragImactSensorRecycle(),console.log(`_DoDragPause lp.MarginLeft:${n.MarginLeft}, lp.MarginTop:${n.MarginTop}`),this.DragControl=null,this.Element.style.transform=null,t.viewX=e,t.viewY=i,this._DragInfo.Listener.OnFling(t)}}))}TouchEventProcess(t){let e=!1;switch(t.type){case i.DragInfo.EVENT_TYPE.OnDown:console.log("TouchEventProcess OnDown in"),this._DoDragPause(t),this._DragInfo.Listener&&this._DragInfo.Listener.OnDown&&(e=this._DragInfo.Listener.OnDown(t));break;case i.DragInfo.EVENT_TYPE.OnTap:this._DragInfo.Listener&&this._DragInfo.Listener.OnTap&&(e=this._DragInfo.Listener.OnTap(t));break;case i.DragInfo.EVENT_TYPE.OnLongPress:this._DragInfo.Listener&&this._DragInfo.Listener.OnLongPress&&(e=this._DragInfo.Listener.OnLongPress(t));break;case i.DragInfo.EVENT_TYPE.OnDragStart:this._DragMovedDistanceX=0,this._DragMovedDistanceY=0,this._DragInfo.Listener&&this._DragInfo.Listener.OnDragStart&&(e=this._DragInfo.Listener.OnDragStart(t));break;case i.DragInfo.EVENT_TYPE.OnMoved:this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved&&(e=this._DoDragMove(t,!0));break;case i.DragInfo.EVENT_TYPE.OnDragEnd:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnDragEnd){e=!!this._SlideIfEnableTabMod(t,-1)||this._DoDragEnd(t)}break;case i.DragInfo.EVENT_TYPE.OnRelease:this._DragInfo.Listener&&this._DragInfo.Listener.OnRelease&&(e=this._DragInfo.Listener.OnRelease(t));break;case i.DragInfo.EVENT_TYPE.OnFling:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnFling){e=!!this._SlideIfEnableTabMod(t,-1)||this._DoFling(t)}break;default:console.log(`TouchEventProcess:${t}`)}return e}DisableDrag(){this._DragInfo=null}EnableDrag(t,e,n){t instanceof i.DragSetting||i.ThrowError("EnableDrag The setting is not Forge.DragSetting"),null===e&&i.ThrowError("EnableDrag The listener is null");const s=new i.DragInfo;s.Settings=t,s.SetListener(e),s.Formula=n,this._DragInfo=s,this.DragControl=null,this._AddEventListener(),i.sRenderBridge.RequestSwap()}RemoveView(t){for(let e=0;e<this.ChildViews.length;e++)if(this.ChildViews[e]===t){t.IsChildOfRootView()&&t._OnDetachFromSystem(),this.ChildViews.splice(e,1),t.ParentView=null;break}}_OnDetachFromSystem(){this._IsChildOfRootView=!1,this._DetachFromSystemCallback?(this._DetachFromSystemCallback.some(((t,e,i)=>{t()})),this._DetachFromSystemCallback=null):this.OnDettachFromSystem();for(let t=0;t<this.ChildViews.length;t++){this.ChildViews[t]._OnDetachFromSystem()}this.ParentView.Element.removeChild(this.Element),this._releaseViewResources()}RegisterDetachCallback(t){t&&(null==this._DetachFromSystemCallback&&(this._DetachFromSystemCallback=[]),this._DetachFromSystemCallback.push(t))}UnregisterDetachCallback(t){if(t&&this._DetachFromSystemCallback){let e=!1,i=this._DetachFromSystemCallback;for(let n=0;n<i.length;n++)if(i[n]===t){i.splice(n,1),e=!0;break}e?0==i.length&&(this._DetachFromSystemCallback=null):console.error("no found")}else console.error("Unregister nothing...")}OnDettachFromSystem(){}_releaseViewResources(){this.Expired||(this.StopAnimation(),this.StopTextureAnimation(),this.Expired=!0)}ClearViews(){const t=this.ChildViews.length;if(0!==t){for(let e=0;e<t;e++){const t=this.ChildViews[e];t&&t.IsChildOfRootView()&&t._OnDetachFromSystem()}this.ChildViews=[]}}_ResetTextStyle(t){this.Element.style.overflow="hidden";let e=i.sTextStyleCache.GetDsFromId(t.Set.IDS.DS).Describe,n=i.sTextStyleCache.GetFsFromId(t.Set.IDS.FS).Describe,s=i.sTextStyleCache.GetCsFromId(t.Set.IDS.CS).Describe,r=null;"DISABLE"!==t.Set.IDS.SS&&(r=i.sTextStyleCache.GetSsFromId(t.Set.IDS.SS).Describe),this.Element.style.fontFamily=n.font,this.Element.style.fontSize=`${t.Set.FS}px`,n.italic&&(this.Element.style.fontStyle="italic"),n.bold?this.Element.style.fontWeight="bold":this.Element.style.fontWeight="normal",this.Element.style.textOverflow=e.text_overflow,this.Element.style.wordBreak="normal";let a=e.word_wrap;"none"===a?this.Element.style.whiteSpace="nowrap":a&&(this.Element.style.wordWrap=a.replace("_","-")),this.Element.style.textAlign=e.alignment,this.Element.style.verticalAlign=e.vertical_area_align,this.Element.style.direction=e.direction;let o=s.text_color;o.startsWith("#")&&9===o.length&&(o="#"+o.substr(3,6)),this.Element.style.color=o;let l=s.bg_color,h=!1;if(l.startsWith("#")&&9===l.length&&(h=l.startsWith("#00"),l="#"+l.substr(3,6)),h||(this.Element.style.backgroundColor=l),r&&(r.shadow_blur>0&&(this.Element.style.textShadow=`${r.shadow_offset_x}px ${r.shadow_offset_y}px ${r.shadow_blur}px ${r.shadow_color}`),r.stroke_width>0&&(this.Element.style.WebkitTextStroke=`${r.stroke_width}px ${r.stroke_color}`)),this.Element.style.width=`${t.Set.W}px`,this.Element.style.height=`${t.Set.H}px`,t.Set.LH&&(this.Element.style.lineHeight=`${t.Set.LH}px`),t.Set.EA){let e=t.Set.EA,i=window.originDocument.createElement("div");i.style.float=e.x>0?"right":"left",i.style.width=e.w+"px",i.style.height=e.h-1+"px",i.style.backgroundColor="rgba(0,0,0,0)",i.style.position="relative",this.Element.appendChild(i)}if(t.Set.LA){const e=M(t.Set.ST);!function(t,e){const i=e.text;for(const n of e.nodeList){if(n.lineFeedNode){t.appendChild(window.originDocument.createElement("br"));continue}const e=i.substring(n.indexPair[0],n.indexPair[1]),s=window.originDocument.createElement("span");let r,a=s;for(const t of n.styleList)switch(t.style){case O.BASE:break;case O.BOLD:r=window.originDocument.createElement("b"),a.appendChild(r),a=r;break;case O.ITALIC:r=window.originDocument.createElement("i"),a.appendChild(r),a=r;break;case O.COLOR:s.style.color=t.styleValue;break;case O.DECORATION:s.style.textDecoration=t.styleValue;break;case O.SUPERSCRIPT:r=window.originDocument.createElement("sup"),a.appendChild(r),a=r;break;case O.SUBSCRIPT:r=window.originDocument.createElement("sub"),a.appendChild(r),a=r}a.textContent=e,t.appendChild(s)}}(this.Element,e)}else{let e=window.originDocument.createElement("span");e.textContent=t.Set.ST,this.Element.appendChild(e)}}_SetBorderRadius(t){(this.InnerChildElement?this.InnerChildElement:this.Element).style.borderRadius=`${t._TopLeft}px ${t._TopRight}px ${t._BottomRight}px ${t._BottomLeft}px`}_InsertProxyLayer(t,e){if(t.ParentView=this,this._IsChildOfRootView){for(let t of this.ChildViews)t._AdvanceDepthForProxyLayer();t._OnAttachToSystem()}t.ChildViews=t.ChildViews.concat(this.ChildViews),t._ChildrenListDirty=!0;for(let e=0;e<t.ChildViews.length;e++)t.ChildViews[e].ParentView=t,t._RequestLayoutForAddingView(t.ChildViews[e]);null!==e?e instanceof i.LayoutParamsBase?t.LayoutParams=e.Clone():t.LayoutParams=new i.LayoutParams(e):null===t.LayoutParams&&(t.LayoutParams=new i.LayoutParams({x:0,y:0})),t.ResetLayoutParams(t.LayoutParams),this.ChildViews=[t],this._ChildrenListDirty=!0,this._RequestLayoutForAddingView(t),this._ProxyView=t,this._IsChildOfRootView&&t._OnAttachToSystem()}_RequestLayoutForAddingView(t){this._RequestLayout()}ResetTexture(t){if(this.TextureSetting=t,t){if(t.Texture.Source)"IMG"===this.Element.tagName?this.Element.src=t.Texture.Source:(this.Element.style.backgroundImage=`url(${t.Texture.Source})`,this.Element.style.backgroundSize="100% 100%");else if(t.Texture.Gradient)this.Element.style.backgroundImage=t.Texture.Gradient;else if(t.Texture.RenderTexture&&t.Texture.RenderTexture._SyncingResourceInfo){const e=t.Texture.RenderTexture._SyncingResourceInfo;if("TST"===e.Nam)this._ResetTextStyle(e);else if("CT"===e.Nam)this.Element.style.backgroundColor=e.Set.Clr;else if("VPLY"===e.Nam){const t=e.Set.Hdl;t.style.width="100%",t.style.height="100%",t.style.objectFit="fill",this.Element.appendChild(t),this.InnerChildElement=t}}t.MaskSetting&&"CORNER"===t.MaskSetting._MaskType&&this._SetBorderRadius(t.MaskSetting)}else this.Element.style.backgroundColor="",this.Element.style.backgroundImage="",this.Element.style.borderRadius=""}SetVisibility(t){this.Element.style.visibility="string"==typeof t?t.toLocaleLowerCase():"inherit"}_OnAttachToSystem(){"svg"!==this.Element.id&&"path"!==this.Element.id||console.log("_OnAttachToSystem appendChild");let t=this.ParentView.ChildViews[this.ParentView.ChildViews.indexOf(this)+1];t&&this.ParentView.Element.contains(t.Element)?this.ParentView.Element.insertBefore(this.Element,t.Element):this.ParentView.Element.appendChild(this.Element),this._IsChildOfRootView=!0;const e=this.ChildViews;let i;for(let t=0;t<e.length;t++)i=e[t],i._OnAttachToSystem()}IsChildOfRootView(){return this._IsChildOfRootView}StartAnimation(t,e,i){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(t),this.TransformAnimationObj=null,window.jsvInAndroidWebView?this.Element.style.webkitAnimation=null:this.Element.style.animation=null),null==this._ProxyView?(this.TransformAnimationObj=t,!isNaN(i)&&i>0&&t.EnableDelay(i),t.Start(this)):this._ProxyView.StartAnimation(t,e,i)}ApplyStyleTransition(t){this.TransitionStore={...this.TransitionStore,...t};let e="";Object.values(this.TransitionStore).forEach((t=>{e&&(e+=","),e+=t})),window.jsvInAndroidWebView?this.Element.style.webkitTransition=e:this.Element.style.transition=e}StopAnimation(){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(),this.TransformAnimationObj=null),null==this._ProxyView||this._ProxyView.StopAnimation()}StartTextureAnimation(t){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(t),this._TextureAnimationObj=null),this._TextureAnimationObj=t,t.AsTextureAnimation(),t.Start(this),this._RequestLayout()}_RequestLayout(){}StopTextureAnimation(){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(),this._TextureAnimationObj=null)}StopAllAnimations(){this.StopAnimation(),this.StopTextureAnimation();for(let t=0;t<this.ChildViews.length;t++)this.ChildViews[t].StopAllAnimations()}GetAnimation(){return this.TransformAnimationObj}DetachAnimation(t){this.TransformAnimationObj===t&&(this.TransformAnimationObj=null,window.jsvInAndroidWebView?(this.Element.style.webkitAnimation=null,this.Element.style.webkitTransition=null):(this.Element.style.animation=null,this.Element.style.transition=null))}ResetCssTransform(t,e){t===this._CssTransform&&e===this._CssTransformOrigin||(window.jsvInAndroidWebView?(this.Element.style.webkitTransform=t,this.Element.style.webkitTransformOrigin=e):(this.Element.style.transform=t,this.Element.style.transformOrigin=e),this._CssTransform=t,this._CssTransformOrigin=e)}ResetTextureCssTransform(t,e){this.ResetCssTransform(t,e)}SetId(t){this.Id=t}ResetLayoutParams(t){null==this._ProxyView?null!==t?(t instanceof i.LayoutParamsBase?this.LayoutParams=t.Clone():this.LayoutParams=new i.LayoutParams(t),this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`,this.LayoutParams.Width&&(this.Element.style.width=`${this.LayoutParams.Width}px`),this.LayoutParams.Height&&(this.Element.style.height=`${this.LayoutParams.Height}px`)):i.ThrowError("ResetLayoutParams(): new params is null"):this._ProxyView.ResetLayoutParams(t)}GetRenderer(){return i.LayoutViewBase.sRenderer}GetLayoutParams(){return this.LayoutParams?this.LayoutParams.Clone():new i.LayoutParams}EnableAutoHeight(){this._AutoHeight=!0}WaitTextureToResize(t){}ApplyObjectFit(t,e,i,n,s,r){null===this._ObjectFitTestCache&&(this._ObjectFitTestCache={frameWidth:NaN,frameHeight:NaN,textureWidth:NaN,textureHeight:NaN,objectFit:null,clipLayout:null});const a=this._ObjectFitTestCache;if(a.frameWidth===t&&a.objectFit===s&&a.frameHeight===e&&a.textureWidth===i&&a.textureHeight===n)return a.clipLayout;const o={x:0,y:0,width:t,height:e,overflow:!1};a.frameWidth=t,a.frameHeight=e,a.textureWidth=i,a.textureHeight=n,a.objectFit=s,a.clipLayout=o;let l={width:0,height:0},h=t/e;const u=i/n;if(!u)return console.warn("Warning:Texture size is 0!"),o;if(0===t||0===e){if(0===t&&0===e)return o;0===t?t=e*u:e=t/u,h=t/e}let c="";switch(s){case r.FILL:l.width=t,l.height=e,c="fill";break;case r.NONE:l.width=i,l.height=n,c="none";break;case r.COVER:l=this._StretchSize(t,e,u,u<h),c="cover";break;case r.SCALEDOWN:{let s=u>h;t>i&&e>n&&(s=u<h),l=this._StretchSize(t,e,u,s),c="scaledown";break}case r.CONTAIN:l=this._StretchSize(t,e,u,u>h),c="contain";break;default:throw new Error("Unexpected object-fit.")}l.width=Math.floor(l.width),l.height=Math.floor(l.height),o.width=Math.min(l.width,t),o.height=Math.min(l.height,e),o.x=Math.floor((t-o.width)/2),o.y=Math.floor((e-o.height)/2),o.overflow=l.width>t||l.height>e;const d=this.InnerChildElement?this.InnerChildElement:this.Element;return d.style.width=`${t}px`,d.style.height=`${e}px`,d.style.objectFit=c,o}_StretchSize(t,e,i,n){const s={width:0,height:0};return n?(s.width=t,s.height=t/i):(s.height=e,s.width=e*i),s}GetPositionOffset(t){let e=this,n=0,s=0;for(;t!==e;)n+=e.LayoutParams?e.LayoutParams.MarginLeft:0,s+=e.LayoutParams?e.LayoutParams.MarginTop:0,e=e.ParentView,e||i.ThrowError("ERROR: Target parent layoutview is not found in LayoutView tree");return new i.Coordinate(n,s)}_dispatchLongPress(){this._LongPressDelayRequestTaskId=0,this._InLongPress=!0;const t={type:i.DragInfo.EVENT_TYPE.OnLongPress,x:this._CurrentDownEvent.designX,y:this._CurrentDownEvent.designY};this.TouchEventProcess(t)}_onMouseDown(t,e,n){this._Velocity.x.reset(),this._Velocity.y.reset(),this._Velocity.x.updatePosition(t),this._Velocity.y.updatePosition(e),this._LastFocusX=t,this._DownFocusX=this._LastFocusX,this._LastFocusY=e,this._DownFocusY=this._LastFocusY,this._CurrentDownEvent={designX:t,designY:e,timeStamp:n},this._AlwaysInTapRegion=!0,this._InLongPress=!1,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0),this._LongPressDelayRequestTaskId=setTimeout(this._dispatchLongPress,600);return{type:i.DragInfo.EVENT_TYPE.OnDown,x:t,y:e,deltaX:0,deltaY:0}}_onMouseMove(t,e,n){if(!this._CurrentDownEvent)return null;this._Velocity.x.updatePosition(t),this._Velocity.y.updatePosition(e);const s=parseInt(t-this._LastFocusX,10),r=parseInt(e-this._LastFocusY,10),a=parseInt(t-this._DownFocusX,10),o=parseInt(e-this._DownFocusY,10);let l=null;if(this._AlwaysInTapRegion){a*a+o*o>this._TouchSlopSquare&&(l={type:i.DragInfo.EVENT_TYPE.OnDragStart,x:t,y:e},this._LastFocusX=t,this._LastFocusY=e,this._LastTimeStamp=n,this._AlwaysInTapRegion=!1,this._InLongPress=!1,this._InDragging=!0,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0))}else this._InDragging&&(Math.abs(s)>=1||Math.abs(r)>=1)&&(l={type:i.DragInfo.EVENT_TYPE.OnMoved,x:t,y:e,deltaX:a,deltaY:o,_deltaX:s,_deltaY:r,timeStamp:parseInt((this._LastTimeStamp-n)/1e3,10)},this._LastFocusX=t,this._LastFocusY=e,this._LastTimeStamp=n);return l}_onMouseUp(t,e,n){let s=null;if(this._CurrentDownEvent){const n=window.Forge.DesignMap(),r=Math.floor(n.displayScale*n.width),a=window.innerWidth/r,o=this._Velocity.x.getVelocity()/a,l=this._Velocity.y.getVelocity()/a;let h=t-this._CurrentDownEvent.designX,u=e-this._CurrentDownEvent.designY;const c=t-this._LastFocusX,d=e-this._LastFocusY;this._InLongPress||(this._AlwaysInTapRegion?s={type:i.DragInfo.EVENT_TYPE.OnTap,x:t,y:e,velocityX:0,velocityY:0,deltaX:h,deltaY:u,_deltaX:c,_deltaY:d}:(Math.abs(l)>70||Math.abs(o)>70?(h=this._GetSplineFlingDistance(o),u=this._GetSplineFlingDistance(l),s={type:i.DragInfo.EVENT_TYPE.OnFling,x:t,y:e,velocityX:o,velocityY:l,deltaX:o<0?-h:h,deltaY:l<0?-u:u,_deltaX:c,_deltaY:d}):s={type:i.DragInfo.EVENT_TYPE.OnDragEnd,x:t,y:e,deltaX:h,deltaY:u,_deltaX:c,_deltaY:d},this.TouchEventProcess(s),s={type:i.DragInfo.EVENT_TYPE.OnRelease,x:t,y:e,deltaX:h,deltaY:u,_deltaX:c,_deltaY:d},this._CurrentDownEvent=null)),this._InLongPress=!1,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0)}return s}_onTouchEvent(t){const e=window.Forge.DesignMap(),i=Math.floor(e.displayScale*e.width),n=window.innerWidth/i,s=t.clientX/n,r=t.clientY/n;let a=null;switch(t.type){case"touchstart":case"mousedown":a=this._onMouseDown(s,r,t.timeStamp);break;case"touchmove":case"mousemove":a=this._onMouseMove(s,r,t.timeStamp);break;case"touchend":case"touchcancel":case"mouseup":a=this._onMouseUp(s,r,t.timeStamp)}return!!a&&this.TouchEventProcess(a)}_AddEventListener(){this.Element.style.pointerEvents="auto",this._ValidTouch=!1;"ontouchstart"in window?(this.Element.addEventListener("touchstart",(t=>{if(console.log("touchstart",t),this._ValidTouch=!0,t.touches&&t.touches.length>0){console.log(`touchstart event.touches[0].clientX:${t.touches[0].clientX}, event.touches[0].clientY:${t.touches[0].clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchmove",(t=>{if(this._ValidTouch&&(console.log("touchmove",t),t.touches&&t.touches.length>0)){console.log(`touchmove event.touches[0].clientX:${t.touches[0].clientX}, event.touches[0].clientY:${t.touches[0].clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchend",(t=>{if(console.log(`touchend event.touches.length:${t.touches.length}, event.clientX:${t.clientX}, event.pageX:${t.pageX}`),this._ValidTouch=!1,t.changedTouches&&t.changedTouches.length>0){console.log(`touchend event.changedTouches[0].clientX:${t.changedTouches[0].clientX}, event.changedTouches[0].pageX:${t.changedTouches[0].pageX}`);this._onTouchEvent({type:t.type,clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchcancel",(t=>{if(this._ValidTouch=!1,console.log("touchcancel",t),t.changedTouches&&t.changedTouches.length>0){console.log(`touchcancel event.clientX:${t.clientX}, event.clientY:${t.clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0)):(this.Element.addEventListener("mousedown",(t=>{console.log("mousedown",t),this._ValidTouch=!0;this._onTouchEvent(t)&&t.stopPropagation()}),!0),this.Element.addEventListener("mousemove",(t=>{if(this._ValidTouch){this._onTouchEvent(t)&&t.stopPropagation()}}),!0),this.Element.addEventListener("mouseup",(t=>{console.log("mouseup",t),this._ValidTouch=!1;this._onTouchEvent(t)&&t.stopPropagation()}),!0))}_GetSplineDeceleration(t){return Math.log(i.DragInfo.INFLEXION*Math.abs(t)/(i.DragInfo.SCROLL_FRICTION*i.DragInfo.PHYSICAL_COEF))}_GetSplineFlingDistance(t){const e=this._GetSplineDeceleration(t),n=i.DragInfo.DECELERATION_RATE-1;return i.DragInfo.SCROLL_FRICTION*i.DragInfo.PHYSICAL_COEF*Math.exp(i.DragInfo.DECELERATION_RATE/n*e)}_DoDragMove(t,e){let n=t._deltaX,s=t._deltaY;this._DragMovedDistanceX+=n,this._DragMovedDistanceY+=s,e||(n=t.deltaX,s=t.deltaY);const r=t.timeStamp/1e3;let a=`left ${r}s, top ${r}s`;this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_VERTICAL?(n=0,a=`top ${r}s`):this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_HORIZONTAL?(s=0,a=`left ${r}s`):this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_DISABLE&&(n=0,s=0);let o=this.GetLayoutParams();return o=this._GetMovedLayoutParams(n,s),e&&(this.Element.style.transition=a,this.ResetLayoutParams(o)),!!((Math.abs(this._DragMovedDistanceX)>=this._DragInfo.Settings.TriggerMovedDistance||Math.abs(this._DragMovedDistanceY)>=this._DragInfo.Settings.TriggerMovedDistance)&&this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved)&&(t.viewX=o.MarginLeft,t.viewY=o.MarginTop,this._DragInfo.Listener.OnMoved(t))}_GetMovedLayoutParams(t,e){const i=this.GetLayoutParams();let n=i.MarginLeft+t,s=i.MarginTop+e;return n>this._DragInfo.Settings.SlidePile.x?n=this._DragInfo.Settings.SlidePile.x:n+i.Width<this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width&&(n=this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width-i.Width),s>this._DragInfo.Settings.SlidePile.y?s=this._DragInfo.Settings.SlidePile.y:s+i.Height<this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height&&(s=this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height-i.Height),i.SetPosition(n,s),i}_SlideIfEnableTabMod(t,e){if(!this._DragInfo.Settings.EnableTabMode)return!1;const n=t._deltaX,s=t._deltaY;let r=t.deltaX,a=t.deltaY,o=this._DragInfo.Settings.PageWidth*this._DragInfo.Settings.PageEdge;const l=this.GetLayoutParams(),h=l.MarginLeft+n,u=l.MarginTop+s;switch(t.type===i.DragInfo.EVENT_TYPE.OnFling&&(o=0),this._DragInfo.Settings.DragDirection){case i.DragSetting.DIRECTION_VERTICAL:if(r=0,a>=0){const t=this._DragInfo.Settings.PageWidth-Math.abs(u)%this._DragInfo.Settings.PageWidth;a=t>=o?this._DragInfo.Settings.PageWidth-t:-t}else{const t=Math.abs(u)%this._DragInfo.Settings.PageWidth;a=t>=o?-(this._DragInfo.Settings.PageWidth-t):t}break;case i.DragSetting.DIRECTION_HORIZONTAL:if(a=0,r>=0){const t=this._DragInfo.Settings.PageWidth-Math.abs(h)%this._DragInfo.Settings.PageWidth;r=t>=o?this._DragInfo.Settings.PageWidth-t:-t,console.log(`right, left_width:${t}, distance_x:${r}`)}else{const t=Math.abs(h)%this._DragInfo.Settings.PageWidth;r=t>=o?-(this._DragInfo.Settings.PageWidth-t):t,console.log(`left, left_width:${t}, distance_x:${r}`)}break;case i.DragSetting.DIRECTION_AUTO:console.log("slideIfEnableTabMode DragDirection error DRAG_DIRECTION_AUTO")}if(0===r&&0===a)return console.log("slideIfEnableTabMode distance_x === 0 && distance_y === 0"),!1;const c=Math.sqrt(r*r+a*a)/.3;return t.deltaX=r,t.deltaY=a,this._DonFlingAnim(t,c),!0}_DoDragEnd(t){let e=t._deltaX,n=t._deltaY;this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_VERTICAL?e=0:this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_HORIZONTAL?n=0:this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_DISABLE&&(e=0,n=0),console.log("_DoDragEnd event:",t,this.Element.style);let s=this.GetLayoutParams();return s=this._GetMovedLayoutParams(e,n),this.ResetLayoutParams(s),t.viewX=s.MarginLeft,t.viewY=s.MarginTop,this._DragInfo.Listener.OnDragEnd(t)}_DragImactSensorRecycle(){console.log("_DragImactSensorRecycle this._DragImactSensor:",this._DragImactSensor),this._DragImactSensor&&this._DragImactSensor.Recycle()}_DonFlingAnim(t,e){const n=t.deltaX,s=t.deltaY,r=this.GetLayoutParams(),a=r.MarginLeft,o=r.MarginTop,l=r.MarginLeft+n,h=r.MarginTop+s,u=this._GetMovedLayoutParams(n,s);if(u.MarginLeft===r.MarginLeft&&u.MarginTop===r.MarginTop)return void console.log("_DonFlingAnim adjust_lp.MarginLeft === lp.MarginLeft && adjust_lp.MarginTop === lp.MarginTop");this.DragControl=new i.DragTranslateControl,this.DragControl._SetView(this),this.DragControl.speed(e),console.log(`OnFling speed:${e}`);const c=this._DragInfo.Settings;this._DragImactSensorRecycle(),this.Element.style.transform=null,this.DragControl.target(r.MarginLeft,r.MarginTop).jumpSilent(),r.SetPosition(0,0),this.ResetLayoutParams(r);let d=0;this.DragControl.target(l,h).start(((e,i)=>{this.DragControl=null,r.SetPosition(e,i),this.ResetLayoutParams(r),this.Element.style.transform=null,this._DragImactSensorRecycle(),t.viewX=e,t.viewY=i,this._DragInfo.Listener.OnFling(t),console.log(`_DonFlingAnim end view_x:${e}, view_y:${i}, distance_x:${n}, distance_y:${s}`)}),(t=>{const e=n*t,i=s*t;if(console.log(`_DonFlingAnim progress:${t}, deltaX:${e}, deltaY:${i}`),Math.abs(e)>this._DragInfo.Settings.TriggerMovedDistance||Math.abs(i)>this._DragInfo.Settings.TriggerMovedDistance){const t={deltaX:a+e,deltaY:o+i,_deltaX:e,_deltaY:i,timeStamp:parseInt((Date.now()-d)/1e3,10)};this._DoDragMove(t,!1),d=Date.now()}}));const _=this.GetPositionOffset(this.ParentView);this._DragImactSensor=new i.DragImpactSensor([{x:c.SlidePile.x+_.x,y:c.SlidePile.y+_.y},{x:c.SlidePile.x+_.x+c.SlidePile.width,y:c.SlidePile.y+_.y},{x:c.SlidePile.x+_.x,y:c.SlidePile.y+_.y+c.SlidePile.height},{x:c.SlidePile.x+_.x+c.SlidePile.width,y:c.SlidePile.y+_.y+c.SlidePile.height}],this.Element,new i.sImpactSensorManager.Callback((e=>{this._DoDragPause(t),this._DragImactSensorRecycle()}),null))}_DoFling(t){let e=t.deltaX,n=t.deltaY,s=!0,r=0;switch(this._DragInfo.Settings.DragDirection){case i.DragSetting.DIRECTION_VERTICAL:e=0,0===n&&(s=!1),r=Math.abs(t.velocityY);break;case i.DragSetting.DIRECTION_HORIZONTAL:n=0,0===e&&(s=!1),r=Math.abs(t.velocityX);break;case i.DragSetting.DIRECTION_DISABLE:s=!1;break;default:r=Math.sqrt(t.velocityX**2,t.velocityY**2)}return s&&(t.deltaX=e,t.deltaY=n,this._DonFlingAnim(t,r)),!0}GetBoundingClientRect(){return new Promise(((t,e)=>{this.Element?setTimeout((()=>{let e=this,n=0;for(;e;)e.TransformAnimationObj&&e.TransformAnimationObj.repeatTimes>0&&(n++,e.TransformAnimationObj.AddAnimationListener(new i.AnimationListener(null,(e=>{if(n--,n<=0){const{left:e,top:i,width:n,height:s}=this.Element.getBoundingClientRect();t({left:e,top:i,width:n,height:s})}})))),e=e.ParentView}),1):e(new Error("BrowserError: dom element is null."))}))}}H.DivId=0,i.LayoutViewBase=H;class U extends i.LayoutViewBase{constructor(t,e){!t||t instanceof i.TextureSetting||i.ThrowError("ERROR:LayoutView need TextureSetting as parameter"),super(t,e=e||"div")}}i.LayoutView=U,window.LayoutView=i.LayoutView;class X extends i.LayoutView{constructor(){super(void 0,"root"),this._ViewType=1,this._IsChildOfRootView=!0,window.gRootView=this,i.sRootView=this}Init(t,e,i,n,s){this.InitLayoutViewStaticValues(t),this.ResetLayoutParams({x:0,y:0,width:1280,height:720})}InitLayoutViewStaticValues(t){i.LayoutViewBase.sRenderer=t,i.LayoutViewBase.sInternalTextureManager=t.GetSharedTextureManager(),i.LayoutViewBase.sIdentityMat4=new i.Mat4,i.LayoutViewBase.sNullDirectParentMat4=new i.Mat4,i.LayoutViewBase.sBakeFlipYMat4=(new i.Mat4).rotatex(180)}}i.RootView=X,window.RootView=i.RootView;class Y{constructor(t,e,i,n,s){this.coordX=t,this.coordY=e,this.width=i,this.height=n,this.useScissors=s,this.maskStencil=null}updateInfo(t,e,i,n,s){this.coordX=t,this.coordY=e,this.width=i,this.height=n,this.useScissors=s}setMaskStencil(t){this.maskStencil=t}}class z extends i.LayoutView{constructor(t){super(t,"div"),this._ClipRectInfo=null,this.Id="ClipView",this.TextureSetting=null}SetId(t){this.Id=`${t}_ClipView`}SetClipRect(t,e,i,n,s){null===this._ClipRectInfo?this._ClipRectInfo=new Y(t,e,i,n,s):this._ClipRectInfo.updateInfo(t,e,i,n,s);const r=t,a=e,o=this.LayoutParams.Width-r-i,l=this.LayoutParams.Height-a-n;s?(this.Element.style.overflow="hidden",this.Element.style.clipPath=`inset(${a}px ${o}px ${l}px ${r}px)`):(this.Element.style.overflow="visible",this.Element.style.clipPath="unset")}}i.ClipView=z,window.ClipView=i.ClipView;class K extends i.LayoutView{constructor(t){super(t,"div"),this._HorizontalRepeats=[0,0,0,0],this._VerticalRepeats=[0,0,0,0],this._HorizontalPadding=[0,0],this._VerticalPadding=[0,0],this._ImageDspWidth=0,this._ImageDspHeight=0}ResetTexture(t){this.TextureSetting=t,this._ApplyChanges()}SetRepeat(t,e){i.Assert(t.length<=2),i.Assert(e.length<=2);for(let i=0;i<2;i++)i<t.length?(this._HorizontalRepeats[2*i]=t[i].start,this._HorizontalRepeats[2*i+1]=t[i].width):(this._HorizontalRepeats[2*i]=0,this._HorizontalRepeats[2*i+1]=0),i<e.length?(this._VerticalRepeats[2*i]=e[i].start,this._VerticalRepeats[2*i+1]=e[i].width):(this._VerticalRepeats[2*i]=0,this._VerticalRepeats[2*i+1]=0);return this._ApplyChanges(),this}SetPadding(t,e){return i.Assert(null!==t),i.Assert(null!==e),this._VerticalPadding[0]=e.start,this._VerticalPadding[1]=e.width,this._HorizontalPadding[0]=t.start,this._HorizontalPadding[1]=t.width,this._ApplyChanges(),this}SetImageDspSize(t,e){this._ImageDspWidth=t,this._ImageDspHeight=e}_ApplyChanges(){let t=this.TextureSetting;if(t){if(t.MaskSetting&&"CORNER"===t.MaskSetting._MaskType&&this._SetBorderRadius(t.MaskSetting),t.Texture.Source){const e=t.Texture.RenderTexture.Width,i=t.Texture.RenderTexture.Height,n=e/this._ImageDspWidth,s=i/this._ImageDspHeight,r=this._HorizontalRepeats[0],a=this._ImageDspWidth-this._HorizontalRepeats[1]-r,o=this._VerticalRepeats[0],l=this._ImageDspHeight-this._VerticalRepeats[1]-o;let h=Math.floor(this._HorizontalRepeats[0]*n),u=e-Math.floor(this._HorizontalRepeats[1]*n)-h,c=Math.floor(this._VerticalRepeats[0]*s),d=i-Math.floor(this._VerticalRepeats[1]*s)-c;h+u>=e&&(h-=1,u-=1),c+d>=i&&(c-=1,d-=1);const _=`${c} ${u} ${d} ${h}`;this.Element.style.borderImage=`url(${t.Texture.Source}) ${_} fill`;const f=this._HorizontalPadding[0],g=this._ImageDspWidth-this._HorizontalPadding[1]-f,m=this._VerticalPadding[0],p=this._ImageDspHeight-this._VerticalPadding[1]-m;this.Element.style.borderImageWidth=`${o}px ${a}px ${l}px ${r}px`,this.Element.style.borderImageOutset=`${m}px ${g}px ${p}px ${f}px`}}else this.Element.style.borderRadius="",this.Element.style.borderImage=""}}i.NinePatchView=K;class j extends i.LayoutView{constructor(t){let e;e=t.startsWith("jsve-")?t.substr(5):t.substr(3),super(void 0,e)}setAttribute(t,e){this.Element.setAttribute(t,e)}removeAttribute(t){this.Element.removeAttribute(t)}getAttribute(t){return this.Element.getAttribute(t)}hasAttribute(t){return this.Element.hasAttribute(t)}get textContent(){return this.Element.textContent}set textContent(t){this.Element.textContent=t}}i.JsvElementView=j;class q extends i.LayoutView{constructor(t,e){super(e),this._ViewType=8,this.Element=t.Ele,this.Id="VideoView"}SetId(t){this.Id=`${t}_VideoView`}ResetLayoutParams(t){null!==t?(t instanceof i.LayoutParamsBase?this.LayoutParams=t.Clone():this.LayoutParams=new i.LayoutParams(t),this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`,this.LayoutParams.Width&&(this.Element.style.width=`${this.LayoutParams.Width}px`),this.LayoutParams.Height&&(this.Element.style.height=`${this.LayoutParams.Height}px`)):i.ThrowError("ResetLayoutParams(): new params is null")}_OnDetachFromSystem(){super._OnDetachFromSystem(),this._VideoPlayerHdl&&(this._VideoPlayerHdl.unload(),this._VideoPlayerHdl=null)}}i.VideoView=q;class J extends i.LayoutView{constructor(){super(null,"input"),this._ViewType=5,this._InputType=i.TextInputType.TEXT,this.Id="EditControlView"}_OnAttachToSystem(){super._OnAttachToSystem(),this.Element.style.left="-1920px",this.Element.style.top="-1080px",this.Element.style.width="1px",this.Element.style.height="1px",this.Element.style.pointerEvents="auto",this.Element.addEventListener("keydown",(t=>{t=t||window.event;let e=this.Element.selectionStart;console.log(`keydown cur_offset:${e}`),37===t.keyCode?(--e,e<0&&(e=0),e!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,e,!0),t.stopPropagation&&t.stopPropagation()):this.Element.blur()):39===t.keyCode?(++e,e>this.Element.value.length&&(e=this.Element.value.length),e!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,e,!0),t.stopPropagation&&t.stopPropagation()):this.Element.blur()):38!==t.keyCode&&40!==t.keyCode||this.Element.blur()})),this.Element.onfocus=t=>{console.log("onfocus in"),this.OnStatusChanged(1)},this.Element.onblur=t=>{console.log("onblur in"),this.OnStatusChanged(0)};this.Element.oninput=t=>{if(console.log("oninput:",t),t.target.value.length>0&&t.target.selectionStart>0){const n=t.target.selectionStart-1,s=t.target.selectionStart,r=t.target.value.slice(n,s);e=r,"0".charCodeAt()<=e.charCodeAt()&&e.charCodeAt()<="9".charCodeAt()||this._InputType!==i.TextInputType.NUMBER||(t.target.value=t.target.value.substr(0,n)+t.target.value.substr(s),t.target.selectionStart=n)}var e;const n=t.target.value,s=t.target.selectionStart;this.OnTextChanged(decodeURIComponent(n),s)}}SetId(t){this.Id=`${t}_EditControlView`}showIme(t,e,n){this.Element?t!==i.TextInputType.NONE?(null==n&&(n=e.length>0?e.length:0),n<0?n=0:n>e.length&&(n=e.length>0?e.length:0),this._InputType=t,this.Element.type="text",this.Element.value=e,this.Element.focus(),this.Element.selectionStart=n,this.Element.selectionEnd=n):console.log("showIme input_type error"):console.log("showIme but ele is null!")}hideIme(){this.Element?this.Element.blur():console.log("hideIme, but ele is null!")}updateCursorOffset(t,e){this.Element?(this.Element.selectionStart=e,this.Element.selectionEnd=e,this.Element.value=t):console.log("updateCursorOffset, but ele is null!")}OnTextChanged(t,e,i){console.log(`OnTextChanged value:${t}`)}OnStatusChanged(t){}OnEditAction(t){}}class Z extends i.LayoutView{constructor(t,e=1){super(t),this._ViewType=10,this._FilterType=e,this.Id="FilterView",this.Element.style.filter="grayscale(100%)"}FilterSwitch(t){this.Element&&(this.Element.style.filter=t?"grayscale(100%)":"")}SetId(t){this.Id=t+"_FilterView"}}i.FilterView=Z,i.TextInputType={NONE:0,TEXT:1,PASSWORD:2,TEXT_AREA:3,CONTENT_EDITABLE:4,SEARCH:5,URL:6,EMAIL:7,TELEPHONE:8,NUMBER:9},i.EditControlView=J;class Q{constructor(t){this._Current=new Array(t).fill(0),this._Target=new Array(t).fill(0),this._RepeatStart=new Array(t).fill(0),this._JumpTarget=null,this._Jumping=!1,this._ParameterCount=t,this._StateIndex=0,this._StateLocked=!1,this._StartSwitcher=!1,this._PausedCallback=null,this._EndCallback=null,this._NextEndCallback=null,this._Token=0,this._Repeat=!1,this._OnRepeatCallback=null,this._SpriteView=null,this._AdvanceCallback=null}setRepeat(t,e){return this._Repeat=t,this._OnRepeatCallback=t?e:null,this}start(t,e){this._NextEndCallback=t,this._EndCallback=null,this._AdvanceCallback=e,this._StartSwitcher=!0,this._Jumping=!1,this._StateMachineNext()}pause(t){this._AdvanceCallback=null,null===this._EndCallback&&null===this._NextEndCallback||(this._EndCallback=null,this._NextEndCallback=null),0===this._StateIndex?t&&this._CallbackWithCatch(this._Current,t):(t&&(this._PausedCallback=t),this._StateMachineNext())}jump(){this._JumpTarget=[...this._Target],this._Jumping=!0,this._StartSwitcher=!0,this._StateMachineNext()}jumpSilent(){this._JumpTarget=[...this._Target]}startFpsTesting(){i.sRenderBridge.SetStepFpsSwitch(!0)}stopFpsTesting(){i.sRenderBridge.SetStepFpsSwitch(!1)}_WrapBuildAnimation(t,e,i,n){console.warn("Should Override")}_WrapCallback(t,e){console.warn("Should Override")}_CallbackWithCatch(t,e){try{this._WrapCallback(t,e)}catch(t){console.error("Error:in callback"),console.error(t)}}_StateMachineNext(){this._StateLocked||(0===this._StateIndex?this._StartSwitcher&&(this._StartSwitcher=!1,this._StartAnimation()&&(this._StateIndex=1)):1===this._StateIndex&&this._StopAnimation())}_StartAnimation(){this._EndCallback=this._NextEndCallback,this._NextEndCallback=null;const t=this._JumpTarget?[...this._JumpTarget]:[...this._Current],e=this._Target,n=this._Repeat?[...this._RepeatStart]:null,s=this._WrapBuildAnimation(n,t,e,this._Jumping);if(this._JumpTarget=null,this._Jumping=!1,null===s)return;const r=[...e],a=this,o=(new i.AnimationListener).OnFinalProgress((e=>{a._OnPaused(null!==n?n:t,r,e)})).OnAdvance((t=>{this._AdvanceCallback&&this._AdvanceCallback(t)}));return this._OnRepeatCallback&&o.OnRepeat((t=>{a._OnRepeatCallback&&a._OnRepeatCallback(t)})),s.AddAnimationListener(o),s.Enable(i.AnimationEnable.KeepTransform),this._Repeat&&s.EnableInfinite(),this._SpriteView.StartAnimation(s),!0}_StopAnimation(){this._SpriteView.StopAnimation()}_OnPaused(t,e,i){for(let n=0;n<this._ParameterCount;n++)this._Current[n]=Math.floor((e[n]-t[n])*i+t[n]);this._StateLocked=!0;const n=this._PausedCallback,s=this._EndCallback;this._PausedCallback=null,n&&this._CallbackWithCatch(this._Current,n),s&&1===i&&(this._EndCallback=null,this._CallbackWithCatch(this._Current,s)),this._StateLocked=!1,this._StateIndex=0;this._StateMachineNext()}_SetView(t){this._SpriteView=t}}i.DragTranslateControl=class extends Q{constructor(){super(2),this._Mode=0,this._Speed=0,this._VerlocityAcc=0,this._VerlocityInit=0,this._AccAlongX=!0,this._AnimationRef=null,this._AllowFrameStep=!1}allowFrameStepMode(t){return this._AllowFrameStep=t,this}selectMode(t){switch(t){case"UniformMotion":this._Mode=0;break;case"AcceleratedMotion":this._Mode=1,this.setRepeat(!1);break;default:console.error(`Unsupported input=${t}`)}return this}targetX(t){return this._Target[0]=t,this}targetY(t){return this._Target[1]=t,this}target(t,e){return this._Target[0]=t,this._Target[1]=e,this}enableRepeatFrom(t,e,i){if(this._ComfirmMode(0))return this.setRepeat(!0,i),this._RepeatStart[0]=t,this._RepeatStart[1]=e,this}speed(t){if(console.log(`speed, pixel_per_second:${t}`),this._ComfirmMode(0))return this._Speed=t,this}accelerateX(t,e){if(this._ComfirmMode(1))return this._Target[0]=e,this._VerlocityAcc=t,this._VerlocityInit=0,this._AccAlongX=!0,this}accelerateY(t,e){if(this._ComfirmMode(1))return this._Target[1]=e,this._VerlocityAcc=t,this._VerlocityInit=0,this._AccAlongX=!1,this}decelerateX(t,e){if(this._ComfirmMode(1))return this._VerlocityAcc=t,this._VerlocityInit=e,this._AccAlongX=!0,this}decelerateY(t,e){if(this._ComfirmMode(1))return this._VerlocityAcc=t,this._VerlocityInit=e,this._AccAlongX=!1,this}decelerate(t,e,i,n){if(1===this._Mode)return this._VerlocityAcc[0]=t,this._VerlocityAcc[1]=e,this._VerlocityInit[0]=i,this._VerlocityInit[1]=n,this;console.error("Error: mode error")}_ComfirmMode(t){return this._Mode===t||(console.error("Error: mode error"),!1)}_WrapBuildAnimation(t,e,i,n){return n?this._AnimationRef=this._UniformMove(null,e,i,n):0===this._Mode?this._AnimationRef=this._UniformMove(t,e,i,!1):1===this._Mode&&(this._AnimationRef=this._AccelerMove(e,i)),this._AnimationRef}_UniformMove(t,e,n,s){let r=0,a=0,o=0,l=1;const h=e[0],u=e[1],c=n[0],d=n[1];if(null!==t){r=t[0],a=t[1];const e=this._Distance(h,u,c,d),i=this._Distance(r,a,c,d);o=(i-e)/i,s||(l=1e3*i/this._Speed)}else r=h,a=u,o=0,s||(l=1e3*this._Distance(h,u,c,d)/this._Speed);s||0!==l||console.warn("Discard starting request for no distance");let _=null;if(r!==c&&a!==d||s||!this._AllowFrameStep||!window.JsView)_=new i.TranslateAnimation(r,c,a,d,l,null);else{console.log("Using frame translate animation");let t=0,e=0,n=!0;r!==c?(t=r,e=c,n=!0):(t=a,e=d,n=!1),_=new i.TranslateFrameAnimation(t,e,this._Speed,n)}return 0!==o&&(o<0?console.warn("Warning: start position out of repeating range"):_.SetStartPos(o)),_}_AccelerMove(t,e){const n=this._AccAlongX?t[0]:t[1],s=this._VerlocityInit,r=this._VerlocityAcc;let a,o,l,h,u=!0;if(0!==r)return 0===s?(a=this._AccAlongX?e[0]:e[1],o=Math.floor(1e3*Math.sqrt(2*Math.abs(a-n)/r)),u=!0):(o=Math.floor(1e3*Math.abs(s)/r),a=n+Math.floor(5e-4*s*o),u=!1),0===o&&console.warn("no moved..."),this._AccAlongX?(l=a,this._Target[0]=l,h=this._Target[1]):(l=this._Target[0],h=a,this._Target[1]=h),new i.TranslateAnimation(t[0],l,t[1],h,o,u?i.Easing.Circular.In:i.Easing.Circular.Out);console.error("Error: no found acceleration")}_Distance(t,e,i,n){const s=i-t,r=n-e;return Math.sqrt(s*s+r*r)}_WrapCallback(t,e){this._AnimationRef=null,e&&e(t[0],t[1])}};class tt extends i.LayoutView{constructor(){super(),this._ChildTextView=null}PutChildTextView(t){this._ChildTextView=t,this.AddView(t)}EnableAutoHeight(){this._ChildTextView.EnableAutoHeight()}}class et{StringWithFont(t,e,i,n,s,r,a,o,l,h,u){e||(e=et._sDefaultFontSize),i||(i=et._sDefaultFont);let c="";!0===a&&(c="italic");let d="";return!0===o&&(d="bold"),n||(n="left"),s||(s="middle"),r||(r=et._sDefaultFontColor),l||(l=null),u||(u="top"),h||(h=-1),{str:`${t}`,font:i,size:e,italic:c,bold:d,stroke_width:h,alignment:n,vertical_align:s,textColour:r,backgroundColour:et._sDefaultBackgroundColor,enableBlend:!0,shadow:l,vertical_area_align:u}}TextAttr(t,e){return t||(t="none"),e||(e="none"),{text_overflow:t,word_wrap:e}}GetTextWidth(...t){if(t.length<=1){let e=t[0];return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextWidth(e):e.str.length*e.size+1}{let e=t[0];if(void 0!==window.PlatformUtils){let i={str:e,font:t[1]?t[1]:"黑体",size:t[2],bold:t[3],italic:t[4]};return window.PlatformUtils.GetTextWidth(i)}return e.length*e.size+1}}GetTextRect(t,e,i,n,s){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextRect(t,e,i,n,s):{width:e.width,height:e.height}}GetTextInfo(t,e,i,n,s){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextInfo(t,e,i,n,s):{start:0,end:t.length,width:e.width,height:e.height}}GetCursorOffset(t,e,i,n,s,r,a){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorOffset(t,e,i,n,s,r,a):0}GetCursorPosition(t,e,i,n,s,r){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorPosition(t,e,i,n,s,r):{x:0,y:0}}BuildTextView(t,e,n,s,r,a,o,l,h,u,c){r.width=isNaN(r.width)?0:r.width,r.height=isNaN(r.height)?0:r.height,a=isNaN(a)?10:a,o=isNaN(o)?0:o;let d=new i.LayoutView;const _=t.GetTextTextureFromStylePack(e,n,!!s,r,a,o,l,h,u,c);if(s&&setTimeout((()=>{s({width:d.Element.clientWidth,height:d.Element.clientHeight})})),null===_)return console.error("Error: Build text texture failed!"),null;d.ResetTexture(new i.TextureSetting(_,null,null,!0)),e.length<10?d.SetId("Text-"+e):d.SetId("Text-Long-"+e.length),d.ResetLayoutParams({x:0,y:0,width:r.width,height:r.height});const f=n.DS.Describe;if("ellipsis"!==f.text_overflow&&("middle"===f.vertical_area_align||"bottom"===f.vertical_area_align)){const t=new tt;t.PutChildTextView(d),d.Element.style.display="table-cell",d.Element.style.position="static",t.Element.style.display="table",t.Element.style.position="static",d=t}return d}}et._sDefaultFont="黑体",et._sDefaultFontSize=30,et._sDefaultFontColor="#FFFFFF",et._sDefaultBackgroundColor="rgba(0, 0, 0, 0)",i.TextUtils=et,i.sTextUtils=new i.TextUtils;class it{constructor(){this._InnerViews={},this._ViewToken=1}add(t){const e=++this._ViewToken;return this._InnerViews[`${e}`]=t,e}remove(t){this._InnerViews[t]&&delete this._InnerViews[t]}get(t){return this._InnerViews[t]}clear(){this._InnerViews={},this._ViewToken=1}}i.ViewStore=it,i.sViewStore=new it;i.ViewInfo=class{constructor(t,e){this.view=t,this.layout_params=e}};let nt=0;i.AnimationBase=class{constructor(){this.IdToken=nt++,this._AttachedGroup=null,this.AnimationListenerObj=null,this._AnimationClose=!1,this._LayoutViewRef=null,this._IsTextureAnim=!1}SetAnimationListener(t){this.AnimationListenerObj=t,this.OnNewListener(t)}AddAnimationListener(t){this.AnimationListenerObj&&t.AddInherit(this.AnimationListenerObj),this.AnimationListenerObj=t,this.OnNewListener(t)}OnNewListener(t){}GetAnimationListener(){return this.AnimationListenerObj}Cancel(t){this._LayoutViewRef&&this._LayoutViewRef.DetachAnimation(this);const e=this.AnimationListenerObj;if(e&&e.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,e.OnAnimationEnd(!1)),this._AttachedGroup){let e=!0;t&&(e=t._AttachedGroup!==this._AttachedGroup),e&&(this._AttachedGroup.CancelFromInternalAnimation(this),this._AttachedGroup=null)}}AttachToGroup(t){null!==this._AttachedGroup&&i.ThrowError("ERROR: In TransformAnimation.AttachToGroup(), animation already attached to other group"),this._AttachedGroup=t}RemoveFromGroup(){this._AttachedGroup=null}AsTextureAnimation(){this._IsTextureAnim=!0}Start(t){this._LayoutViewRef=t}SetCannotDisable(t){}OnStart(){const t=this.AnimationListenerObj;t&&t.OnAnimationStart&&t.OnAnimationStart()}OnEnd(t){this._LayoutViewRef&&!t&&(this._LayoutViewRef.DetachAnimation(this),this._LayoutViewRef=null);const e=this.AnimationListenerObj;e&&e.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,e.OnAnimationEnd(!0))}OnRepeatEvent(){const t=this.AnimationListenerObj;t&&t.OnAnimRepeat&&t.OnAnimRepeat()}OnViewHide(){const t=this.AnimationListenerObj;t&&t.OnViewNoVisible&&t.OnViewNoVisible()}OnFinalProgress(t){const e=this.AnimationListenerObj;e&&e.OnAnimFinal&&e.OnAnimFinal(t)}OnAnimAdvance(t){const e=this.AnimationListenerObj;e&&e.OnAnimAdvance&&e.OnAnimAdvance(t)}};i.AnimationListener=class{constructor(t,e,i){this.OnAnimationStart=t,this._OnAnimationStart=t,this.OnAnimationEnd=e,this._OnAnimationEnd=e,this.OnViewNoVisible=i,this._OnViewNoVisible=i,this.OnAnimFinal=null,this._OnAnimFinal=null,this.OnAnimRepeat=null,this._OnAnimRepeat=null,this._AttachedGroup=null,this._InheritListener=[],this._OnAnimAdvance=null,this.OnAnimAdvance=null}OnStart(t){return this._OnAnimationStart=t,this.OnAnimationStart=t,this}OnEnd(t){return this._OnAnimationEnd=t,this.OnAnimationEnd=t,this}OnAdvance(t){return this._OnAnimAdvance=t,this.OnAnimAdvance=t,this}OnFinalProgress(t){return this._OnAnimFinal=t,this.OnAnimFinal=t,this}OnRepeat(t){return this._OnAnimRepeat=t,this.OnAnimRepeat=t,this}AddInherit(t){if(t){if(0===this._InheritListener.length){const t=this;this.OnAnimationStart=function(){t._OnAnimationStart&&t._OnAnimationStart();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimationStart&&t._InheritListener[e].OnAnimationStart()},this.OnAnimationEnd=function(e){t._OnAnimationEnd&&t._OnAnimationEnd(e);for(let i=0;i<t._InheritListener.length;i++)t._InheritListener[i].OnAnimationEnd&&t._InheritListener[i].OnAnimationEnd(e)},this.OnViewNoVisible=function(){t._OnViewNoVisible&&t._OnViewNoVisible();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnViewNoVisible&&t._InheritListener[e].OnViewNoVisible()},this.OnAnimFinal=function(e){t._OnAnimFinal&&t._OnAnimFinal(e);for(let i=0;i<t._InheritListener.length;i++)t._InheritListener[i].OnAnimFinal&&t._InheritListener[i].OnAnimFinal(e)},this.OnAnimRepeat=function(){t._OnAnimRepeat&&t._OnAnimRepeat();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimRepeat&&t._InheritListener[e].OnAnimRepeat()},this.OnAnimAdvance=function(){t._OnAnimAdvance&&t._OnAnimAdvance();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimAdvance&&t._InheritListener[e].OnAnimAdvance()}}this._InheritListener.push(t)}}};class st{constructor(t){this._SS=t}insertRule(t){window.jsvInAndroidWebView&&(t=(t=t.replace(/@keyframes/,"@-webkit-keyframes")).replace(/transform/g,"-webkit-transform"));const e=this._SS.cssRules.length;this._SS.insertRule(t,e)}removeRule(t){this.removeMultiRules([t])}hasRule(t){const e=this._SS.cssRules;for(let i=e.length-1;i>=0;i--)if(e[i].name===t)return!0;return!1}removeMultiRules(t){const e=this._SS,i=this._SS.cssRules;for(let n=i.length-1;n>=0;n--)for(const s in t)if(i[n].name===t[s]){t.splice(s,1),e.deleteRule(n);break}}}let rt=null;function at(){return null===rt&&(rt=function(t){let e=null;const i=document.styleSheets;if(!i||0===i.length)return console.error("Error: styleSheet empty"),null;if(t){for(let n=0;n<i.length;++n){const s=i[n];if(s.cssRules[0]&&s.cssRules[0].name&&s.cssRules[0].name===t){e=s;break}}if(null===e)return console.error(`Error: no found tag=${t}`),null}else e=i[0];return new st(e)}()),rt}function ot(t){let e="linear";if(t&&void 0!==t.T)switch(t.T){case i.EasingTypeIn:e="ease-in";break;case i.EasingTypeOut:e="ease-out";break;case i.EasingTypeInOut:e="ease-in-out";break;case i.EasingTypeBezier:e=`cubic-bezier(${t.St.X1},${t.St.Y1},${t.St.X2},${t.St.Y2})`;break;case i.EasingTypeSteps:e=`steps(${t.St.S},${0===t.St.T?"start":"end"})`;case i.EasingTypeBlink:case i.EasingTypeDeceleration:}return e}function lt(t,e){const i=-1===t.repeatTimes?"infinite":t.repeatTimes;let n="linear";t.easing&&(n=ot(t.easing));return`${e} ${t.duration/1e3}s ${n} ${t.delayedTime/1e3}s ${i}`}const ht=t=>t>=65&&t<=90||t>=97&&t<=122,ut=t=>t>=48&&t<=57,ct=t=>{if(!t)return null;let e="",i="",n=[],s=0;for(let r=0;r<t.length;r++){const a=t.charCodeAt(r);if(0===s?(ht(a)||ut(a))&&(e+=t[r]):(ut(a)||46===a||45===a||101===a)&&(i+=t[r]),40===a)s=1,i="",n=[];else{if(41===a)return n.push(parseFloat(i)),{name:e,params:n};44===a&&(n.push(parseFloat(i)),i="")}}return console.error("transform error",t),null};function dt(t){const e=t.Element.children;let i=null;for(let t=0;t<e.length;t++)if("_AnimateProgressTracer"===e[t].id){i=e[t];break}return null===i&&(i=window.originDocument.createElement("div"),i.id="_AnimateProgressTracer",t.Element.appendChild(i)),i}let _t=0;class ft{constructor(t){this._TracerDiv=dt(t),this._IdToken=_t++,this._KeyFrameName=null,this._AdvanceTimer=null,this._AdvanceListener=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=t=>{t.stopPropagation()},this._TracerDiv.addEventListener("animationend",this._OnEndListener)}_ClearAdvanceTimer(){null!==this._AdvanceTimer&&(clearInterval(this._AdvanceTimer),this._AdvanceTimer=null)}_NotifyAdvance(){this._ClearAdvanceTimer(),null!==this._AdvanceListener&&(this._AdvanceTimer=setInterval((()=>{const t=this.GetProgress();this._AdvanceListener(t),1===t&&this._ClearAdvanceTimer()}),100))}Start(t,e,i){this._AdvanceListener=i,this._KeyFrameName&&console.error("Error: Asset!! should Stop before start"),this._TracerDiv._ForgeProgressToken=(this._TracerDiv._ForgeProgressToken+1)%2,this._KeyFrameName=this._BuildTraceKeyFrame(e,this._IdToken,this._TracerDiv._ForgeProgressToken),this._TracerDiv.style.animation=lt(t,this._KeyFrameName),this._TracerDiv.addEventListener("animationend",this._OnEndListener),this._NotifyAdvance()}Stop(){const t=this.GetProgress();return this._TracerDiv.style.animation=null,this._KeyFrameName&&(this._RemoveTraceKeyFrame(this._KeyFrameName),this._KeyFrameName=null),this._AdvanceListener&&(this._ClearAdvanceTimer(),this._AdvanceListener(t),this._AdvanceListener=null),t}GetProgress(){const t=window.getComputedStyle(this._TracerDiv);if(0===t.transform.length);else if(t.transform.length>0&&"none"!==t.transform){const e=ct(t.transform);return null!==e?e.params[4]/1e3:(console.error("Error:internal error"),0)}return 1}_BuildTraceKeyFrame(t,e,i){const n=`_AnimateProgress_${e}_${i}`,s=at(),r=`@keyframes ${n}\n {0%{transform:translate3d(${Math.floor(1e3*t)}px,0,0)}\n 100%{transform:translate3d(1000px,0,0)}}`;return s.insertRule(r),n}_RemoveTraceKeyFrame(t){at().removeRule(t)}}class gt{constructor(t,e){this._TracerDiv=dt(t),this._IdToken=_t++,this._KeyFrameNameArray=null,this._StepsTotal=e,this._RunAnimList=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=t=>{t.stopPropagation()},this._TracerDiv.addEventListener("animationend",this._OnEndListener)}Start(t){this._KeyFrameName&&console.error("Error: Asset!! should Stop before start"),this._TracerDiv._ForgeProgressToken=(this._TracerDiv._ForgeProgressToken+1)%2,this._BuildTraceKeyFrameGroup(this._IdToken,this._TracerDiv._ForgeProgressToken),this._RunAnimList=this._ConvertToAnimationStyle(t),this._TracerDiv.style.animation=this._RunAnimList[0]}TriggerNextStep(t){this._TracerDiv.style.animation=this._RunAnimList[t]}Stop(){const t=this.GetProgress();return this._TracerDiv.style.animation=null,null!==this._KeyFrameNameArray&&(this._RemoveTraceKeyFrameGroup(),this._KeyFrameNameArray=null),t}GetProgress(){const t=window.getComputedStyle(this._TracerDiv);if(0===t.transform.length);else if("none"!==t.transform){const e=ct(t.transform);if(null!==e){return e.params[4]/(100*this._StepsTotal)}return console.error("Error:internal error"),0}return 1}_BuildTraceKeyFrameGroup(t,e){this._KeyFrameNameArray=new Array(this._StepsTotal);const i=at();for(let n=0;n<this._KeyFrameNameArray.length;n++){const s=`_AnimateGroupProgress_${t}_${e}_Cnt_${n===this._KeyFrameNameArray.length-1?"finalStep":`${n}`}`,r=`@keyframes ${s}\n {0%{transform:translate3d(${100*n}px,0,0)}\n 100%{transform:translate3d(${100+100*n}px,0,0)}}`;i.insertRule(r),this._KeyFrameNameArray[n]=s}}_RemoveTraceKeyFrameGroup(){const t=at();this._KeyFrameNameArray.forEach((e=>{t.removeRule(e)}))}_ConvertToAnimationStyle(t){const e=[];for(let i=0;i<t.length;i++){let n="linear";const s=t[i];s.easing&&(n=ot(s.easing)),e.push(`${this._KeyFrameNameArray[i]} ${s.duration/1e3}s ${n}`)}return e}}let mt=0;i.AnimationDelegate=class extends i.AnimationBase{constructor(t,e,i){super();let n=null;i&&(n=i.Package()),this.typeName=t,this.duration=e,this.easing=n,this.repeatTimes=1,this.delayedTime=0,this.enableFlags=-1,this.enableStartPos=0,this._Progress=null}EnableDelay(t){return this.delayedTime=t,this}SetStartPos(t){this.enableStartPos=t}EnableInfinite(){return this.repeatTimes=-1,this}SetRepeat(t){return this.repeatTimes=t,this}Enable(t){return this._EnableFlagsInner(t),this}OnNewListener(t){let e=0;t.OnAnimFinal&&(e|=i.AnimationEnable.AckFinalProgress),t.OnAnimRepeat&&(e|=i.AnimationEnable.AckRepeat),0!==e&&this._EnableFlagsInner(e)}_EnableFlagsInner(t){-1!==this.enableFlags?this.enableFlags|=t:this.enableFlags=t}_GetCSSKeyframesRule(t){let e=null;const i=document.styleSheets;for(let n=0;n<i.length;++n)if(i[n]&&i[n].cssRules){for(const s in i[n].cssRules)if(i[n].cssRules[s].name===t){e=i[n].cssRules[s];break}if(e)break}return e}CheckCssAnimationFormat(t){const e=this._GetCSSKeyframesRule(t);if(e&&e.cssRules)for(const i in e.cssRules){if(!e.cssRules[i]||!e.cssRules[i].style)continue;if(!e.cssRules[i].style.opacity&&!e.cssRules[i].style.transform)continue;const n=e.cssRules[i].style.transform;n&&(-1!==n.indexOf("rotate(")?console.error(`@keyframe ${t}, only support rotate3d, current transform:${n}`):-1!==n.indexOf("translate(")?console.error(`@keyframe ${t}, only support translate3d, current transform:${n}`):-1!==n.indexOf("scale(")&&console.error(`@keyframe ${t}, only support scale3d, current transform:${n}`))}}},i.KeyFrameAnimation=class extends i.AnimationDelegate{constructor(t,e,i){super(t,e,i),this._KeyFrameNameToRecycle=null,this._TestRepeat=this._TestRepeat.bind(this),this._LatestProgressValue=0;const n=this;this._OnEndEvent=t=>{t.stopPropagation(),n._PerformAnimationEnd(!0)},this._CurrentEndEventFunc=null}Start(t){super.Start(t),t.ResetCssTransform(null,null),t.Element&&(t.Element.style.pointerEvents="auto"),this.enableStartPos>0?this._EnableStarterAnimation():this._EnableCssAnimation(this._BuildKeyFrame(),this._OnEndEvent,0)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableStarterAnimation(){let t=this._OnEndEvent;if(1!==this.repeatTimes){const e=this;t=t=>{t.stopPropagation(),null!==e._Progress&&e._Progress.Stop(),e.delayedTime=0,e.repeatTimes>0&&(e.repeatTimes-=1),this.OnRepeatEvent(),e._EnableCssAnimation(e._BuildKeyFrame(),e._OnEndEvent,0)}}const e=this.repeatTimes,i=this.duration;this.repeatTimes=1,this.duration*=1-this.enableStartPos,this._EnableCssAnimation(this._BuildStarterKeyFrame(),t,this.enableStartPos),this.repeatTimes=e,this.duration=i}_EnableCssAnimation(t,e,n){if(null===t)return;null!==t.keyFrameString&&(at().insertRule(t.keyFrameString),this._KeyFrameNameToRecycle=t.name);const s=t.name;this.CheckCssAnimationFormat(s);const r=this._LayoutViewRef.Element;0==(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&i.AnimationEnable.KeepTransform)&&0==(this.enableFlags&i.AnimationEnable.AckRepeat)||(this._Progress=new ft(this._LayoutViewRef),this._Progress.Start(this,n,(t=>{this.OnAnimAdvance(t)})),0!=(this.enableFlags&i.AnimationEnable.AckRepeat)&&(this._LatestProgressValue=0,i.sRenderBridge.RegisterPerFrameCallback(this._TestRepeat)));const a=lt(this,s);window.jsvInAndroidWebView?(r.style.webkitAnimation=a,r.addEventListener("webkitAnimationEnd",e)):(r.style.animation=a,r.addEventListener("animationend",e)),this._CurrentEndEventFunc=e}_PerformAnimationEnd(t){if(null!==this._CurrentEndEventFunc){const t=this._LayoutViewRef.Element,e=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?t.removeEventListener("webkitAnimationEnd",e):t.removeEventListener("animationend",e)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(t&&this.OnEnd());0!=(this.enableFlags&i.AnimationEnable.AckRepeat)&&i.sRenderBridge.UnregisterPerFrameCallback(this._TestRepeat);let e=this._Progress.Stop();if(t&&(e=1),0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(e);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),0!=(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(e)}),0),null!==this._KeyFrameNameToRecycle&&(at().removeRule(this._KeyFrameNameToRecycle),this._KeyFrameNameToRecycle=null)}_TestRepeat(){const t=this._Progress.GetProgress();this._LatestProgressValue>t&&this.OnRepeatEvent(),this._LatestProgressValue=t}_BuildStarterKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_BuildKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}},i.TranslateAnimation=class extends i.KeyFrameAnimation{constructor(t,e,i,n,s,r){super("TL",s,r),this.startX=t,this.startY=i,this.endX=e,this.endY=n}_BuildStarterKeyFrame(){if(this.enableStartPos>0){const t=(this.endX-this.startX)*this.enableStartPos+this.startX,e=(this.endY-this.startY)*this.enableStartPos+this.startY,i="_ForgeAnim_TL_"+mt++;return{name:i,keyFrameString:`@keyframes ${i} {0%{transform:translate3d(${t}px,${e}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}console.error("Error: no enabled starter position")}_BuildKeyFrame(){const t="_ForgeAnim_TL_"+mt++;return{name:t,keyFrameString:`@keyframes ${t} {0%{transform:translate3d(${this.startX}px,${this.startY}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}_GetFrozenTransform(t){return{transform:`translate3d(${Math.floor((this.endX-this.startX)*t+this.startX)}px,${Math.floor((this.endY-this.startY)*t+this.startY)}px,0)`,transformOrigin:null}}},i.FuncAnimation=class extends i.AnimationDelegate{constructor(t,e,i){super("FC2",e,i),this.formula=t,console.warn("NO implemented")}},i.RotateAnimation=class extends i.AnimationDelegate{constructor(t,e,n,s,r,a){super("RO",r,a),n instanceof i.Vec3||(n=new i.Vec3(n)),s instanceof i.Vec3||(s=new i.Vec3(s)),this.startAngle=t,this.offsetAngle=e,this.anchorVec3=n,this.axisVec3=s,console.warn("NO implemented")}},i.BasicScaleAnimation=class extends i.AnimationDelegate{constructor(t,e,i,n,s,r,a,o,l,h){super("SC",a,o),console.warn("NO implemented")}},i.ScaleAnimation=class extends i.BasicScaleAnimation{constructor(t,e,i,n,s,r){const a=200;super(t*a,t*a,e*a,e*a,i,n,s,r,200,200)}},i.OpacityAnimation=class extends i.AnimationDelegate{constructor(t,e,i,n){super("OP",i,n),console.warn("NO implemented")}},i.CssKeyframeAnimation=class extends i.KeyFrameAnimation{constructor(t,e,i,n,s){super("CK",e,i),this._keyFramesSet=t}_BuildKeyFrame(){const t=this._keyFramesSet;if(t.indexOf("@keyframes")<0&&t.indexOf("@-webkit-keyframes")<0)return console.warn("Warning:keyframes array empty"),null;let e=t.split(" ")[1];return e.indexOf("{")>=0&&(e=e.substr(0,e.indexOf("{"))),{name:e,keyFrameString:null}}_GetLastKeyframeTransform(t){let e=t.indexOf("to");if(e<0&&(e=t.indexOf("100%")),e<0)return"";{let i=t.indexOf("transform:",e);return i<0?"":t.substring(i+10,t.indexOf(";",i))}}_GetFrozenTransform(t){let e={transform:"",transformOrigin:null};return 1===t?e={transform:this._GetLastKeyframeTransform(this._keyFramesSet),transformOrigin:null}:console.warn("CssKeyframeAnimation can not get transform whill progress is not 1"),e}},i.CssTransitionAnimation=class extends i.AnimationDelegate{constructor(t){super("CT",null,null),this._transArray=t}Start(t){super.Start(t);const e=this,i=this._transArray,n={};if(0===i.length)return void console.warn("Warning:transition empty");let s="";for(let t=0;t<i.length;t++){let e="linear";const r=i[t];r.tf&&(e=ot(r.tf)),s=`${r.name} ${r.dur/1e3}s ${e} ${r.dly/1e3}s`,n[r.name]=s}t.ApplyStyleTransition(n),s&&(t.Element.addEventListener("transitionend",(t=>{t.stopPropagation(),e.OnEnd(!0)})),t.Element.addEventListener("webkitTransitionEnd",(t=>{t.stopPropagation(),e.OnEnd(!0)})))}},i.KeyFrameGroupAnimation=class extends i.AnimationDelegate{constructor(t){super(t,0,null),this._KeyFrameArray=null,this._LatestProgressValue=0,this._CurrentEndEventFunc=null,this._Progress=null,this._AnimRunList=null,this._AnimationRunIndex=0;const e=this;this._OnEndEvent=t=>{t.stopPropagation(),this._TestFinalKeyFrame(t)?e._PerformAnimationEnd(!0):(this._AnimationRunIndex++,this._LayoutViewRef.Element.style.animation=this._AnimRunList[this._AnimationRunIndex],this._Progress.TriggerNextStep(this._AnimationRunIndex),e._OnSubKeyFrameDone(t))}}Start(t){super.Start(t),t.ResetCssTransform(null,null),t.Element&&(t.Element.style.pointerEvents="auto"),this._EnableCssAnimation(this._BuildKeyFrameGroup(),this._OnEndEvent)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableCssAnimation(t,e){if(null===t)return;this._KeyFrameArray=new Array(t.length);const n=at();for(let e=0;e<t.length;e++){const i=t[e];this.CheckCssAnimationFormat(i.name),this._KeyFrameArray[e]={name:i.name,easing:i.ease.Package(),duration:i.duration,needRecycle:!1},null!==i.keyFrameString&&(n.insertRule(i.keyFrameString),this._KeyFrameArray.needRecycle=!0)}const s=this._LayoutViewRef.Element;0==(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&i.AnimationEnable.KeepTransform)||(this._Progress=new gt(this._LayoutViewRef,this._KeyFrameArray.length),this._Progress.Start(this._KeyFrameArray)),this._AnimRunList=this._ConvertToAnimationStyle(this._KeyFrameArray),this._AnimationRunIndex=0,window.jsvInAndroidWebView?(s.style.webkitAnimation=this._AnimRunList[0],s.addEventListener("webkitAnimationEnd",e)):(s.style.animation=this._AnimRunList[0],s.addEventListener("animationend",e)),this._CurrentEndEventFunc=e}_PerformAnimationEnd(t){if(null!==this._CurrentEndEventFunc){const t=this._LayoutViewRef.Element,e=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?t.removeEventListener("webkitAnimationEnd",e):t.removeEventListener("animationend",e)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(t&&this.OnEnd());let e=this._Progress.Stop();if(t&&(e=1),0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(e);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),0!=(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(e)}),0);const n=at();for(const t of this._KeyFrameArray)t.needRecycle&&n.removeRule(t.name);this._KeyFrameArray=null}_ConvertToAnimationStyle(t){const e=[];for(let i=0;i<t.length;i++){let n="linear";const s=t[i];s.easing&&(n=ot(s.easing)),e.push(`${s.name} ${s.duration/1e3}s ${n}`)}return e}_BuildKeyFrameGroup(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_TestFinalKeyFrame(t){console.warn("Warning:Should override")}_OnSubKeyFrameDone(t){console.warn("Warning:Should override")}},i.TranslateFrameAnimation=class extends i.TranslateAnimation{constructor(t,e,i,n,s,r){let a=s,o=r,l=s,h=r;n?(a=t,l=e):(o=t,h=e);super(a,l,o,h,Math.abs(Math.floor((e-t)/i*1e3)),null)}},i.ThrowAnimation=class extends i.KeyFrameGroupAnimation{constructor(t,e,i,n,s,r,a,o){super("Thr"),this._FromX=t,this._FromY=e,this._XorY=i,this._InitV=n,this._Acc=s,this._To=r,this._HasPole=a,this._PoleCallback=null,this._PolePosition=o,this._IsPositiveMove=this._InitV>0||0===this._InitV&&this._Acc>0}SetPoleCallback(t){this._PoleCallback=t}_MakeTranslateString(t,e,i){return`@keyframes ${t} {0%{transform:translate3d(${e.x.value}px,${e.y.value}px,0);}100%{transform:translate3d(${i.x.value}px,${i.y.value}px,0);}}`}_BuildKeyFrameGroup(){const t=""+mt++,e=[],n={x:{value:this._FromX},y:{value:this._FromY}},s={x:{value:this._FromX},y:{value:this._FromY}},r=0===this._XorY?n.x:n.y,a=0===this._XorY?s.x:s.y;if(this._HasPole){let o=`_ForgeAnim_Thr_Forw_${t}`;a.value=this._PolePosition;let l=this._MakeTranslateString(o,n,s);e.push({name:o,keyFrameString:l,ease:i.Easing.Circular.Out,duration:Math.floor(-this._InitV/this._Acc*1e3)}),o=`_ForgeAnim_Thr_Backw_${t}`,r.value=this._PolePosition,a.value=this._To,l=this._MakeTranslateString(o,n,s),e.push({name:o,keyFrameString:l,ease:i.Easing.Circular.In,duration:Math.floor(1e3*Math.sqrt(2*(this._To-this._PolePosition)/this._Acc))})}else{const o=`_ForgeAnim_Thr_Forw_${t}`;a.value=this._To;const l=this._MakeTranslateString(o,n,s),h=this._IsPositiveMove?this._InitV:-this._InitV,u=this._IsPositiveMove?this._Acc:-this._Acc,c=this._IsPositiveMove?a.value-r.value:r.value-a.value;e.push({name:o,keyFrameString:l,ease:u>0?i.Easing.Circular.In:i.Easing.Circular.Out,duration:Math.floor((Math.sqrt(h*h+2*u*c)-h)/u*1e3)})}return e}_GetFrozenTransform(t){const e={x:{value:this._FromX},y:{value:this._FromY}};let i=0===this._XorY?e.x.value:e.y.value;const n=0===this._XorY?e.x:e.y;let s=0;i=this._IsPositiveMove?i:-i;const r=this._IsPositiveMove?this._To:-this._To,a=this._IsPositiveMove?this._PolePosition:-this._PolePosition;if(this._HasPole){const e=(2*a-i-r)*t;s=e>a-i?a-(e-(a-i)):i+e}else s=i+(r-i)*t;n.value=Math.floor(this._IsPositiveMove?s:-s);return{transform:`translate3d(${e.x.value}px,${e.y.value}px,0)`,transformOrigin:null}}_TestFinalKeyFrame(t){return this._HasPole?t.animationName.indexOf("_ForgeAnim_Thr_Backw_")>=0:t.animationName.indexOf("_ForgeAnim_Thr_Forw_")>=0}_OnSubKeyFrameDone(t){this._HasPole&&this._PoleCallback&&this._PoleCallback()}},i.AnimationEnable={ReleaseAfterEndCallback:1,KeepTransform:2,AckFinalProgress:4,AckRepeat:8};let pt=0;class wt extends i.AnimationDelegate{constructor(t,e){super(t,e,null),this._StepsCount=1,this._Running=!1,this._NextStepIndex=0;const i=this;this._OnStepEnd=()=>{i._NextStep()}}SetStepsCount(t){this._StepsCount=t,this._SplitSteps()}Start(t){super.Start(t),window.jsvInAndroidWebView?this._LayoutViewRef.Element.addEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.addEventListener("animationend",this._OnStepEnd),this._Running=!0,this._NextStep()}Cancel(){this._Running=!1}_NextStep(){null!==this._KeyFrameName&&(at().removeRule(this._KeyFrameName),this._KeyFrameName=null);const t=this._NextStepIndex===this._StepsCount;if(!this._Running||t)return void this._PerformAnimationEnd(t);const e=this._CreateOneStepKeyFrame(this._NextStepIndex);this._KeyFrameName=e.name,at().insertRule(e.keyFrameString);const i=lt({repeatTimes:this.repeatTimes,easing:this.easing,delayedTime:0,duration:this.duration/this._StepsCount},this._KeyFrameName),n=this._LayoutViewRef.Element;window.jsvInAndroidWebView?n.style.webkitAnimation=i:n.style.animation=i,this._NextStepIndex++}_PerformAnimationEnd(t){window.jsvInAndroidWebView?this._LayoutViewRef.Element.removeEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.removeEventListener("animationend",this._OnStepEnd);const e=this._NextStepIndex/this._StepsCount;if(0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(this._NextStepIndex-1);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),window.setTimeout((()=>{this.OnFinalProgress(e)}),0)}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_SplitSteps(){console.warn("Warning: should be override by child class")}_CreateOneStepKeyFrame(t){console.warn("Warning: should be override by child class")}}i.TranslateStepAnimation=class extends wt{constructor(t,e,i,n,s){super("TL-S",s),this.startX=t,this.startY=i,this.endX=e,this.endY=n,this._StepsArray=null}_SplitSteps(){const t=this._StepsCount,e=(this.endX-this.startX)/t,i=(this.endY-this.startY)/t;this._StepsArray=new Array(t);let n=this.startX,s=this.startY;for(let r=0;r<t-1;r++)n+=e,s+=i,this._StepsArray[r]={targetX:Math.floor(n),targetY:Math.floor(s)};this._StepsArray[t-1]={targetX:this.endX,targetY:this.endY}}_CreateOneStepKeyFrame(t){let e=0,i=0;0===t?(e=this.startX,i=this.startY):(e=this._StepsArray[t-1].targetX,i=this._StepsArray[t-1].targetY);const n=this._StepsArray[t].targetX,s=this._StepsArray[t].targetY,r="_ForgeStepAnim_TL_"+pt++;return{name:r,keyFrameString:`@keyframes ${r} {\n 0%{transform:translate3d(${e}px,${i}px,0);}\n 100%{transform:translate3d(${n}px,${s}px,0);}}`}}_GetFrozenTransform(t){return{transform:`translate3d(${this._StepsArray[t].targetX}px,${this._StepsArray[t].targetY}px,0)`,transformOrigin:null}}};i.RenderBridge=class{constructor(){this._ScreenInfo={width:160,height:90,x:2/160,y:2/90,perspective:2/160,scaleRatio:1,designedWidth:1280},this._FrameLoopFunc=null,this._CallbacksPerFrame=new Set,this._WillSwapCallbacks=new Map,this._DoWillSwapCallback=this._OnWillSwap.bind(this)}BeginHtmlFrameLoop(){null===this._FrameLoopFunc&&window.requestAnimationFrame&&(this._FrameLoopFunc=this._OnAnimation.bind(this),window.requestAnimationFrame(this._FrameLoopFunc))}_OnAnimation(){let t=!1;if(i.sViewSensorManager.HtmlHasActiveSensor()&&(i.sViewSensorManager.HtmlDoWorkOnFrame(),i.sViewSensorManager.HtmlHasActiveSensor()&&(t=!0)),this._CallbacksPerFrame.size>0){for(const t of this._CallbacksPerFrame)t();this._CallbacksPerFrame.size>0&&(t=!0)}t?window.requestAnimationFrame(this._FrameLoopFunc):this._FrameLoopFunc=null}GetScreenInfo(){return this._ScreenInfo}InitScreenBuffer(t,e){isNaN(t)&&(t=1),isNaN(e)&&(e=1280);const i=e*t,n=i/16*9;this._ScreenInfo.width=Math.floor(i),this._ScreenInfo.height=Math.floor(n),this._ScreenInfo.x=2/this._ScreenInfo.width,this._ScreenInfo.y=2/this._ScreenInfo.height,this._ScreenInfo.perspective=this._ScreenInfo.x,this._ScreenInfo.scaleRatio=t,this._ScreenInfo.designedWidth=e}RequestSwap(){this._OnRequesting||(this._OnRequesting=!0,Promise.resolve().then(this._DoRequestSwap.bind(this)))}SetGlobalConfig(t){}AddWillSwapListener(t,e){this._WillSwapCallbacks.set(t,e)}_DoRequestSwap(){this._WillSwapCallbacks.size>0&&this._WillSwapCallbacks.forEach(this._DoWillSwapCallback),this._OnRequesting=!1}InstantPerformSwap(){this._OnRequesting&&(this._OnRequesting=!1,this._DoRequestSwap(!1))}_OnWillSwap(t){t()}RegisterPerFrameCallback(t){this._CallbacksPerFrame.add(t)}UnregisterPerFrameCallback(t){this._CallbacksPerFrame.delete(t)}},i.sRenderBridge=new i.RenderBridge;class bt{constructor(t,e,i){this._TextureManager=t,this._GL=e,this._Loaded=!1,this._OnLoad=i,this.TextureId=null,this._TextureSource=null}_setGLTexture(){this.TextureId=this._GL.createTexture(),this._GL.activeTexture(this._GL.TEXTURE0),this._GL.bindTexture(this._GL.TEXTURE_2D,this.TextureId),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_WRAP_S,this._GL.CLAMP_TO_EDGE),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_WRAP_T,this._GL.CLAMP_TO_EDGE),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_MIN_FILTER,this._GL.NEAREST),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_MAG_FILTER,this._GL.LINEAR),this._GL.texImage2D(this._GL.TEXTURE_2D,0,this._GL.RGBA,this._GL.RGBA,this._GL.UNSIGNED_BYTE,this._TextureSource)}loaded(){return this._Loaded}recycle(){this._TextureManager.recycle(this._TextureSource)}}bt.IMAGE=Symbol("Texture.IMAGE"),bt.COLOR=Symbol("Texture.COLOR");class Tt extends bt{constructor(t,e,i,n){if(super(t,e,i),n){const t=n.trim();if(0===t.indexOf("http"))this.Url=t;else if(0===t.indexOf("url")){const e=t.indexOf("("),i=t.indexOf(")");this.Url=t.substring(e+1,i)}else this.Url=n;this._TextureSource=new Image,this._TextureSource.onload=()=>{this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()},this._TextureSource.src=this.Url}}}class St{constructor(){this._Canvas=window.originDocument.createElement("canvas"),this._Canvas.setAttribute("width","1px"),this._Canvas.setAttribute("height","1px"),this._Canvas.setAttribute("style","position: absolute; pointer-events: none;"),document.body.appendChild(this._Canvas),this._GL=this._Canvas.getContext("2d")}getColorImageData(t,e,i,n){const s=this._GL.createImageData(1,1);return s.data[0]=t,s.data[1]=e,s.data[2]=i,s.data[3]=n,s}}let yt=null;class xt extends bt{constructor(t,e,i,n){super(t,e,i),null===yt&&(yt=new St),this.Color=n;const s=(t=>{if(!t)return null;if(0===(t=t.trim()).indexOf("rgba")){const e=t.indexOf("("),i=t.indexOf(")");return t.substr(e+1,i-e-1).split(",").map(((t,e)=>3===e?Math.ceil(255*parseFloat(t)):parseInt(t,10)))}if(0===t.indexOf("#")){let e=t.substr(1);const i=e.length;if(6===i||8===i){6===i&&(e+="FF");const t=parseInt(`0x${e}`,10);return[t>>24&255,t>>16&255,t>>8&255,255&t]}return null}return null})(this.Color);this._TextureSource=yt.getColorImageData(...s),this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()}}const Et=new class{constructor(){this._TextureMap={}}getTexture(t,e,i,n){let s;if(this._TextureMap[n])s=this._TextureMap[n].texture,this._TextureMap[n].useCount++;else{switch(t){case bt.IMAGE:s=new Tt(this,e,i,n);break;case bt.COLOR:s=new xt(this,e,i,n);break;default:console.log(`getTexture type is error:${t}`)}this._TextureMap[n]={texture:s,useCount:1}}return s}recycle(t){this._TextureMap[t]&&(this._TextureMap[t].useCount--,this._TextureMap[t].useCount<0&&delete this._TextureMap[t])}},vt=(t,e)=>Math.random()*(e-t)+t;class Lt{constructor(t,e,i,n,s){this._ViewId=t,this._Type=e.type,this._ParticleNum=e.particleNum,this._DeltaAngle=e.deltaAngle/180*Math.PI,this._DeltaWidthFact=e.deltaWidth/n.width,this._DeltaHeightFact=e.deltaHeight/n.height,this._PointSizeMin=e.pointSizeMin,this._PointSizeMax=e.pointSizeMax,this._SpeedMin=e.speedMin,this._SpeedMax=e.speedMax,this._LifeMin=e.lifeMin/1e3,this._LifeMax=e.lifeMax/1e3,this._AddNumSpeed=e.addNumSpeed,this._AcceletateX=e.accelerateX,this._AcceletateY=e.accelerateY,this._EnableFade=e.enableFade,this._EnableShrink=e.enableShrink,this._Texture=i,this._Buffer=new Float32Array(7*this._ParticleNum),this._AddedParticleNum=0,this._Element=s,this._StartTime=-1,this._LastFrameTime=-1,this._Stopped=!1,this._getTransform=this._getTransform.bind(this)}_getTransform(){let t=this._Element.jsvMainView.Element;const e=Ct(t.style.width),i=Ct(t.style.height);let n=new window.WebKitCSSMatrix;for(;t.parentElement;){const e=getComputedStyle(t);if(e.transform){const i=e.transformOrigin?e.transformOrigin:e.webkitTransformOrigin;if(i){const s=Ct(i),r=new window.WebKitCSSMatrix(`translate(-${s[0]}px,-${s[1]}px)`),a=new window.WebKitCSSMatrix(`translate(${s[0]}px,${s[1]}px)`),o=new window.WebKitCSSMatrix(`translate(${t.offsetLeft}px,${t.offsetTop}px)`),l=new window.WebKitCSSMatrix(e.transform);n=o.multiply(a.multiply(l.multiply(r.multiply(n))))}else n=new window.WebKitCSSMatrix(e.transform).multiply(n)}t=t.parentElement}const s=new window.WebKitCSSMatrix;s.m11=0,s.m12=0,s.m14=1,s.m21=e,s.m22=0,s.m24=1,s.m31=0,s.m32=i,s.m34=1,s.m41=e,s.m42=i,s.m44=1,n=n.multiply(s);return[n.m11,n.m12,n.m21,n.m22,n.m31,n.m32,n.m41,n.m42]}_updateParticleInfo(t,e,i,n,s,r){const a=vt(0,2*this._DeltaWidthFact),o=vt(0,2*this._DeltaHeightFact);this._Buffer[7*t]=a*i[0]+o*n[0]+e[0],this._Buffer[7*t+1]=a*i[1]+o*n[1]+e[1],this._Buffer[7*t+2]=s+vt(-this._DeltaAngle,this._DeltaAngle),this._Buffer[7*t+3]=vt(this._SpeedMin,this._SpeedMax),this._Buffer[7*t+4]=r,this._Buffer[7*t+5]=vt(this._LifeMin,this._LifeMax),this._Buffer[7*t+6]=vt(this._PointSizeMin,this._PointSizeMax)}onDrawFrame(t,e,i){if(!this._Texture.loaded()||this._Stopped)return;this._StartTime<0&&(this._StartTime=Date.now()),this._LastFrameTime<0&&(this._LastFrameTime=this._StartTime);const n=this._getTransform();for(let t=0;t<n.length;t++)n[t]=t%2==0?2*n[t]/window.innerWidth-1:1-2*n[t]/window.innerHeight;const s=(Date.now()-this._StartTime)/1e3,r=[n[0],n[1]],a=[n[2]-n[0],n[3]-n[1]],o=[n[4]-n[0],n[5]-n[1]],l=Math.sqrt(a[0]*a[0]+a[1]*a[1]),h=-a[1]/l,u=a[0]/l>0?Math.acos(h):2*Math.PI-Math.acos(h);if(0===this._Type)if(this._AddedParticleNum<this._ParticleNum){for(let t=0;t<this._ParticleNum;t++)this._updateParticleInfo(t,r,a,o,u,s);this._AddedParticleNum=this._ParticleNum}else{let t=!0;for(let e=0;e<this._ParticleNum;e++)if(this._Buffer[7*e+4]+this._Buffer[7*e+5]>s){t=!1;break}t&&(this._Stopped=!0)}else if(this._AddedParticleNum<this._ParticleNum){let t=Math.round((Date.now()-this._LastFrameTime)*this._AddNumSpeed);this._AddedParticleNum+t>this._ParticleNum&&(t=this._ParticleNum-this._AddedParticleNum);for(let e=0;e<t;e++)this._updateParticleInfo(this._AddedParticleNum+e,r,a,o,u,s);this._AddedParticleNum+=t}else for(let t=0;t<this._ParticleNum;t++)this._Buffer[7*t+4]+this._Buffer[7*t+5]<s&&this._updateParticleInfo(t,r,a,o,u,s);const c=t.getUniformLocation(e,"uTime");t.uniform1f(c,s);const d=t.getUniformLocation(e,"uAccelerate");t.uniform2f(d,this._AcceletateX,this._AcceletateY);const _=t.getUniformLocation(e,"uEnableFade");t.uniform1i(_,this._EnableFade?1:0);const f=t.getUniformLocation(e,"uEnableShrink");t.uniform1i(f,this._EnableShrink?1:0),t.bindBuffer(t.ARRAY_BUFFER,i),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this._Texture.TextureId),t.bufferSubData(t.ARRAY_BUFFER,0,this._Buffer);const g=this._Buffer.BYTES_PER_ELEMENT,m=t.getAttribLocation(e,"aPosition");t.vertexAttribPointer(m,2,t.FLOAT,!1,7*g,0),t.enableVertexAttribArray(m);const p=t.getAttribLocation(e,"aSpeed");t.vertexAttribPointer(p,2,t.FLOAT,!1,7*g,2*g),t.enableVertexAttribArray(p);const w=t.getAttribLocation(e,"aLife");t.vertexAttribPointer(w,2,t.FLOAT,!1,7*g,4*g),t.enableVertexAttribArray(w);const b=t.getAttribLocation(e,"aPointSize");t.vertexAttribPointer(b,1,t.FLOAT,!1,7*g,6*g),t.enableVertexAttribArray(b),t.drawArrays(t.POINTS,0,this._AddedParticleNum)}recycle(){this._Buffer=null,this._Texture.recycle(),this._Stopped=!0}}let It=0;i.sParticleManager=new class{constructor(){this._Inited=!1,this._Canvas=null,this._GL=null,this._GLProgram=null,this._VBO=null,this._ParticleViewMap={},this._LoopStarted=!1,this._onDrawFrame=this._onDrawFrame.bind(this)}_initCanvas(){if(this._Canvas=window.originDocument.createElement("canvas"),this._Canvas.setAttribute("width",`${window.innerWidth}px`),this._Canvas.setAttribute("height",`${window.innerHeight}px`),this._Canvas.setAttribute("style","position: absolute; pointer-events: none;"),document.body.appendChild(this._Canvas),this._GL=this._Canvas.getContext("webgl"),!this._GL)return void console.error("init webgl failed");console.log("webgl info: ",this._GL.getParameter(this._GL.VERSION),this._GL.getParameter(this._GL.SHADING_LANGUAGE_VERSION),this._GL.getParameter(this._GL.VENDOR));const t=this._GL.createShader(this._GL.VERTEX_SHADER);this._GL.shaderSource(t,"attribute vec2 aPosition;attribute vec2 aSpeed;attribute vec2 aLife;attribute float aPointSize;uniform float uTime;uniform vec2 uAccelerate;uniform bool uEnableFade;uniform bool uEnableShrink;varying float alpha;void main() { float use_time = (uTime - aLife.x) / 10.0; float x = aSpeed.y * cos(aSpeed.x) * use_time + 0.5 * uAccelerate.x * use_time * use_time; float y = aSpeed.y * sin(aSpeed.x) * use_time + 0.5 * uAccelerate.y * use_time * use_time; float percent = (uTime - aLife.x) / aLife.y; percent = percent > 1.0 ? 0.0 : cos(1.57 * percent); alpha = uEnableFade ? percent : 1.0; gl_PointSize = uEnableShrink ? aPointSize * percent : aPointSize; gl_Position = vec4(x + aPosition.x, y + aPosition.y, 0.0, 1.0);}"),this._GL.compileShader(t);const e=this._GL.createShader(this._GL.FRAGMENT_SHADER);this._GL.shaderSource(e,"precision mediump float;uniform sampler2D uTexture;varying float alpha;void main(void) { vec4 texture = texture2D(uTexture, gl_PointCoord) * alpha; gl_FragColor = texture;}"),this._GL.compileShader(e),this._GLProgram=this._GL.createProgram(),this._GL.attachShader(this._GLProgram,t),this._GL.attachShader(this._GLProgram,e),this._GL.linkProgram(this._GLProgram);const i=new Float32Array(3500),n=i.BYTES_PER_ELEMENT;this._VBO=this._GL.createBuffer(),this._GL.bindBuffer(this._GL.ARRAY_BUFFER,this._VBO),this._GL.bufferData(this._GL.ARRAY_BUFFER,i,this._GL.DYNAMIC_DRAW);const s=this._GL.getAttribLocation(this._GLProgram,"aPosition");this._GL.vertexAttribPointer(s,2,this._GL.FLOAT,!1,7*n,0),this._GL.enableVertexAttribArray(s);const r=this._GL.getAttribLocation(this._GLProgram,"aSpeed");this._GL.vertexAttribPointer(r,2,this._GL.FLOAT,!1,7*n,2*n),this._GL.enableVertexAttribArray(r);const a=this._GL.getAttribLocation(this._GLProgram,"aLife");this._GL.vertexAttribPointer(a,2,this._GL.FLOAT,!1,7*n,4*n),this._GL.enableVertexAttribArray(a);const o=this._GL.getAttribLocation(this._GLProgram,"aPointSize");this._GL.vertexAttribPointer(o,1,this._GL.FLOAT,!1,7*n,6*n),this._GL.enableVertexAttribArray(o),this._GL.useProgram(this._GLProgram);const l=this._GL.getUniformLocation(this._GLProgram,"uTexture");this._GL.uniform1i(l,0),this._GL.enable(this._GL.BLEND),this._GL.enable(this._GL.SAMPLE_ALPHA_TO_COVERAGE),this._GL.blendFunc(this._GL.ONE,this._GL.ONE_MINUS_SRC_ALPHA),this._Inited=!0}_onDrawFrame(){this._GL.clear(this._GL.COLOR_BUFFER_BIT),this._GL.useProgram(this._GLProgram);for(const t in this._ParticleViewMap)this._ParticleViewMap.hasOwnProperty(t)&&this._ParticleViewMap[t].onDrawFrame(this._GL,this._GLProgram,this._VBO);window.requestAnimationFrame(this._onDrawFrame)}addParticle(t,e,i,n){this._Inited||this._initCanvas();const s=It++;let r;return r=0===e.indexOf("rgba")||0===e.indexOf("#")?Et.getTexture(bt.COLOR,this._GL,null,e):Et.getTexture(bt.IMAGE,this._GL,null,e),this._ParticleViewMap[s]=new Lt(s,t,r,i,n),this._LoopStarted||(this._LoopStarted=!0,window.requestAnimationFrame(this._onDrawFrame)),s}recycleView(t){this._ParticleViewMap[t]&&(this._ParticleViewMap[t].recycle(),delete this._ParticleViewMap[t])}};let At,Ct=t=>{if(t.indexOf(" ")>=0){return t.split(" ").map((t=>parseInt(t.substr(0,t.length-2),10)))}return parseInt(t.substr(0,t.length-2),10)};i.ReactUtils={StyleClassMap:{}};{let t=0;class e{constructor(e,i){this._ID=i||e+t++,this.Describe={},this._RefCount=0,this._Recycled=!1}ManualSetId(t){this._ID=t}GetId(){return this._ID}DoRef(){this._RefCount++}UnRef(){this._RefCount>0?this._RefCount--:console.warn("Already 0...")}}class n extends e{constructor(t){super(null,t)}}const s=new n("DISABLE"),r={alignment:"left",vertical_align:"top",vertical_area_align:"top",text_overflow:"clip",word_wrap:"normal",direction:"ltr",text_inner_direction:"unset"},a=["alignment","vertical_align","vertical_area_align","text_overflow","word_wrap","direction","text_inner_direction"];class o extends e{constructor(t,e,i,n,s,r,a){super("DS",null),this.Describe.alignment=t,this.Describe.vertical_align=e,this.Describe.vertical_area_align=i,this.Describe.text_overflow=n,this.Describe.word_wrap=s,this.Describe.direction=r,this.Describe.text_inner_direction=a}GetSyncData(){return{T:0,ID:this._ID,A:this.Describe.alignment,VA:this.Describe.vertical_align,VAA:this.Describe.vertical_area_align,TO:this.Describe.text_overflow,WW:this.Describe.word_wrap,DIR:this.Describe.direction,TID:this.Describe.text_inner_direction}}}const l={font:"黑体",italic:!1,bold:!1},h=["font","italic","bold"];class u extends e{constructor(t,e,i){super("FS",null),this.Describe.font=t,this.Describe.italic=e,this.Describe.bold=i}GetSyncData(){return{T:1,ID:this._ID,F:this.Describe.font,I:this.Describe.italic,B:this.Describe.bold}}}const c={text_color:"#000000",bg_color:"#00FFFFFF"},d=["text_color","bg_color"];class _ extends e{constructor(t,e){super("CS",null),this.Describe.text_color=t,this.Describe.bg_color=e}GetSyncData(){return{T:2,ID:this._ID,TC:this.Describe.text_color,BC:this.Describe.bg_color}}}const f=["shadow_offset_x","shadow_offset_y","shadow_blur","shadow_color","stroke_width","stroke_color"];class g extends e{constructor(t,e,i,n,s,r){super("SS",null),this.Describe.shadow_offset_x=t,this.Describe.shadow_offset_y=e,this.Describe.shadow_blur=i,this.Describe.shadow_color=n,this.Describe.stroke_width=s,this.Describe.stroke_color=r}GetSyncData(){return{T:3,ID:this._ID,OX:this.Describe.shadow_offset_x,OY:this.Describe.shadow_offset_y,B:this.Describe.shadow_blur,C:this.Describe.shadow_color,SW:this.Describe.stroke_width,SC:this.Describe.stroke_color}}}class m{constructor(t){this.DS=i.sTextStyleCache.GetDisplayStyle(t),this.FS=i.sTextStyleCache.GetFontStyle(t),this.CS=i.sTextStyleCache.GetColorStyle(t),this.SS=i.sTextStyleCache.GetSpecialStyle(t),this._IdsCache=null}DoRef(){this.DS.DoRef(),this.FS.DoRef(),this.CS.DoRef(),this.SS.DoRef()}UnRef(){this.DS.UnRef(),this.FS.UnRef(),this.CS.UnRef(),this.SS.UnRef()}GetIdsPack(){return this._IdsCache||(this._IdsCache={DS:this.DS.GetId(),FS:this.FS.GetId(),CS:this.CS.GetId(),SS:this.SS.GetId()}),this._IdsCache}}class p{constructor(){this._DisplayStyleMap=new Map,this._DisplayStyleIds=new Map,this._FontStyleMap=new Map,this._FontStyleIds=new Map,this._ColorStyleMap=new Map,this._ColorStyleIds=new Map,this._SpecialStyleMap=new Map,this._SpecialStyleIds=new Map,this._NewStyleList=[]}StyleToPack(t){let e={alignment:void 0!==t.hAlign?t.hAlign:r.alignment,vertical_align:void 0!==t.vAlign?t.vAlign:r.vertical_align,vertical_area_align:void 0!==t.vAreaAlign?t.vAreaAlign:r.vertical_area_align,text_overflow:void 0!==t.textOverflow?t.textOverflow:r.text_overflow,word_wrap:void 0!==t.wordWrap?t.wordWrap:r.word_wrap,font:void 0!==t.font?t.font:l.font,italic:void 0!==t.italic?t.italic:l.italic,bold:void 0!==t.bold?t.bold:l.bold,text_color:void 0!==t.textColor?t.textColor:c.text_color,bg_color:void 0!==t.backgroundColor?t.backgroundColor:c.bg_color,direction:void 0!==t.direction?t.direction:"ltr",text_inner_direction:void 0!==t.textInnerDirection?t.textInnerDirection:"unset",shadow_offset_x:0,shadow_offset_y:0,shadow_blur:0,shadow_color:null,stroke_width:0,stroke_color:null};if(t.shadow){const i=t.shadow;e.shadow_offset_x=i.shadowOffsetX,e.shadow_offset_y=i.shadowOffsetY,e.shadow_blur=i.shadowBlur,e.shadow_color=i.shadowColor}if(t.stroke){const i=t.stroke;e.stroke_width=i.strokeWidth,e.stroke_color=i.strokeColor}return new m(e)}PrepareSyncNewStyles(){if(this._NewStyleList.length>0){let t=[];for(let e of this._NewStyleList)t.push(e.GetSyncData());i.sRenderTextureDelegateManager.CreateTextureHeadStatus().SetResourceInfo({STA:{Nam:"TST",Sta:t}}),this._NewStyleList=[]}}GetDisplayStyle(t){return this._GetStyle(t,a,o,this._DisplayStyleMap,this._DisplayStyleIds)}GetFontStyle(t){return this._GetStyle(t,h,u,this._FontStyleMap,this._FontStyleIds)}GetColorStyle(t){return this._GetStyle(t,d,_,this._ColorStyleMap,this._ColorStyleIds)}GetSpecialStyle(t){return 0===t.shadow_blur&&0===t.stroke_width?s:this._GetStyle(t,f,g,this._SpecialStyleMap,this._SpecialStyleIds)}GetDsFromId(t){return this._DisplayStyleIds.get(t)}GetFsFromId(t){return this._FontStyleIds.get(t)}GetCsFromId(t){return this._ColorStyleIds.get(t)}GetSsFromId(t){return this._SpecialStyleIds.get(t)}_GetStyle(t,e,i,n,s){let r=[];for(let i of e)r.push(t[i]);let a=r.join(":"),o=null;return n.has(a)?o=n.get(a):(o=new i(...r),n.set(a,o),s.set(o.GetId(),o),window.JsView&&this._NewStyleList.push(o)),o}}i.TextStyleObjectBase=e,i.TextStylePack=m,i.sTextStyleCache=new p}At="undefined"!=typeof ForgeExtension?i:{LogM:console.log.bind(console),LogF:console.error.bind(console),LogE:console.error.bind(console),LogW:console.warn.bind(console),LogI:console.log.bind(console),LogD:console.debug.bind(console),ThrowError:t=>{throw new Error(t)},Assert:t=>{if(!t)throw new Error("ASSERT!!!!!")},BaseActivity:class{}};class Pt{constructor(t,e,i){this.PageName=t,this._FocusChild=null,this._LatestFocusChild=null,this.SubPages=[],this._ParentPage=null,this._ConsumeKeycodeUntilUp=-1,this.TouchDispatcher=null,this._Acc=.001,this._KeyLock=!1,this._CVSet=null,this._AutoShow=!1,this._IsShowing=!1,this._HostActivity=i,e&&this.SetContentView(e)}OnRenderFrame(){At.LogE("OnRenderFrame() MUST override")}OnKeyDown(t){return!1}OnKeyUp(t){return!1}DispatchKeyDown(t){if(this._KeyLock)return!0;let e=!1;return Pt.LastFocusPage=this,this._FocusChild&&(e=this._FocusChild.DispatchKeyDown(t)),e||(e=this.OnKeyDown(t)),e}DispatchKeyUp(t){if(this._KeyLock)return!0;let e=!1;return this._FocusChild&&(e=this._FocusChild.DispatchKeyUp(t)),e||(e=this.OnKeyUp(t)),e}OnCustomerEvent(t){return!1}BubbleCustomerEvent(t){this.OnCustomerEvent(t)||this._ParentPage&&this._ParentPage.BubbleCustomerEvent(t)}PrintLastFocusPage(){let t="------"+this.PageName+"\n",e=this._ParentPage;return e&&(t+=e.PrintLastFocusPage()),t}OnMouseDown(t){return!1}EnableTouchDispatcher(){this.TouchDispatcher=new i.TouchDispatcher(this)}DisableTouchDispatcher(){this.TouchDispatcher=null}GetTouchView(){return null}GetSwipeParams(t,e,i){let n=void 0===i||0===i?this._Acc:i,s=t*t/2/n;t<0&&(s=-s);let r=e*e/2/n;return e<0&&(r=-r),{durationX:Math.floor(Math.abs(t/n)),durationY:Math.floor(Math.abs(e/n)),distanceX:s,distanceY:r}}OnTouch(t){return!1}DispatchTouch(t){let e=!1;return this.TouchDispatcher&&(e=this.TouchDispatcher.OnTouch(t)),e}LostTouchFocus(t){}OnJavaKey(t,e){return!0}OnPlatformKey(t,e){return!0}PassPlatformKey(t,e){if(this._KeyLock)return!1;let i=this.OnPlatformKey(t,e);return i&&(i=this.OnJavaKey(t,e)),i}DispatchJavaKey(t,e){if(t===this._ConsumeKeycodeUntilUp)return 1===e&&(this._ConsumeKeycodeUntilUp=-1),i.LogM("Consume Javakey until up keycode="+t+" keyaction="+e),!1;if(this._KeyLock)return!1;-1!==this._ConsumeKeycodeUntilUp&&(i.LogE("ERROR: Other key pressed before locked key release"),this._ConsumeKeycodeUntilUp=-1);let n=this._FocusChild,s=!0;return n&&(s=n.DispatchJavaKey(t,e)),s&&(s=this.PassPlatformKey(t,e)),n!==this._FocusChild&&0===e&&this.CosumeAllKeyUnitlUpForFocusChange(t),s}CosumeAllKeyUnitlUpForFocusChange(t){this._ParentPage?this._ParentPage.CosumeAllKeyUnitlUpForFocusChange(t):this._ConsumeKeycodeUntilUp=t}OnHostActivityGetFocus(){this._ConsumeKeycodeUntilUp=-1}IsFocus(){return!this._ParentPage||this._ParentPage._FocusChild===this}_IsLeafInChain(){return this.IsFocus()&&!this._FocusChild}SetParent(t,e){null!==t?(null!==e&&this.SetContentView(e),t instanceof At.BaseActivity&&(t=t.GetRootPageBase()),this._ParentPage=t,t.SubPages.push(this),this._HostActivity=t._HostActivity,t._IsShowing&&this._AutoShow&&this._OnShowInternal()):At.ThrowError("ERROR: parent is null")}SetParentPage(t){this.SetParent(t)}RemoveSubPage(t){t===this._FocusChild&&(this._FocusChild=null),t===this._LatestFocusChild&&(this._LatestFocusChild=null);for(let e=0;e<this.SubPages.length;e++)if(t===this.SubPages[e]){t._OnHideInternal(),this.SubPages.splice(e,1);break}}ClearSubPages(){this.SubPages=[],this._FocusChild=null,this._LatestFocusChild=null}GetParentPage(){return this._ParentPage}Focus(t){if(this.IsFocus()){if(!t)return void At.LogI("Already focused page_name="+this.PageName);if(this._IsLeafInChain())return void At.LogI("Already focused page_name="+this.PageName)}if(Pt.sChangingFocusLock)return void Pt.sDelayedFocusChanges.push(this);if(Pt.sChangingFocusLock=!0,this._ParentPage){let e,i=[],n=this;for(;n._ParentPage&&!n.IsFocus();)i.push(n),n=n._ParentPage;e=t&&0===i.length?this._FocusChild:i[i.length-1]._ParentPage._FocusChild;let s=[];for(;e;)s.push(e),e=e._FocusChild;for(let t=s.length-1;t>=0;t--)s[t]._BlurInternal();for(let t=i.length-1;t>=0;t--)i[t]._FocusInternal();if(!t){let t=i[0];for(;t._LatestFocusChild&&null===t._FocusChild;)t._LatestFocusChild._FocusInternal(),t=t._FocusChild,t||At.ThrowError("ERROR: focus chain is broken")}}Pt.sChangingFocusLock=!1;let e=Pt.sDelayedFocusChanges.length;if(e>0){let t=Pt.sDelayedFocusChanges;Pt.sDelayedFocusChanges=[];for(let i=0;i<e;i++)t[i].Focus()}}ReturnFocusToParent(){this._ParentPage&&(this.IsFocus()&&this._ParentPage.Focus(!0),this._ParentPage._FocusChild==this&&(this._ParentPage._FocusChild=null),this._ParentPage._LatestFocusChild==this&&(this._ParentPage._LatestFocusChild=null))}_FocusInternal(){this._ParentPage?(this._ParentPage._FocusChild=this,this._ParentPage._LatestFocusChild=this,this.OnFocus()):i.LogE("No dispatcher")}_BlurInternal(){this._ParentPage||i.LogE("No dispacher"),this._ParentPage._FocusChild===this?(this._ParentPage._FocusChild=null,this.OnBlur()):At.LogW("Not focus yet, page name="+this.PageName)}GetFocusChild(){return this._FocusChild}Hide(){this._AutoShow=!1,this._OnHideInternal()}Show(t){this._OnShowInternal(),t&&this.Focus()}OnFocus(){At.LogW("No overrided Page OnFocus event, page name="+this.PageName)}OnBlur(){At.LogW("No overrided Page OnBlur event, page name="+this.PageName)}OnShow(){At.LogW("No overrided Page OnShow event, page name="+this.PageName)}OnHide(){At.LogW("No overrided Page OnHide event, page name="+this.PageName)}_OnShowInternal(){let t;for(let e=0;e<this.SubPages.length;e++)t=this.SubPages[e],t._AutoShow&&t._OnShowInternal();this._IsShowing||(this._IsShowing=!0,this.OnShow())}_OnHideInternal(){let t;for(let e=0;e<this.SubPages.length;e++)t=this.SubPages[e],t._IsShowing&&t._OnHideInternal();this._IsShowing&&(this._IsShowing=!1,this.OnHide())}GetMainView(){return null===this._CVSet&&(this._CVSet=new i.MainViewSetting(null,null)),this._CVSet}GetContentView(){return null===this._CVSet?null:this._CVSet.View}SetContentView(t){null!==t&&(null!==this._CVSet&&this._CVSet.View.BindedPageBase(null),this._CVSet=new i.MainViewSetting(t,null),t.BindedPageBase(this))}OnContentViewLostInternal(){this.OnContentViewLost()}OnContentViewLost(){}GetHostActivity(){return this._HostActivity}SetHostActivity(t){this._HostActivity=t}GetTextureManager(){return null!==this._HostActivity?this._HostActivity.GetTextureManager():null}SetAutoShow(t){this._AutoShow=t}KeyLock(){this._KeyLock=!0}UnKeyLock(){this._KeyLock=!1}}Pt.LastFocusPage=null,Pt.sChangingFocusLock=!1,Pt.sDelayedFocusChanges=[],i.PageBase=Pt;{let t=1,e=2,n=3;class s{constructor(n,s){this.IdToken=i.sViewSensorManager.IdTokenGenerator++,this.Type=n,this.Manager=null,this._OnAnyViewLostList=null,this._AnyViewLostMark=null,this._OnWholeViewLostList=null,this._WholeViewLostMark=null,this._HtmlStatusInfo={target:null==s?t:e}}OnManaged(t){return this._HtmlStatusInfo.target!=n&&(this.Manager?(console.error("manage duplicated"),!1):(this._RegisterViewLostCallbacks(),this.Manager=t,!0))}ResetAutoRecycleViewsRef(t,e){t instanceof Array&&e instanceof Array?this._HtmlStatusInfo.target!=n&&(this._UnregisterViewCallbacks(),this._OnAnyViewLostList=t,this._OnWholdViewLostList=e,this.Manager&&this._RegisterViewLostCallbacks()):console.error("need array ",t,e)}Expired(){return this._HtmlStatusInfo.target==n}Recycle(){this._HtmlStatusInfo.target!=n&&this.Manager&&(this._HtmlStatusInfo.target=n,this.OnSelfRecycle(),this.Manager.RecycleSensor(this),this.Manager=null,this._UnregisterViewCallbacks()),this._OnAnyViewLostList=null,this._OnWholdViewLostList=null}HtmlDoWorkOnFrame(){console.log("Need be override")}HtmlNeedWorkOnFrame(){return!0}OnCallback(t){console.log("Need be override")}OnSelfRecycle(){}_RegisterViewLostCallbacks(){let t=this;if(this._OnAnyViewLostList?.length>0){let e=this._OnAnyViewLostList.length;this._AnyViewLostMark={callbacks:new Array(e).fill(null)};for(let i=0;i<e;i++){let e=this._OnAnyViewLostList[i];if(e.Expired)this._OnAnyViewLostList[i]=null;else{let n=()=>{t.Recycle()};this._AnyViewLostMark.callbacks[i]=n,e.RegisterDetachCallback(n)}}}else this._AnyViewLostMark=null;if(this._OnWholeViewLostList?.length>0){let e=this._OnWholeViewLostList.length;this._WholeViewLostMark={list:new Array(e).fill({callback:null,lost:!1}),lostCount:0};for(let i=0;i<e;i++){let e=this._OnWholeViewLostList[i];if(e.Expired)this._OnWholeViewLostList[i]=null,this._WholeViewLostMark.list[i].lost=!0,this._WholeViewLostMark.lostCount++;else{let n=()=>{t._OnViewOfWholeListLost(i)};this._WholeViewLostMark.list[i].callback=n,e.RegisterDetachCallback(n)}}}else this._WholeViewLostMark=null}_UnregisterViewCallbacks(){if(this._AnyViewLostMark){let t=this._OnAnyViewLostList.length;for(let e=0;e<t;e++){this._OnAnyViewLostList[e]&&this._OnAnyViewLostList[e].UnregisterDetachCallback(this._AnyViewLostMark.callbacks[e])}this._AnyViewLostMark=null}if(this._WholeViewLostMark){let t=this._OnWholdViewLostList.length;for(let e=0;e<t;e++){this._OnWholdViewLostList[e]&&this._OnWholdViewLostList[e].UnregisterDetachCallback(this._WholeViewLostMark.list[e].callback)}this._WholeViewLostMark=null}}_OnViewOfWholeListLost(t){this._WholeViewLostMark.list[t].lost||(this._WholeViewLostMark.lostCount++,this._WholeViewLostMark.list[t].lost=!0,this._WholeViewLostMark.list[view_idx].callback=null,this._OnWholdViewLostList[t]=null),this._WholeViewLostMark.lostCount==this._OnWholeViewLostList.length&&this.Recycle()}}s.TypeDefines={TYPE_IMPACT:1,TYPE_FROZE_SET:2,TYPE_ON_SCREEN:3,TYPE_DRAG_IMPACT:101},i.ViewSensor=s}{class t{constructor(){this._SensorMaps={},this.IdTokenGenerator=77}HtmlDoWorkOnFrame(){for(let t in this._SensorMaps){let e=this._SensorMaps[t];e.Expired()?delete this._SensorMaps[t]:e.HtmlDoWorkOnFrame()}}HtmlHasActiveSensor(){for(let t in this._SensorMaps)if(this._SensorMaps[t].HtmlNeedWorkOnFrame())return!0;return!1}AddSensor(t){if(t){t.OnManaged(this)&&(this._SensorMaps[t.IdToken]=t),this.RequestSwap()}}AddToSyncList(t){this._SensorMaps.hasOwnProperty(t.IdToken)||console.error("Error: (Add)No in map",this._SensorMaps,t)}RecycleSensor(t){this._SensorMaps.hasOwnProperty(t.IdToken)?(delete this._SensorMaps[t.IdToken],this.RequestSwap()):console.error("Error: (del)No in map",this._SensorMaps,t)}RequestSwap(){i.sRenderBridge.BeginHtmlFrameLoop()}}i.sViewSensorManager=new t}class Rt{constructor(t,e,i){this.element=i,this.row=t,this.column=e}toString(){return`[${this.element[0]},${this.element[1]},${this.element[2]},${this.element[3]},${this.element[4]},${this.element[5]},${this.element[6]},${this.element[7]},${this.element[8]},${this.element[9]},${this.element[10]},${this.element[11]},${this.element[12]},${this.element[13]},${this.element[14]},${this.element[15]}]`}multiply(t){if(this.column!==t.row)throw new Error("matrix multiply error");const e=[];for(let i=0;i<this.row;i++)for(let n=0;n<t.column;n++){e[i+n*t.column]=0;for(let s=0;s<this.column;s++)e[i+n*t.column]+=this.element[i+s*this.column]*t.element[s+n*t.column]}return new Rt(this.row,t.column,e)}static identity(){return new Rt(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static translate(t,e,i){return new Rt(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1])}static scale(t,e,i){return new Rt(4,4,[t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1])}static rotate(t,e,i,n){const s=Math.cos(n/180*Math.PI),r=Math.sin(n/180*Math.PI),a=Math.sqrt(t*t+e*e+i*i);if(1!==a){const n=1/a;t*=n,e*=n,i*=n}const o=1-s,l=t*e,h=e*i,u=i*t,c=t*r,d=e*r,_=i*r,f=[];return f[0]=t*t*o+s,f[1]=l*o+_,f[2]=u*o-d,f[3]=0,f[4]=l*o-_,f[5]=e*e*o+s,f[6]=h*o+c,f[7]=0,f[8]=u*o+d,f[9]=h*o-c,f[10]=i*i*o+s,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,new Rt(4,4,f)}static skew(t,e){const i=new Array(16).fill(0),n=2*Math.PI*(e/360),s=-2*Math.PI*(t/360);return i[0]=1-s*n,i[1]=-Math.tan(n),i[4]=Math.tan(s),i[5]=1,i[10]=1,i[15]=1,new Rt(4,4,i)}static transform2d(t,e,i,n,s,r){return new Rt(4,4,[t,e,0,0,i,n,0,0,0,0,1,0,s,r,0,1])}}const Dt=t=>t>=65&&t<=90||t>=97&&t<=122,Ot=t=>t>=48&&t<=57,kt=(t,e)=>{switch(t){case"translate3d":return Rt.translate(e[0],e[1],e[2]);case"scale3d":return Rt.scale(e[0],e[1],e[2]);case"rotate3d":return Rt.rotate(e[0],e[1],e[2],e[3]);case"skew":return Rt.skew(e[0],e[1]);case"matrix":return Rt.transform2d(e[0],e[1],e[2],e[3],e[4],e[5]);case"matrix3d":return new Rt(4,4,e);default:throw new Error(`no support type ${t}`)}},Ft=t=>{let e=Rt.identity();if(!t)return e;let i="",n="",s=[],r=0;for(let a=0;a<t.length;a++){const o=t.charCodeAt(a);0===r?(Dt(o)||Ot(o))&&(i+=t[a]):(Ot(o)||46===o||45===o||101===o)&&(n+=t[a]),40===o?(r=1,n="",s=[]):41===o?(s.push(parseFloat(n)),e=e.multiply(kt(i,s)),i="",r=0):44===o&&(s.push(parseFloat(n)),n="")}return e},Vt=t=>{if(t.indexOf(" ")>=0){return t.split(" ").map((t=>parseInt(t.substr(0,t.length-2),10)))}return parseInt(t.substr(0,t.length-2),10)},Mt=t=>{let e=t;const i=Vt(e.style.width),n=Vt(e.style.height);let s=Rt.identity();for(;e.parentElement;){const t=getComputedStyle(e),i=t.transform?t.transform:t.webkitTransform;if(i){const n=t.transformOrigin?t.transformOrigin:t.webkitTransformOrigin,r=Ft(i);if(n){const t=Vt(n),i=Rt.translate(-t[0],-t[1],0),a=Rt.translate(t[0],t[1],0);s=Rt.translate(e.offsetLeft,e.offsetTop,0).multiply(a.multiply(r.multiply(i.multiply(s))))}else s=r.multiply(s)}e=e.parentElement}const r=new Rt(4,4,[0,0,0,1,i,0,0,1,0,n,0,1,i,n,0,1]);s=s.multiply(r);const a=s.element;return[a[0],a[1],a[4],a[5],a[8],a[9],a[12],a[13]]};function Gt(t){let e=Mt(t),i=Math.min(e[0],e[2],e[4],e[6]),n=Math.max(e[0],e[2],e[4],e[6]);return[Math.min(e[1],e[3],e[5],e[7]),Math.max(e[1],e[3],e[5],e[7]),i,n]}class Nt{constructor(t,e){this.set(t,e)}add(t,e){return t instanceof Nt?(this.x+=t.x,this.y+=t.y):(this.x+=t||0,this.y+=e||0),this}angle(t){if(void 0!==t)return this.set(this.length(),0).rotate(t);let e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e}angleDeg(t){return void 0!==t?this.angle(t/180*Math.PI):180*this.angle()/Math.PI}clone(){return new Nt(this.x,this.y)}cross(t,e){return t instanceof Nt?this.x*t.y-this.y*t.x:this.x*e-this.y*t}distance(t,e){const i=this.distanceSq(t,e);if(void 0!==i)return Math.sqrt(i)}distanceSq(t,e){let i,n;if(t instanceof Nt)i=t.x-this.x,n=t.y-this.y;else{if(void 0===e)return;i=t-this.x,n=e-this.y}return i*i+n*n}dot(t,e){return t instanceof Nt?this.x*t.x+this.y*t.y:this.x*t+this.y*e}equals(t,e,i){return t instanceof Nt?(e=e||0,Math.abs(this.x-t.x)<=e&&Math.abs(this.y-t.y)<=e):void 0!==e&&(i=i||0,Math.abs(this.x-t)<=i&&Math.abs(this.y-e)<=i)}length(){return Math.sqrt(this.lengthSq())}lengthSq(){return this.x*this.x+this.y*this.y}negate(){return this.scale(-1)}normalize(){return this.scale(1/this.length())}rotate(t){const e=Math.cos(t),i=Math.sin(t);return this.set(this.x*e-this.y*i,this.x*i+this.y*e)}rotateDeg(t){return this.rotate(t/180*Math.PI)}scale(t,e){return this.x*=t,this.y*=e||t,this}set(t,e){return t instanceof Nt?(this.x=t.x,this.y=t.y):(this.x=t||0,this.y=e||0),this}setPolar(t,e){return this.set(e,0).rotate(t)}setPolarDeg(t,e){return this.setPolar(t/180*Math.PI,e)}sub(t,e){return void 0!==e?(this.x-=t,this.y-=e):(this.x-=t.x,this.y-=t.y),this}toString(){return`(${this.x}, ${this.y})`}}function Bt(t,e,i){return i=i||0,Math.abs(t-e)<Math.abs(i)}const Wt={isEqual:Bt,isZero:(t,e)=>Bt(t,0,e),clamp:(t,e,i)=>t>e?t<i?t:i:e},$t=Wt.isZero,Ht=Wt.clamp,Ut=new Nt(0,0),Xt=1e-4;function Yt(t){return"[object Array]"===Object.prototype.toString.call(t)}function zt(t){if(!Yt(t))throw new Error("Polygon must be an array of points");switch(typeof t[0]){case"number":{if(t.length%2!=0)throw new Error("Polygon that contains array of numbers must has even length ([x0, y0, x1, y1, ...., xn, yn])");const e=[];for(let i=0;i<t.length;i+=2)e.push(new Nt(t[i],t[i+1]));return e}case"object":return t.map(Yt(t[0])?t=>new Nt(t[0],t[1]):t=>new Nt(t.x,t.y));default:throw new Error("Passed polygon is not an array of 2D coordinates")}}function Kt(t){if(1===t.length)return new Nt(t[0]);const e=new Nt(0,0);t.forEach((t=>e.add(t))),e.scale(1/t.length);const i=new Nt;let n=0;return t.forEach(((s,r)=>{const a=new Nt(s),o=new Nt(r+1===t.length?t[0]:t[r+1]);a.add(-e.x,-e.y),o.add(-e.x,-e.y);const l=.5*a.cross(o);n+=l,i.add(a.add(o).scale(.3333333333333333).scale(l))})),$t(n,Xt)?i.set(t[0]):i.scale(1/n).add(e)}function jt(t,e){let i=t[0],n=e.dot(t[0]),s=0;for(let r=1;r<t.length;r++)s=e.dot(t[r]),s>n&&(n=s,i=t[r]);return new Nt(i)}function qt(t,e,i){const n=jt(t,i),s=jt(e,i.negate());return new Nt(n.sub(s))}function Jt(t,e){const i=new Nt(0,0),n=new Nt(t).negate(),s=new Nt(e).sub(t),r=s.dot(s);if($t(r,Xt))return i.set(t);let a=n.dot(s)/r;return a=Ht(a,0,1),i.set(s.scale(a).add(t))}function Zt(t,e){t=zt(t),e=zt(e);const i=Kt(t),n=Kt(e).add(i.negate());let s,r,a;s=qt(t,e,n),r=qt(t,e,n.negate());for(let i=0;i<30;i++){const i=Jt(s,r);if($t(i.length(),Xt))return 0;n.set(i.negate().normalize()),a=qt(t,e,n);const o=a.dot(n),l=s.dot(n);if($t(o-l,Xt))return o;s.distanceSq(Ut)<r.distanceSq(Ut)?r=a:s=a}return 0}const Qt={intersect:(t,e)=>$t(Zt(t,e),Xt),distance:Zt};{class t extends i.ViewSensor{constructor(t,e,n,s){super(i.ViewSensor.TypeDefines.TYPE_IMPACT),this._HtmlConfig={view1:t,view2:e,frozeSetId:s?s.IdToken:0,status:{contacted:!1}},this._Callback=n,this._FrozeViewsSet=s,s&&s.DoRef(),this.ResetAutoRecycleViewsRef([t,e],[]),i.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.view1&&this._HtmlConfig.view2){(t=this._HtmlConfig.view1.Element,e=this._HtmlConfig.view2.Element,Qt.intersect(Mt(t),Mt(e)))?this._HtmlConfig.status.contacted||(this._HtmlConfig.status.contacted=!0,this.OnCallback(1)):this._HtmlConfig.status.contacted&&(this.OnCallback(2),this._HtmlConfig.status.contacted=!1)}var t,e}OnCallback(t){this._Callback&&(1==t&&this._Callback.OnBeginContact?this._Callback.OnBeginContact():2==t&&this._Callback.OnEndContact&&this._Callback.OnEndContact())}OnSelfRecycle(){this._FrozeViewsSet&&(this._FrozeViewsSet.UnRef(),this._FrozeViewsSet=null),this._HtmlConfig=null}}i.ImpactSensor=t}{class t{constructor(){}StartTrace(t,e,n,s){return new i.ImpactSensor(t,e,n,s)}}i.sImpactSensorManager=new t}{class t extends i.ViewSensor{constructor(t,e){super(i.ViewSensor.TypeDefines.TYPE_FROZE_SET),this._PreImpactViewList=null,this._OnImpactViewList=null,this._UpdateAutoRecycleRef(t,!0,e,!0),i.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){}HtmlNeedWorkOnFrame(){return!1}UpdatePreImpactList(t){this._UpdateAutoRecycleRef(t,!0,null,!1)}UpdateOnImpactList(t){this._UpdateAutoRecycleRef(null,!1,t,!0)}DoRef(){this.Expired()?console.error("Error: froze set is expired for all bind views lost"):this._RefCount++}UnRef(){this._RefCount>0&&this._RefCount--,0==this._RefCount&&this.Recycle()}OnSelfRecycle(){this._PreImpactViewList=null,this._OnImpactViewList=null}_UpdateAutoRecycleRef(t,e,i,n){e&&(this._PreImpactViewList=t instanceof Array?t:[]),n&&(this._OnImpactViewList=i instanceof Array?i:[]),this.ResetAutoRecycleViewsRef([],[...this._PreImpactViewList,...this._OnImpactViewList])}}i.sImpactSensorManager.AutoFroze=t}i.sImpactSensorManager.Callback=class{constructor(t,e){this.OnBeginContact=t,this.OnEndContact=e}UpdateImpactCallback(t){this.OnBeginContact=t}UpdateLeaveCallback(t){this.OnEndContact=t}};class te{constructor(t,e){this.Start=t,this.End=e}Merge(t){return this.IsInterAct(t)?(this.Start>t.Start&&(this.Start=t.Start),this.End<t.End&&(this.End=t.End),!0):this.End+1==t.Start?(this.End=t.End,!0):this.Start==t.End+1&&(this.Start=t.Start,!0)}IsInterAct(t){return t.Start<this.Start?!(t.End<this.Start):t.Start<=this.End}IsInclude(t){return this.Start<=t.Start&&this.End>=t.End}Exclude(t){var e={success:!1,newSplitedRange:null};return this.IsInterAct(t)?(t.Start<=this.Start?t.End<this.End?this.Start=t.End+1:this.Clear():(t.End<this.End&&(e.newSplitedRange=new te(t.End+1,this.End),e.newSplitedRange=e.newSplitedRange),this.End=t.Start-1),e.success=!0,e.success=e.success,e):e}IsEmpty(){return this.Start>this.End}Clear(){this.End=this.Start-1}Clone(){return new te(this.Start,this.End)}}{const t="OV",e="NV",n="OH",s="NH";class r extends i.ViewSensor{constructor(t,e){super(i.ViewSensor.TypeDefines.TYPE_ON_SCREEN),this._HtmlConfig={view:t,container:null,enable:!1,testRange:null,status:{horizonVisible:!1,verticalVisible:!1}},this._Callback=e,this.ResetAutoRecycleViewsRef([t],[]),i.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.enable&&this._HtmlConfig.testRange&&this._HtmlConfig.view){let r=i.sRenderBridge.GetScreenInfo().designedWidth,a=Math.floor(9*r/16),o={top:0,bottom:0,left:0,right:0},l=Gt(this._HtmlConfig.view.Element);[o.top,o.bottom,o.left,o.right]=l;let h,u,c={top:0,bottom:a,left:0,right:r},d=!0;if(this._HtmlConfig.container){let t=Gt(this._HtmlConfig.container.Element);[c.top,c.bottom,c.left,c.right]=t,h=new te(c.left,c.right),u=new te(c.top,c.bottom);let e=new te(0,r),i=new te(0,a);d=e.IsInterAct(h)&&i.IsInterAct(u)}else h=new te(c.left,c.right),u=new te(c.top,c.bottom);let _,f,g,m,p=new te(o.left,o.right),w=new te(o.top,o.bottom),b=this._HtmlConfig.testRange;{let t=Math.floor((o.right-o.left)*b.horizon);_=new te(o.left,o.left+t),f=new te(o.right-t,o.right)}{let t=Math.floor((o.bottom-o.top)*b.vertical);g=new te(o.top,o.top+t),m=new te(o.bottom-t,o.bottom)}let T=(h.IsInclude(_)||h.IsInclude(f))&&u.IsInterAct(w)&&d,S=(u.IsInclude(g)||u.IsInclude(m))&&h.IsInterAct(p)&&d;if(T!=this._HtmlConfig.status.horizonVisible||S!=this._HtmlConfig.status.verticalVisible){let i={};i[n]=this._HtmlConfig.status.horizonVisible,i[s]=T,i[t]=this._HtmlConfig.status.verticalVisible,i[e]=S,this._HtmlConfig.status.horizonVisible=T,this._HtmlConfig.status.verticalVisible=S,this.OnCallback(i)}}}HtmlNeedWorkOnFrame(){return this._HtmlConfig.enable}HtmlRequestSync(){i.sRenderBridge.BeginHtmlFrameLoop()}ResetArea(t){"number"!=typeof t.horizon&&(console.log("horizon not set, default to 1.0"),t.horizon=1),"number"!=typeof t.vertical&&(console.log("vertical not set, default to 1.0"),t.vertical=1),this._HtmlConfig.testRange=t,this.HtmlRequestSync()}Enable(t){this._HtmlConfig.enable=t,this.HtmlRequestSync()}ResetContainer(t){this._HtmlConfig.container=t,this.HtmlRequestSync()}OnCallback(i){this._Callback&&this._Callback(i[n],i[s],i[t],i[e])}OnSelfRecycle(){this._HtmlConfig=null}}i.VisibleSensor=r}function ee(t){if(!t)throw Error("assert :P")}function ie(t,e,i){for(var n=0;4>n;n++)if(t[e+n]!=i.charCodeAt(n))return!0;return!1}function ne(t,e,i,n,s){for(var r=0;r<s;r++)t[e+r]=i[n+r]}function se(t,e,i,n){for(var s=0;s<n;s++)t[e+s]=i}function re(t){return new Int32Array(t)}function ae(t,e){for(var i=[],n=0;n<t;n++)i.push(new e);return i}function oe(t,e){var i=[];return function t(i,n,s){for(var r=s[n],a=0;a<r&&(i.push(s.length>n+1?[]:new e),!(s.length<n+1));a++)t(i[a],n+1,s)}(i,0,t),i}function le(t,e){for(var i="",n=0;n<4;n++)i+=String.fromCharCode(t[e++]);return i}function he(t,e){return(t[e+0]<<0|t[e+1]<<8|t[e+2]<<16)>>>0}function ue(t,e){return(t[e+0]<<0|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}window.WebPDecoder=function(){function t(t,e){for(var i=1<<e-1>>>0;t&i;)i>>>=1;return i?(t&i-1)+i:t}function e(t,e,i,n,s){ee(!(n%i));do{t[e+(n-=i)]=s}while(0<n)}function i(i,s,r,a,o){if(ee(2328>=o),512>=o)var l=re(512);else if(null==(l=re(o)))return 0;return function(i,s,r,a,o,l){var h,u,c=s,d=1<<r,_=re(16),f=re(16);for(ee(0!=o),ee(null!=a),ee(null!=i),ee(0<r),u=0;u<o;++u){if(15<a[u])return 0;++_[a[u]]}if(_[0]==o)return 0;for(f[1]=0,h=1;15>h;++h){if(_[h]>1<<h)return 0;f[h+1]=f[h]+_[h]}for(u=0;u<o;++u)h=a[u],0<a[u]&&(l[f[h]++]=u);if(1==f[15])return(a=new n).g=0,a.value=l[0],e(i,c,1,d,a),d;var g,m=-1,p=d-1,w=0,b=1,T=1,S=1<<r;for(u=0,h=1,o=2;h<=r;++h,o<<=1){if(b+=T<<=1,0>(T-=_[h]))return 0;for(;0<_[h];--_[h])(a=new n).g=h,a.value=l[u++],e(i,c+w,o,S,a),w=t(w,h)}for(h=r+1,o=2;15>=h;++h,o<<=1){if(b+=T<<=1,0>(T-=_[h]))return 0;for(;0<_[h];--_[h]){if(a=new n,(w&p)!=m){for(c+=S,g=1<<(m=h)-r;15>m&&!(0>=(g-=_[m]));)++m,g<<=1;d+=S=1<<(g=m-r),i[s+(m=w&p)].g=g+r,i[s+m].value=c-s-m}a.g=h-r,a.value=l[u++],e(i,c+(w>>r),o,S,a),w=t(w,h)}}return b!=2*f[15]-1?0:d}(i,s,r,a,o,l)}function n(){this.value=this.g=0}function s(){this.value=this.g=0}function r(){this.G=ae(5,n),this.H=re(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=ae(Mi,s)}function a(t,e,i,n){ee(null!=t),ee(null!=e),ee(2147483648>n),t.Ca=254,t.I=0,t.b=-8,t.Ka=0,t.oa=e,t.pa=i,t.Jd=e,t.Yc=i+n,t.Zc=4<=n?i+n-4+1:i,w(t)}function o(t,e){for(var i=0;0<e--;)i|=T(t,128)<<e;return i}function l(t,e){var i=o(t,e);return b(t)?-i:i}function h(t,e,i,n){var s,r=0;for(ee(null!=t),ee(null!=e),ee(4294967288>n),t.Sb=n,t.Ra=0,t.u=0,t.h=0,4<n&&(n=4),s=0;s<n;++s)r+=e[i+s]<<8*s;t.Ra=r,t.bb=n,t.oa=e,t.pa=i}function u(t){for(;8<=t.u&&t.bb<t.Sb;)t.Ra>>>=8,t.Ra+=t.oa[t.pa+t.bb]<<Bi-8>>>0,++t.bb,t.u-=8;g(t)&&(t.h=1,t.u=0)}function c(t,e){if(ee(0<=e),!t.h&&e<=Ni){var i=f(t)&Gi[e];return t.u+=e,u(t),i}return t.h=1,t.u=0}function d(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function _(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function f(t){return t.Ra>>>(t.u&Bi-1)>>>0}function g(t){return ee(t.bb<=t.Sb),t.h||t.bb==t.Sb&&t.u>Bi}function m(t,e){t.u=e,t.h=g(t)}function p(t){t.u>=Wi&&(ee(t.u>=Wi),u(t))}function w(t){ee(null!=t&&null!=t.oa),t.pa<t.Zc?(t.I=(t.oa[t.pa++]|t.I<<8)>>>0,t.b+=8):(ee(null!=t&&null!=t.oa),t.pa<t.Yc?(t.b+=8,t.I=t.oa[t.pa++]|t.I<<8):t.Ka?t.b=0:(t.I<<=8,t.b+=8,t.Ka=1))}function b(t){return o(t,1)}function T(t,e){var i=t.Ca;0>t.b&&w(t);var n=t.b,s=i*e>>>8,r=(t.I>>>n>s)+0;for(r?(i-=s,t.I-=s+1<<n>>>0):i=s+1,n=i,s=0;256<=n;)s+=8,n>>=8;return n=7^s+$i[n],t.b-=n,t.Ca=(i<<n)-1,r}function S(t,e,i){t[e+0]=i>>24&255,t[e+1]=i>>16&255,t[e+2]=i>>8&255,t[e+3]=i>>0&255}function y(t,e){return t[e+0]<<0|t[e+1]<<8}function x(t,e){return y(t,e)|t[e+2]<<16}function E(t,e){return y(t,e)|y(t,e+2)<<16}function v(t,e){var i=1<<e;return ee(null!=t),ee(0<e),t.X=re(i),null==t.X?0:(t.Mb=32-e,t.Xa=e,1)}function L(t,e){ee(null!=t),ee(null!=e),ee(t.Xa==e.Xa),ne(e.X,0,t.X,0,1<<e.Xa)}function I(){this.X=[],this.Xa=this.Mb=0}function A(t,e,i,n){ee(null!=i),ee(null!=n);var s=i[0],r=n[0];return 0==s&&(s=(t*r+e/2)/e),0==r&&(r=(e*s+t/2)/t),0>=s||0>=r?0:(i[0]=s,n[0]=r,1)}function C(t,e){return t+(1<<e)-1>>>e}function P(t,e){return((4278255360&t)+(4278255360&e)>>>0&4278255360)+((16711935&t)+(16711935&e)>>>0&16711935)>>>0}function R(t,e){self[e]=function(e,i,n,s,r,a,o){var l;for(l=0;l<r;++l){var h=self[t](a[o+l-1],n,s+l);a[o+l]=P(e[i+l],h)}}}function D(){this.ud=this.hd=this.jd=0}function O(t,e){return((4278124286&(t^e))>>>1)+(t&e)>>>0}function k(t){return 0<=t&&256>t?t:0>t?0:255<t?255:void 0}function F(t,e){return k(t+(t-e+.5>>1))}function V(t,e,i){return Math.abs(e-i)-Math.abs(t-i)}function M(t,e,i,n,s,r,a){for(n=r[a-1],i=0;i<s;++i)r[a+i]=n=P(t[e+i],n)}function G(t,e,i,n,s){var r;for(r=0;r<i;++r){var a=t[e+r],o=a>>8&255,l=16711935&(l=(l=16711935&a)+((o<<16)+o));n[s+r]=(4278255360&a)+l>>>0}}function N(t,e){e.jd=t>>0&255,e.hd=t>>8&255,e.ud=t>>16&255}function B(t,e,i,n,s,r){var a;for(a=0;a<n;++a){var o=e[i+a],l=o>>>8,h=o,u=255&(u=(u=o>>>16)+((t.jd<<24>>24)*(l<<24>>24)>>>5));h=255&(h=(h=h+((t.hd<<24>>24)*(l<<24>>24)>>>5))+((t.ud<<24>>24)*(u<<24>>24)>>>5));s[r+a]=(4278255360&o)+(u<<16)+h}}function W(t,e,i,n,s){self[e]=function(t,e,i,r,a,o,l,h,u){for(r=l;r<h;++r)for(l=0;l<u;++l)a[o++]=s(i[n(t[e++])])},self[t]=function(t,e,r,a,o,l,h){var u=8>>t.b,c=t.Ea,d=t.K[0],_=t.w;if(8>u)for(t=(1<<t.b)-1,_=(1<<u)-1;e<r;++e){var f,g=0;for(f=0;f<c;++f)f&t||(g=n(a[o++])),l[h++]=s(d[g&_]),g>>=u}else self["VP8LMapColor"+i](a,o,d,_,l,h,e,r,c)}}function $(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>16&255,n[s++]=r>>8&255,n[s++]=r>>0&255}}function H(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>16&255,n[s++]=r>>8&255,n[s++]=r>>0&255,n[s++]=r>>24&255}}function U(t,e,i,n,s){for(i=e+i;e<i;){var r=(a=t[e++])>>16&240|a>>12&15,a=a>>0&240|a>>28&15;n[s++]=r,n[s++]=a}}function X(t,e,i,n,s){for(i=e+i;e<i;){var r=(a=t[e++])>>16&248|a>>13&7,a=a>>5&224|a>>3&31;n[s++]=r,n[s++]=a}}function Y(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>0&255,n[s++]=r>>8&255,n[s++]=r>>16&255}}function z(t,e,i,n,s,r){if(0==r)for(i=e+i;e<i;)S(n,((r=t[e++])[0]>>24|r[1]>>8&65280|r[2]<<8&16711680|r[3]<<24)>>>0),s+=32;else ne(n,s,t,e,i)}function K(t,e){self[e][0]=self[t+"0"],self[e][1]=self[t+"1"],self[e][2]=self[t+"2"],self[e][3]=self[t+"3"],self[e][4]=self[t+"4"],self[e][5]=self[t+"5"],self[e][6]=self[t+"6"],self[e][7]=self[t+"7"],self[e][8]=self[t+"8"],self[e][9]=self[t+"9"],self[e][10]=self[t+"10"],self[e][11]=self[t+"11"],self[e][12]=self[t+"12"],self[e][13]=self[t+"13"],self[e][14]=self[t+"0"],self[e][15]=self[t+"0"]}function j(t){return t==$n||t==Hn||t==Un||t==Xn}function q(){this.eb=[],this.size=this.A=this.fb=0}function J(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function Z(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new q,this.f.kb=new J,this.sd=null}function Q(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function tt(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function et(t){return alert("todo:WebPSamplerProcessPlane"),t.T}function it(t,e){var i=t.T,n=e.ba.f.RGBA,s=n.eb,r=n.fb+t.ka*n.A,a=ms[e.ba.S],o=t.y,l=t.O,h=t.f,u=t.N,c=t.ea,d=t.W,_=e.cc,f=e.dc,g=e.Mc,m=e.Nc,p=t.ka,w=t.ka+t.T,b=t.U,T=b+1>>1;for(0==p?a(o,l,null,null,h,u,c,d,h,u,c,d,s,r,null,null,b):(a(e.ec,e.fc,o,l,_,f,g,m,h,u,c,d,s,r-n.A,s,r,b),++i);p+2<w;p+=2)_=h,f=u,g=c,m=d,u+=t.Rc,d+=t.Rc,r+=2*n.A,a(o,(l+=2*t.fa)-t.fa,o,l,_,f,g,m,h,u,c,d,s,r-n.A,s,r,b);return l+=t.fa,t.j+w<t.o?(ne(e.ec,e.fc,o,l,b),ne(e.cc,e.dc,h,u,T),ne(e.Mc,e.Nc,c,d,T),i--):1&w||a(o,l,null,null,h,u,c,d,h,u,c,d,s,r+n.A,null,null,b),i}function nt(t,e,i){var n=t.F,s=[t.J];if(null!=n){var r=t.U,a=e.ba.S,o=a==Nn||a==Un;e=e.ba.f.RGBA;var l=[0],h=t.ka;l[0]=t.T,t.Kb&&(0==h?--l[0]:(--h,s[0]-=t.width),t.j+t.ka+t.T==t.o&&(l[0]=t.o-t.j-h));var u=e.eb;h=e.fb+h*e.A;t=En(n,s[0],t.width,r,l,u,h+(o?0:3),e.A),ee(i==l),t&&j(a)&&yn(u,h,o,r,l,e.A)}return 0}function st(t){var e=t.ma,i=e.ba.S,n=11>i,s=i==Vn||i==Gn||i==Nn||i==Bn||12==i||j(i);if(e.memory=null,e.Ib=null,e.Jb=null,e.Nd=null,!ki(e.Oa,t,s?11:12))return 0;if(s&&j(i)&&pi(),t.da)alert("todo:use_scaling");else{if(n){if(e.Ib=et,t.Kb){if(i=t.U+1>>1,e.memory=re(t.U+2*i),null==e.memory)return 0;e.ec=e.memory,e.fc=0,e.cc=e.ec,e.dc=e.fc+t.U,e.Mc=e.cc,e.Nc=e.dc+i,e.Ib=it,pi()}}else alert("todo:EmitYUV");s&&(e.Jb=nt,n&&gi())}if(n&&!Ps){for(t=0;256>t;++t)Rs[t]=89858*(t-128)+vs>>Es,ks[t]=-22014*(t-128)+vs,Os[t]=-45773*(t-128),Ds[t]=113618*(t-128)+vs>>Es;for(t=Ls;t<Is;++t)e=76283*(t-16)+vs>>Es,Fs[t-Ls]=Mt(e,255),Vs[t-Ls]=Mt(e+8>>4,15);Ps=1}return 1}function rt(t){var e=t.ma,i=t.U,n=t.T;return ee(!(1&t.ka)),0>=i||0>=n?0:(i=e.Ib(t,e),null!=e.Jb&&e.Jb(t,e,i),e.Dc+=i,1)}function at(t){t.ma.memory=null}function ot(t,e,i,n){return 47!=c(t,8)?0:(e[0]=c(t,14)+1,i[0]=c(t,14)+1,n[0]=c(t,1),0!=c(t,3)?0:!t.h)}function lt(t,e){if(4>t)return t+1;var i=t-2>>1;return(2+(1&t)<<i)+c(e,i)+1}function ht(t,e){return 120<e?e-120:1<=(i=((i=Jn[e-1])>>4)*t+(8-(15&i)))?i:1;var i}function ut(t,e,i){var n=f(i),s=t[e+=255&n].g-8;return 0<s&&(m(i,i.u+8),n=f(i),e+=t[e].value,e+=n&(1<<s)-1),m(i,i.u+t[e].g),t[e].value}function ct(t,e,i){return i.g+=t.g,i.value+=t.value<<e>>>0,ee(8>=i.g),t.g}function dt(t,e,i){var n=t.xc;return ee((e=0==n?0:t.vc[t.md*(i>>n)+(e>>n)])<t.Wb),t.Ya[e]}function _t(t,e,i,n){var s=t.ab,r=t.c*e,a=t.C;e=a+e;var o=i,l=n;for(n=t.Ta,i=t.Ua;0<s--;){var h=t.gc[s],u=a,c=e,d=o,_=l,f=(l=n,o=i,h.Ea);switch(ee(u<c),ee(c<=h.nc),h.hc){case 2:Xi(d,_,(c-u)*f,l,o);break;case 0:var g=u,m=c,p=l,w=o,b=(E=h).Ea;0==g&&(Hi(d,_,null,null,1,p,w),M(d,_+1,0,0,b-1,p,w+1),_+=b,w+=b,++g);for(var T=1<<E.b,S=T-1,y=C(b,E.b),x=E.K,E=E.w+(g>>E.b)*y;g<m;){var v=x,L=E,I=1;for(Ui(d,_,p,w-b,1,p,w);I<b;){var A=(I&~S)+T;A>b&&(A=b),(0,qi[v[L++]>>8&15])(d,_+ +I,p,w+I-b,A-I,p,w+I),I=A}_+=b,w+=b,++g&S||(E+=y)}c!=h.nc&&ne(l,o-f,l,o+(c-u-1)*f,f);break;case 1:for(f=d,m=_,b=(d=h.Ea)-(w=d&~(p=(_=1<<h.b)-1)),g=C(d,h.b),T=h.K,h=h.w+(u>>h.b)*g;u<c;){for(S=T,y=h,x=new D,E=m+w,v=m+d;m<E;)N(S[y++],x),Ji(x,f,m,_,l,o),m+=_,o+=_;m<v&&(N(S[y++],x),Ji(x,f,m,b,l,o),m+=b,o+=b),++u&p||(h+=g)}break;case 3:if(d==l&&_==o&&0<h.b){for(m=l,d=f=o+(c-u)*f-(w=(c-u)*C(h.Ea,h.b)),_=l,p=o,g=[],w=(b=w)-1;0<=w;--w)g[w]=_[p+w];for(w=b-1;0<=w;--w)m[d+w]=g[w];Yi(h,u,c,l,f,l,o)}else Yi(h,u,c,d,_,l,o)}o=n,l=i}l!=i&&ne(n,i,o,l,r)}function ft(t,e){var i=t.V,n=t.Ba+t.c*t.C,s=e-t.C;if(ee(e<=t.l.o),ee(16>=s),0<s){var r=t.l,a=t.Ta,o=t.Ua,l=r.width;if(_t(t,s,i,n),s=o=[o],ee((i=t.C)<(n=e)),ee(r.v<r.va),n>r.o&&(n=r.o),i<r.j){var h=r.j-i;i=r.j;s[0]+=h*l}if(i>=n?i=0:(s[0]+=4*r.v,r.ka=i-r.j,r.U=r.va-r.v,r.T=n-i,i=1),i){if(o=o[0],11>(i=t.ca).S){var u=i.f.RGBA,c=(n=i.S,s=r.U,r=r.T,h=u.eb,u.A),d=r;for(u=u.fb+t.Ma*u.A;0<d--;){var _=a,f=o,g=s,m=h,p=u;switch(n){case Fn:Zi(_,f,g,m,p);break;case Vn:Qi(_,f,g,m,p);break;case $n:Qi(_,f,g,m,p),yn(m,p,0,g,1,0);break;case Mn:nn(_,f,g,m,p);break;case Gn:z(_,f,g,m,p,1);break;case Hn:z(_,f,g,m,p,1),yn(m,p,0,g,1,0);break;case Nn:z(_,f,g,m,p,0);break;case Un:z(_,f,g,m,p,0),yn(m,p,1,g,1,0);break;case Bn:tn(_,f,g,m,p);break;case Xn:tn(_,f,g,m,p),xn(m,p,g,1,0);break;case Wn:en(_,f,g,m,p);break;default:ee(0)}o+=l,u+=c}t.Ma+=r}else alert("todo:EmitRescaledRowsYUVA");ee(t.Ma<=i.height)}}t.C=e,ee(t.C<=t.i)}function gt(t){var e;if(0<t.ua)return 0;for(e=0;e<t.Wb;++e){var i=t.Ya[e].G,n=t.Ya[e].H;if(0<i[1][n[1]+0].g||0<i[2][n[2]+0].g||0<i[3][n[3]+0].g)return 0}return 1}function mt(t,e,i,n,s,r){if(0!=t.Z){var a=t.qd,o=t.rd;for(ee(null!=gs[t.Z]);e<i;++e)gs[t.Z](a,o,n,s,n,s,r),a=n,o=s,s+=r;t.qd=a,t.rd=o}}function pt(t,e){var i=t.l.ma,n=0==i.Z||1==i.Z?t.l.j:t.C;n=t.C<n?n:t.C;if(ee(e<=t.l.o),e>n){var s=t.l.width,r=i.ca,a=i.tb+s*n,o=t.V,l=t.Ba+t.c*n,h=t.gc;ee(1==t.ab),ee(3==h[0].hc),Ki(h[0],n,e,o,l,r,a),mt(i,n,e,r,a,s)}t.C=t.Ma=e}function wt(t,e,i,n,s,r,a){var o=t.$/n,l=t.$%n,h=t.m,u=t.s,c=i+t.$,d=c;s=i+n*s;var _=i+n*r,w=280+u.ua,b=t.Pb?o:16777216,T=0<u.ua?u.Wa:null,S=u.wc,y=c<_?dt(u,l,o):null;ee(t.C<r),ee(_<=s);var x=!1;t:for(;;){for(;x||c<_;){var E=0;if(o>=b){var v=c-i;ee((b=t).Pb),b.wd=b.m,b.xd=v,0<b.s.ua&&L(b.s.Wa,b.s.vb),b=o+Qn}if(l&S||(y=dt(u,l,o)),ee(null!=y),y.Qb&&(e[c]=y.qb,x=!0),!x)if(p(h),y.jc){E=h,v=e;var I=c,A=y.pd[f(E)&Mi-1];ee(y.jc),256>A.g?(m(E,E.u+A.g),v[I]=A.value,E=0):(m(E,E.u+A.g-256),ee(256<=A.value),E=A.value),0==E&&(x=!0)}else E=ut(y.G[0],y.H[0],h);if(h.h)break;if(x||256>E){if(!x)if(y.nd)e[c]=(y.qb|E<<8)>>>0;else{if(p(h),x=ut(y.G[1],y.H[1],h),p(h),v=ut(y.G[2],y.H[2],h),I=ut(y.G[3],y.H[3],h),h.h)break;e[c]=(I<<24|x<<16|E<<8|v)>>>0}if(x=!1,++c,++l>=n&&(l=0,++o,null!=a&&o<=r&&!(o%16)&&a(t,o),null!=T))for(;d<c;)E=e[d++],T.X[(506832829*E&4294967295)>>>T.Mb]=E}else if(280>E){if(E=lt(E-256,h),v=ut(y.G[4],y.H[4],h),p(h),v=ht(n,v=lt(v,h)),h.h)break;if(c-i<v||s-c<E)break t;for(I=0;I<E;++I)e[c+I]=e[c+I-v];for(c+=E,l+=E;l>=n;)l-=n,++o,null!=a&&o<=r&&!(o%16)&&a(t,o);if(ee(c<=s),l&S&&(y=dt(u,l,o)),null!=T)for(;d<c;)E=e[d++],T.X[(506832829*E&4294967295)>>>T.Mb]=E}else{if(!(E<w))break t;for(x=E-280,ee(null!=T);d<c;)E=e[d++],T.X[(506832829*E&4294967295)>>>T.Mb]=E;E=c,ee(!(x>>>(v=T).Xa)),e[E]=v.X[x],x=!0}x||ee(h.h==g(h))}if(t.Pb&&h.h&&c<s)ee(t.m.h),t.a=5,t.m=t.wd,t.$=t.xd,0<t.s.ua&&L(t.s.vb,t.s.Wa);else{if(h.h)break t;null!=a&&a(t,o>r?r:o),t.a=0,t.$=c-i}return 1}return t.a=3,0}function bt(t){ee(null!=t),t.vc=null,t.yc=null,t.Ya=null;var e=t.Wa;null!=e&&(e.X=null),t.vb=null,ee(null!=t)}function Tt(){var t=new ri;return null==t?null:(t.a=0,t.xb=fs,K("Predictor","VP8LPredictors"),K("Predictor","VP8LPredictors_C"),K("PredictorAdd","VP8LPredictorsAdd"),K("PredictorAdd","VP8LPredictorsAdd_C"),Xi=G,Ji=B,Zi=$,Qi=H,tn=U,en=X,nn=Y,self.VP8LMapColor32b=zi,self.VP8LMapColor8b=ji,t)}function St(t,e,s,a,o){var l=1,h=[t],u=[e],d=a.m,_=a.s,g=null,w=0;t:for(;;){if(s)for(;l&&c(d,1);){var b=h,T=u,S=a,y=1,x=S.m,E=S.gc[S.ab],L=c(x,2);if(S.Oc&1<<L)l=0;else{switch(S.Oc|=1<<L,E.hc=L,E.Ea=b[0],E.nc=T[0],E.K=[null],++S.ab,ee(4>=S.ab),L){case 0:case 1:E.b=c(x,3)+2,y=St(C(E.Ea,E.b),C(E.nc,E.b),0,S,E.K),E.K=E.K[0];break;case 3:var I,A=c(x,8)+1,R=16<A?0:4<A?1:2<A?2:3;if(b[0]=C(E.Ea,R),E.b=R,I=y=St(A,1,0,S,E.K)){var D,O=A,k=E,F=1<<(8>>k.b),V=re(F);if(null==V)I=0;else{var M=k.K[0],G=k.w;for(V[0]=k.K[0][0],D=1;D<1*O;++D)V[D]=P(M[G+D],V[D-1]);for(;D<4*F;++D)V[D]=0;k.K[0]=null,k.K[0]=V,I=1}}y=I;break;case 2:break;default:ee(0)}l=y}}if(h=h[0],u=u[0],l&&c(d,1)&&!(l=1<=(w=c(d,4))&&11>=w)){a.a=3;break t}var N;if(N=l)e:{var B,W,$,H=a,U=h,X=u,Y=w,z=s,K=H.m,j=H.s,q=[null],J=1,Z=0,Q=Zn[Y];i:for(;;){if(z&&c(K,1)){var tt=c(K,3)+2,et=C(U,tt),it=C(X,tt),nt=et*it;if(!St(et,it,0,H,q))break i;for(q=q[0],j.xc=tt,B=0;B<nt;++B){var st=q[B]>>8&65535;q[B]=st,st>=J&&(J=st+1)}}if(K.h)break i;for(W=0;5>W;++W){var rt=Kn[W];!W&&0<Y&&(rt+=1<<Y),Z<rt&&(Z=rt)}var at=ae(J*Q,n),ot=J,lt=ae(ot,r);if(null==lt)var ht=null;else ee(65536>=ot),ht=lt;var ut=re(Z);if(null==ht||null==ut||null==at){H.a=1;break i}var dt=at;for(B=$=0;B<J;++B){var _t=ht[B],ft=_t.G,gt=_t.H,mt=0,pt=1,Tt=0;for(W=0;5>W;++W){rt=Kn[W],ft[W]=dt,gt[W]=$,!W&&0<Y&&(rt+=1<<Y);n:{var yt,xt=rt,Et=H,vt=ut,Lt=dt,It=$,At=0,Ct=Et.m,Pt=c(Ct,1);if(se(vt,0,0,xt),Pt){var Rt=c(Ct,1)+1,Dt=c(Ct,1),Ot=c(Ct,0==Dt?1:8);vt[Ot]=1,2==Rt&&(vt[Ot=c(Ct,8)]=1);var kt=1}else{var Ft=re(19),Vt=c(Ct,4)+4;if(19<Vt){Et.a=3;var Mt=0;break n}for(yt=0;yt<Vt;++yt)Ft[qn[yt]]=c(Ct,3);var Gt=void 0,Nt=void 0,Bt=Et,Wt=Ft,$t=xt,Ht=vt,Ut=0,Xt=Bt.m,Yt=8,zt=ae(128,n);s:for(;i(zt,0,7,Wt,19);){if(c(Xt,1)){var Kt=2+2*c(Xt,3);if((Gt=2+c(Xt,Kt))>$t)break s}else Gt=$t;for(Nt=0;Nt<$t&&Gt--;){p(Xt);var jt=zt[0+(127&f(Xt))];m(Xt,Xt.u+jt.g);var qt=jt.value;if(16>qt)Ht[Nt++]=qt,0!=qt&&(Yt=qt);else{var Jt=16==qt,Zt=qt-16,Qt=zn[Zt],te=c(Xt,Yn[Zt])+Qt;if(Nt+te>$t)break s;for(var ie=Jt?Yt:0;0<te--;)Ht[Nt++]=ie}}Ut=1;break s}Ut||(Bt.a=3),kt=Ut}(kt=kt&&!Ct.h)&&(At=i(Lt,It,8,vt,xt)),kt&&0!=At?Mt=At:(Et.a=3,Mt=0)}if(0==Mt)break i;if(pt&&1==jn[W]&&(pt=0==dt[$].g),mt+=dt[$].g,$+=Mt,3>=W){var ne,oe=ut[0];for(ne=1;ne<rt;++ne)ut[ne]>oe&&(oe=ut[ne]);Tt+=oe}}if(_t.nd=pt,_t.Qb=0,pt&&(_t.qb=(ft[3][gt[3]+0].value<<24|ft[1][gt[1]+0].value<<16|ft[2][gt[2]+0].value)>>>0,0==mt&&256>ft[0][gt[0]+0].value&&(_t.Qb=1,_t.qb+=ft[0][gt[0]+0].value<<8)),_t.jc=!_t.Qb&&6>Tt,_t.jc){var le,he=_t;for(le=0;le<Mi;++le){var ue=le,ce=he.pd[ue],de=he.G[0][he.H[0]+ue];256<=de.value?(ce.g=de.g+256,ce.value=de.value):(ce.g=0,ce.value=0,ue>>=ct(de,8,ce),ue>>=ct(he.G[1][he.H[1]+ue],16,ce),ue>>=ct(he.G[2][he.H[2]+ue],0,ce),ct(he.G[3][he.H[3]+ue],24,ce))}}}j.vc=q,j.Wb=J,j.Ya=ht,j.yc=at,N=1;break e}N=0}if(!(l=N)){a.a=3;break t}if(0<w){if(_.ua=1<<w,!v(_.Wa,w)){a.a=1,l=0;break t}}else _.ua=0;var _e=a,fe=h,ge=u,me=_e.s,pe=me.xc;if(_e.c=fe,_e.i=ge,me.md=C(fe,pe),me.wc=0==pe?-1:(1<<pe)-1,s){a.xb=_s;break t}if(null==(g=re(h*u))){a.a=1,l=0;break t}l=(l=wt(a,g,0,h,u,u,null))&&!d.h;break t}return l?(null!=o?o[0]=g:(ee(null==g),ee(s)),a.$=0,s||bt(_)):bt(_),l}function yt(t,e){var i=t.c*t.i,n=i+e+16*e;return ee(t.c<=e),t.V=re(n),null==t.V?(t.Ta=null,t.Ua=0,t.a=1,0):(t.Ta=t.V,t.Ua=t.Ba+i+e,1)}function xt(t,e){var i=t.C,n=e-i,s=t.V,r=t.Ba+t.c*i;for(ee(e<=t.l.o);0<n;){var a=16<n?16:n,o=t.l.ma,l=t.l.width,h=l*a,u=o.ca,c=o.tb+l*i,d=t.Ta,_=t.Ua;_t(t,a,s,r),vn(d,_,u,c,h),mt(o,i,i+a,u,c,l),n-=a,s+=a*t.c,i+=a}ee(i==e),t.C=t.Ma=e}function Et(){this.ub=this.yd=this.td=this.Rb=0}function vt(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Lt(){this.Fb=this.Bb=this.Cb=0,this.Zb=re(4),this.Lb=re(4)}function It(){this.Yb=function(){var t=[];return function t(e,i,n){for(var s=n[i],r=0;r<s&&(e.push(n.length>i+1?[]:0),!(n.length<i+1));r++)t(e[r],i+1,n)}(t,0,[3,11]),t}()}function At(){this.jb=re(3),this.Wc=oe([4,8],It),this.Xc=oe([4,17],It)}function Ct(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new re(4),this.od=new re(4)}function Pt(){this.ld=this.La=this.dd=this.tc=0}function Rt(){this.Na=this.la=0}function Dt(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Ot(){this.ad=re(384),this.Za=0,this.Ob=re(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function kt(){this.uc=this.M=this.Nb=0,this.wa=Array(new Pt),this.Y=0,this.ya=Array(new Ot),this.aa=0,this.l=new Gt}function Ft(){this.y=re(16),this.f=re(8),this.ea=re(8)}function Vt(){this.cb=this.a=0,this.sc="",this.m=new d,this.Od=new Et,this.Kc=new vt,this.ed=new Ct,this.Qa=new Lt,this.Ic=this.$c=this.Aa=0,this.D=new kt,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=ae(8,d),this.ia=0,this.pb=ae(4,Dt),this.Pa=new At,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Ft),this.Hd=0,this.rb=Array(new Rt),this.sb=0,this.wa=Array(new Pt),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new Ot),this.L=this.aa=0,this.gd=oe([4,2],Pt),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function Mt(t,e){return 0>t?0:t>e?e:t}function Gt(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function Nt(){var t=new Vt;return null!=t&&(t.a=0,t.sc="OK",t.cb=0,t.Xb=0,is||(is=Ht)),t}function Bt(t,e,i){return 0==t.a&&(t.a=e,t.sc=i,t.cb=0),0}function Wt(t,e,i){return 3<=i&&157==t[e+0]&&1==t[e+1]&&42==t[e+2]}function $t(t,e){if(null==t)return 0;if(t.a=0,t.sc="OK",null==e)return Bt(t,2,"null VP8Io passed to VP8GetHeaders()");var i=e.data,n=e.w,s=e.ha;if(4>s)return Bt(t,7,"Truncated header.");var r=i[n+0]|i[n+1]<<8|i[n+2]<<16,h=t.Od;if(h.Rb=!(1&r),h.td=r>>1&7,h.yd=r>>4&1,h.ub=r>>5,3<h.td)return Bt(t,3,"Incorrect keyframe parameters.");if(!h.yd)return Bt(t,4,"Frame not displayable.");n+=3,s-=3;var u=t.Kc;if(h.Rb){if(7>s)return Bt(t,7,"cannot parse picture header");if(!Wt(i,n,s))return Bt(t,3,"Bad code word");u.c=16383&(i[n+4]<<8|i[n+3]),u.Td=i[n+4]>>6,u.i=16383&(i[n+6]<<8|i[n+5]),u.Ud=i[n+6]>>6,n+=7,s-=7,t.za=u.c+15>>4,t.Ub=u.i+15>>4,e.width=u.c,e.height=u.i,e.Da=0,e.j=0,e.v=0,e.va=e.width,e.o=e.height,e.da=0,e.ib=e.width,e.hb=e.height,e.U=e.width,e.T=e.height,se((r=t.Pa).jb,0,255,r.jb.length),ee(null!=(r=t.Qa)),r.Cb=0,r.Bb=0,r.Fb=1,se(r.Zb,0,0,r.Zb.length),se(r.Lb,0,0,r.Lb)}if(h.ub>s)return Bt(t,7,"bad partition length");a(r=t.m,i,n,h.ub),n+=h.ub,s-=h.ub,h.Rb&&(u.Ld=b(r),u.Kd=b(r)),u=t.Qa;var c,d=t.Pa;if(ee(null!=r),ee(null!=u),u.Cb=b(r),u.Cb){if(u.Bb=b(r),b(r)){for(u.Fb=b(r),c=0;4>c;++c)u.Zb[c]=b(r)?l(r,7):0;for(c=0;4>c;++c)u.Lb[c]=b(r)?l(r,6):0}if(u.Bb)for(c=0;3>c;++c)d.jb[c]=b(r)?o(r,8):255}else u.Bb=0;if(r.Ka)return Bt(t,3,"cannot parse segment header");if((u=t.ed).zd=b(r),u.Tb=o(r,6),u.wb=o(r,3),u.Pc=b(r),u.Pc&&b(r)){for(d=0;4>d;++d)b(r)&&(u.vd[d]=l(r,6));for(d=0;4>d;++d)b(r)&&(u.od[d]=l(r,6))}if(t.L=0==u.Tb?0:u.zd?1:2,r.Ka)return Bt(t,3,"cannot parse filter header");var _=s;if(s=c=n,n=c+_,u=_,t.Xb=(1<<o(t.m,2))-1,_<3*(d=t.Xb))i=7;else{for(c+=3*d,u-=3*d,_=0;_<d;++_){var f=i[s+0]|i[s+1]<<8|i[s+2]<<16;f>u&&(f=u),a(t.Jc[+_],i,c,f),c+=f,u-=f,s+=3}a(t.Jc[+d],i,c,u),i=c<n?0:5}if(0!=i)return Bt(t,i,"cannot parse partitions");for(i=o(c=t.m,7),s=b(c)?l(c,4):0,n=b(c)?l(c,4):0,u=b(c)?l(c,4):0,d=b(c)?l(c,4):0,c=b(c)?l(c,4):0,_=t.Qa,f=0;4>f;++f){if(_.Cb){var g=_.Zb[f];_.Fb||(g+=i)}else{if(0<f){t.pb[f]=t.pb[0];continue}g=i}var m=t.pb[f];m.Sc[0]=ts[Mt(g+s,127)],m.Sc[1]=es[Mt(g+0,127)],m.Eb[0]=2*ts[Mt(g+n,127)],m.Eb[1]=101581*es[Mt(g+u,127)]>>16,8>m.Eb[1]&&(m.Eb[1]=8),m.Qc[0]=ts[Mt(g+d,117)],m.Qc[1]=es[Mt(g+c,127)],m.lc=g+c}if(!h.Rb)return Bt(t,4,"Not a key frame.");for(b(r),h=t.Pa,i=0;4>i;++i){for(s=0;8>s;++s)for(n=0;3>n;++n)for(u=0;11>u;++u)d=T(r,ls[i][s][n][u])?o(r,8):as[i][s][n][u],h.Wc[i][s].Yb[n][u]=d;for(s=0;17>s;++s)h.Xc[i][s]=h.Wc[i][hs[s]]}return t.kc=b(r),t.kc&&(t.Bd=o(r,8)),t.cb=1}function Ht(t,e,i,n,s,r,a){var o=e[s].Yb[i];for(i=0;16>s;++s){if(!T(t,o[i+0]))return s;for(;!T(t,o[i+1]);)if(o=e[++s].Yb[0],i=0,16==s)return 16;var l=e[s+1].Yb;if(T(t,o[i+2])){var h=t,u=0;if(T(h,(d=o)[(c=i)+3]))if(T(h,d[c+6])){for(o=0,c=2*(u=T(h,d[c+8]))+(d=T(h,d[c+9+u])),u=0,d=ns[c];d[o];++o)u+=u+T(h,d[o]);u+=3+(8<<c)}else T(h,d[c+7])?(u=7+2*T(h,165),u+=T(h,145)):u=5+T(h,159);else u=T(h,d[c+4])?3+T(h,d[c+5]):2;o=l[2]}else u=1,o=l[1];l=a+ss[s],0>(h=t).b&&w(h);var c,d=h.b,_=(c=h.Ca>>1)-(h.I>>d)>>31;--h.b,h.Ca+=_,h.Ca|=1,h.I-=(c+1&_)<<d,r[l]=((u^_)-_)*n[(0<s)+0]}return 16}function Ut(t){var e=t.rb[t.sb-1];e.la=0,e.Na=0,se(t.zc,0,0,t.zc.length),t.ja=0}function Xt(t,e){if(null==t)return 0;if(null==e)return Bt(t,2,"NULL VP8Io parameter in VP8Decode().");if(!t.cb&&!$t(t,e))return 0;if(ee(t.cb),null==e.ac||e.ac(e)){e.ob&&(t.L=0);var i=Gs[t.L];if(2==t.L?(t.yb=0,t.zb=0):(t.yb=e.v-i>>4,t.zb=e.j-i>>4,0>t.yb&&(t.yb=0),0>t.zb&&(t.zb=0)),t.Va=e.o+15+i>>4,t.Hb=e.va+15+i>>4,t.Hb>t.za&&(t.Hb=t.za),t.Va>t.Ub&&(t.Va=t.Ub),0<t.L){var n=t.ed;for(i=0;4>i;++i){var s;if(t.Qa.Cb){var r=t.Qa.Lb[i];t.Qa.Fb||(r+=n.Tb)}else r=n.Tb;for(s=0;1>=s;++s){var a=t.gd[i][s],o=r;if(n.Pc&&(o+=n.vd[0],s&&(o+=n.od[0])),0<(o=0>o?0:63<o?63:o)){var l=o;0<n.wb&&((l=4<n.wb?l>>2:l>>1)>9-n.wb&&(l=9-n.wb)),1>l&&(l=1),a.dd=l,a.tc=2*o+l,a.ld=40<=o?2:15<=o?1:0}else a.tc=0;a.La=s}}}i=0}else Bt(t,6,"Frame setup failed"),i=t.a;if(i=0==i){if(i){t.$c=0,0<t.Aa||(t.Ic=Bs);t:{i=t.Ic;n=4*(l=t.za);var h=32*l,u=l+1,c=0<t.L?l*(0<t.Aa?2:1):0,d=(2==t.Aa?2:1)*l;if((a=n+832+(s=3*(16*i+Gs[t.L])/2*h)+(r=null!=t.Fa&&0<t.Fa.length?t.Kc.c*t.Kc.i:0))!=a)i=0;else{if(a>t.Vb){if(t.Vb=0,t.Ec=re(a),t.Fc=0,null==t.Ec){i=Bt(t,1,"no memory during frame initialization.");break t}t.Vb=a}a=t.Ec,o=t.Fc,t.Ac=a,t.Bc=o,o+=n,t.Gd=ae(h,Ft),t.Hd=0,t.rb=ae(u+1,Rt),t.sb=1,t.wa=c?ae(c,Pt):null,t.Y=0,t.D.Nb=0,t.D.wa=t.wa,t.D.Y=t.Y,0<t.Aa&&(t.D.Y+=l),ee(!0),t.oc=a,t.pc=o,o+=832,t.ya=ae(d,Ot),t.aa=0,t.D.ya=t.ya,t.D.aa=t.aa,2==t.Aa&&(t.D.aa+=l),t.R=16*l,t.B=8*l,l=(h=Gs[t.L])*t.R,h=h/2*t.B,t.sa=a,t.ta=o+l,t.qa=t.sa,t.ra=t.ta+16*i*t.R+h,t.Ha=t.qa,t.Ia=t.ra+8*i*t.B+h,t.$c=0,o+=s,t.mb=r?a:null,t.nb=r?o:null,ee(o+r<=t.Fc+t.Vb),Ut(t),se(t.Ac,t.Bc,0,n),i=1}}if(i){if(e.ka=0,e.y=t.sa,e.O=t.ta,e.f=t.qa,e.N=t.ra,e.ea=t.Ha,e.Vd=t.Ia,e.fa=t.R,e.Rc=t.B,e.F=null,e.J=0,!Pn){for(i=-255;255>=i;++i)Ln[255+i]=0>i?-i:i;for(i=-1020;1020>=i;++i)In[1020+i]=-128>i?-128:127<i?127:i;for(i=-112;112>=i;++i)An[112+i]=-16>i?-16:15<i?15:i;for(i=-255;510>=i;++i)Cn[255+i]=0>i?0:255<i?255:i;Pn=1}sn=le,rn=Jt,on=Zt,ln=Qt,hn=te,an=qt,un=ze,cn=Ke,dn=Je,_n=Ze,fn=je,gn=qe,mn=Qe,pn=ti,wn=We,bn=$e,Tn=He,Sn=Ue,cs[0]=xe,cs[1]=ue,cs[2]=Se,cs[3]=ye,cs[4]=Ee,cs[5]=Le,cs[6]=ve,cs[7]=Ie,cs[8]=Ce,cs[9]=Ae,us[0]=me,us[1]=de,us[2]=_e,us[3]=fe,us[4]=pe,us[5]=we,us[6]=be,ds[0]=Oe,ds[1]=ce,ds[2]=Pe,ds[3]=Re,ds[4]=Fe,ds[5]=ke,ds[6]=Ve,i=1}else i=0}i&&(i=function(t,e){for(t.M=0;t.M<t.Va;++t.M){var i,n=t.Jc[t.M&t.Xb],s=t.m,r=t;for(i=0;i<r.za;++i){var a=s,o=r,l=o.Ac,h=o.Bc+4*i,u=o.zc,c=o.ya[o.aa+i];if(o.Qa.Bb?c.$b=T(a,o.Pa.jb[0])?2+T(a,o.Pa.jb[2]):T(a,o.Pa.jb[1]):c.$b=0,o.kc&&(c.Ad=T(a,o.Bd)),c.Za=!T(a,145)+0,c.Za){var d=c.Ob,_=0;for(o=0;4>o;++o){var f,g=u[0+o];for(f=0;4>f;++f){g=os[l[h+f]][g];for(var m=rs[T(a,g[0])];0<m;)m=rs[2*m+T(a,g[m])];g=-m,l[h+f]=g}ne(d,_,l,h,4),_+=4,u[0+o]=g}}else g=T(a,156)?T(a,128)?1:3:T(a,163)?2:0,c.Ob[0]=g,se(l,h,g,4),se(u,0,g,4);c.Dd=T(a,142)?T(a,114)?T(a,183)?1:3:2:0}if(r.m.Ka)return Bt(t,7,"Premature end-of-partition0 encountered.");for(;t.ja<t.za;++t.ja){if(r=n,a=(s=t).rb[s.sb-1],l=s.rb[s.sb+s.ja],i=s.ya[s.aa+s.ja],h=s.kc?i.Ad:0)a.la=l.la=0,i.Za||(a.Na=l.Na=0),i.Hc=0,i.Gc=0,i.ia=0;else{var p,w;if(a=l,l=r,h=s.Pa.Xc,u=s.ya[s.aa+s.ja],c=s.pb[u.$b],o=u.ad,d=0,_=s.rb[s.sb-1],g=f=0,se(o,d,0,384),u.Za)var b=0,S=h[3];else{m=re(16);var y=a.Na+_.Na;if(y=is(l,h[1],y,c.Eb,0,m,0),a.Na=_.Na=(0<y)+0,1<y)sn(m,0,o,d);else{var x=m[0]+3>>3;for(m=0;256>m;m+=16)o[d+m]=x}b=1,S=h[0]}var E=15&a.la,v=15&_.la;for(m=0;4>m;++m){var L=1&v;for(x=w=0;4>x;++x)E=E>>1|(L=(y=is(l,S,y=L+(1&E),c.Sc,b,o,d))>b)<<7,w=w<<2|(3<y?3:1<y?2:0!=o[d+0]),d+=16;E>>=4,v=v>>1|L<<7,f=(f<<8|w)>>>0}for(S=E,b=v>>4,p=0;4>p;p+=2){for(w=0,E=a.la>>4+p,v=_.la>>4+p,m=0;2>m;++m){for(L=1&v,x=0;2>x;++x)y=L+(1&E),E=E>>1|(L=0<(y=is(l,h[2],y,c.Qc,0,o,d)))<<3,w=w<<2|(3<y?3:1<y?2:0!=o[d+0]),d+=16;E>>=2,v=v>>1|L<<5}g|=w<<4*p,S|=E<<4<<p,b|=(240&v)<<p}a.la=S,_.la=b,u.Hc=f,u.Gc=g,u.ia=43690&g?0:c.ia,h=!(f|g)}if(0<s.L&&(s.wa[s.Y+s.ja]=s.gd[i.$b][i.Za],s.wa[s.Y+s.ja].La|=!h),r.Ka)return Bt(t,7,"Premature end-of-file encountered.")}if(Ut(t),s=e,r=1,i=(n=t).D,a=0<n.L&&n.M>=n.zb&&n.M<=n.Va,0==n.Aa)t:{if(i.M=n.M,i.uc=a,Di(n,i),r=1,i=(w=n.D).Nb,a=(g=Gs[n.L])*n.R,l=g/2*n.B,m=16*i*n.R,x=8*i*n.B,h=n.sa,u=n.ta-a+m,c=n.qa,o=n.ra-l+x,d=n.Ha,_=n.Ia-l+x,v=0==(E=w.M),f=E>=n.Va-1,2==n.Aa&&Di(n,w),w.uc)for(L=(y=n).D.M,ee(y.D.uc),w=y.yb;w<y.Hb;++w){b=w,S=L;var I=(A=(M=y).D).Nb;p=M.R;var A=A.wa[A.Y+b],C=M.sa,P=M.ta+16*I*p+16*b,R=A.dd,D=A.tc;if(0!=D)if(ee(3<=D),1==M.L)0<b&&bn(C,P,p,D+4),A.La&&Sn(C,P,p,D),0<S&&wn(C,P,p,D+4),A.La&&Tn(C,P,p,D);else{var O=M.B,k=M.qa,F=M.ra+8*I*O+8*b,V=M.Ha,M=M.Ia+8*I*O+8*b;I=A.ld,0<b&&(cn(C,P,p,D+4,R,I),_n(k,F,V,M,O,D+4,R,I)),A.La&&(gn(C,P,p,D,R,I),pn(k,F,V,M,O,D,R,I)),0<S&&(un(C,P,p,D+4,R,I),dn(k,F,V,M,O,D+4,R,I)),A.La&&(fn(C,P,p,D,R,I),mn(k,F,V,M,O,D,R,I))}}if(n.ia&&alert("todo:DitherRow"),null!=s.put){if(w=16*E,E=16*(E+1),v?(s.y=n.sa,s.O=n.ta+m,s.f=n.qa,s.N=n.ra+x,s.ea=n.Ha,s.W=n.Ia+x):(w-=g,s.y=h,s.O=u,s.f=c,s.N=o,s.ea=d,s.W=_),f||(E-=g),E>s.o&&(E=s.o),s.F=null,s.J=null,null!=n.Fa&&0<n.Fa.length&&w<E&&(s.J=ui(n,s,w,E-w),s.F=n.mb,null==s.F&&0==s.F.length)){r=Bt(n,3,"Could not decode alpha data.");break t}w<s.j&&(g=s.j-w,w=s.j,ee(!(1&g)),s.O+=n.R*g,s.N+=n.B*(g>>1),s.W+=n.B*(g>>1),null!=s.F&&(s.J+=s.width*g)),w<E&&(s.O+=s.v,s.N+=s.v>>1,s.W+=s.v>>1,null!=s.F&&(s.J+=s.v),s.ka=w-s.j,s.U=s.va-s.v,s.T=E-w,r=s.put(s))}i+1!=n.Ic||f||(ne(n.sa,n.ta-a,h,u+16*n.R,a),ne(n.qa,n.ra-l,c,o+8*n.B,l),ne(n.Ha,n.Ia-l,d,_+8*n.B,l))}if(!r)return Bt(t,6,"Output aborted.")}return 1}(t,e)),null!=e.bc&&e.bc(e),i&=1}return i?(t.cb=0,i):0}function Yt(t,e,i,n,s){s=t[e+i+32*n]+(s>>3),t[e+i+32*n]=-256&s?0>s?0:255:s}function zt(t,e,i,n,s,r){Yt(t,e,0,i,n+s),Yt(t,e,1,i,n+r),Yt(t,e,2,i,n-r),Yt(t,e,3,i,n-s)}function Kt(t){return(20091*t>>16)+t}function jt(t,e,i,n){var s,r=0,a=re(16);for(s=0;4>s;++s){var o=t[e+0]+t[e+8],l=t[e+0]-t[e+8],h=(35468*t[e+4]>>16)-Kt(t[e+12]),u=Kt(t[e+4])+(35468*t[e+12]>>16);a[r+0]=o+u,a[r+1]=l+h,a[r+2]=l-h,a[r+3]=o-u,r+=4,e++}for(s=r=0;4>s;++s)o=(t=a[r+0]+4)+a[r+8],l=t-a[r+8],h=(35468*a[r+4]>>16)-Kt(a[r+12]),Yt(i,n,0,0,o+(u=Kt(a[r+4])+(35468*a[r+12]>>16))),Yt(i,n,1,0,l+h),Yt(i,n,2,0,l-h),Yt(i,n,3,0,o-u),r++,n+=32}function qt(t,e,i,n){var s=t[e+0]+4,r=35468*t[e+4]>>16,a=Kt(t[e+4]),o=35468*t[e+1]>>16;zt(i,n,0,s+a,t=Kt(t[e+1]),o),zt(i,n,1,s+r,t,o),zt(i,n,2,s-r,t,o),zt(i,n,3,s-a,t,o)}function Jt(t,e,i,n,s){jt(t,e,i,n),s&&jt(t,e+16,i,n+4)}function Zt(t,e,i,n){rn(t,e+0,i,n,1),rn(t,e+32,i,n+128,1)}function Qt(t,e,i,n){var s;for(t=t[e+0]+4,s=0;4>s;++s)for(e=0;4>e;++e)Yt(i,n,e,s,t)}function te(t,e,i,n){t[e+0]&&ln(t,e+0,i,n),t[e+16]&&ln(t,e+16,i,n+4),t[e+32]&&ln(t,e+32,i,n+128),t[e+48]&&ln(t,e+48,i,n+128+4)}function le(t,e,i,n){var s,r=re(16);for(s=0;4>s;++s){var a=t[e+0+s]+t[e+12+s],o=t[e+4+s]+t[e+8+s],l=t[e+4+s]-t[e+8+s],h=t[e+0+s]-t[e+12+s];r[0+s]=a+o,r[8+s]=a-o,r[4+s]=h+l,r[12+s]=h-l}for(s=0;4>s;++s)a=(t=r[0+4*s]+3)+r[3+4*s],o=r[1+4*s]+r[2+4*s],l=r[1+4*s]-r[2+4*s],h=t-r[3+4*s],i[n+0]=a+o>>3,i[n+16]=h+l>>3,i[n+32]=a-o>>3,i[n+48]=h-l>>3,n+=64}function he(t,e,i){var n,s=e-32,r=On,a=255-t[s-1];for(n=0;n<i;++n){var o,l=r,h=a+t[e-1];for(o=0;o<i;++o)t[e+o]=l[h+t[s+o]];e+=32}}function ue(t,e){he(t,e,4)}function ce(t,e){he(t,e,8)}function de(t,e){he(t,e,16)}function _e(t,e){var i;for(i=0;16>i;++i)ne(t,e+32*i,t,e-32,16)}function fe(t,e){var i;for(i=16;0<i;--i)se(t,e,t[e-1],16),e+=32}function ge(t,e,i){var n;for(n=0;16>n;++n)se(e,i+32*n,t,16)}function me(t,e){var i,n=16;for(i=0;16>i;++i)n+=t[e-1+32*i]+t[e+i-32];ge(n>>5,t,e)}function pe(t,e){var i,n=8;for(i=0;16>i;++i)n+=t[e-1+32*i];ge(n>>4,t,e)}function we(t,e){var i,n=8;for(i=0;16>i;++i)n+=t[e+i-32];ge(n>>4,t,e)}function be(t,e){ge(128,t,e)}function Te(t,e,i){return t+2*e+i+2>>2}function Se(t,e){var i,n=e-32;n=new Uint8Array([Te(t[n-1],t[n+0],t[n+1]),Te(t[n+0],t[n+1],t[n+2]),Te(t[n+1],t[n+2],t[n+3]),Te(t[n+2],t[n+3],t[n+4])]);for(i=0;4>i;++i)ne(t,e+32*i,n,0,n.length)}function ye(t,e){var i=t[e-1],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96];S(t,e+0,16843009*Te(t[e-1-32],i,n)),S(t,e+32,16843009*Te(i,n,s)),S(t,e+64,16843009*Te(n,s,r)),S(t,e+96,16843009*Te(s,r,r))}function xe(t,e){var i,n=4;for(i=0;4>i;++i)n+=t[e+i-32]+t[e-1+32*i];for(n>>=3,i=0;4>i;++i)se(t,e+32*i,n,4)}function Ee(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1-32],a=t[e+0-32],o=t[e+1-32],l=t[e+2-32],h=t[e+3-32];t[e+0+96]=Te(n,s,t[e-1+96]),t[e+1+96]=t[e+0+64]=Te(i,n,s),t[e+2+96]=t[e+1+64]=t[e+0+32]=Te(r,i,n),t[e+3+96]=t[e+2+64]=t[e+1+32]=t[e+0+0]=Te(a,r,i),t[e+3+64]=t[e+2+32]=t[e+1+0]=Te(o,a,r),t[e+3+32]=t[e+2+0]=Te(l,o,a),t[e+3+0]=Te(h,l,o)}function ve(t,e){var i=t[e+1-32],n=t[e+2-32],s=t[e+3-32],r=t[e+4-32],a=t[e+5-32],o=t[e+6-32],l=t[e+7-32];t[e+0+0]=Te(t[e+0-32],i,n),t[e+1+0]=t[e+0+32]=Te(i,n,s),t[e+2+0]=t[e+1+32]=t[e+0+64]=Te(n,s,r),t[e+3+0]=t[e+2+32]=t[e+1+64]=t[e+0+96]=Te(s,r,a),t[e+3+32]=t[e+2+64]=t[e+1+96]=Te(r,a,o),t[e+3+64]=t[e+2+96]=Te(a,o,l),t[e+3+96]=Te(o,l,l)}function Le(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1-32],a=t[e+0-32],o=t[e+1-32],l=t[e+2-32],h=t[e+3-32];t[e+0+0]=t[e+1+64]=r+a+1>>1,t[e+1+0]=t[e+2+64]=a+o+1>>1,t[e+2+0]=t[e+3+64]=o+l+1>>1,t[e+3+0]=l+h+1>>1,t[e+0+96]=Te(s,n,i),t[e+0+64]=Te(n,i,r),t[e+0+32]=t[e+1+96]=Te(i,r,a),t[e+1+32]=t[e+2+96]=Te(r,a,o),t[e+2+32]=t[e+3+96]=Te(a,o,l),t[e+3+32]=Te(o,l,h)}function Ie(t,e){var i=t[e+0-32],n=t[e+1-32],s=t[e+2-32],r=t[e+3-32],a=t[e+4-32],o=t[e+5-32],l=t[e+6-32],h=t[e+7-32];t[e+0+0]=i+n+1>>1,t[e+1+0]=t[e+0+64]=n+s+1>>1,t[e+2+0]=t[e+1+64]=s+r+1>>1,t[e+3+0]=t[e+2+64]=r+a+1>>1,t[e+0+32]=Te(i,n,s),t[e+1+32]=t[e+0+96]=Te(n,s,r),t[e+2+32]=t[e+1+96]=Te(s,r,a),t[e+3+32]=t[e+2+96]=Te(r,a,o),t[e+3+64]=Te(a,o,l),t[e+3+96]=Te(o,l,h)}function Ae(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96];t[e+0+0]=i+n+1>>1,t[e+2+0]=t[e+0+32]=n+s+1>>1,t[e+2+32]=t[e+0+64]=s+r+1>>1,t[e+1+0]=Te(i,n,s),t[e+3+0]=t[e+1+32]=Te(n,s,r),t[e+3+32]=t[e+1+64]=Te(s,r,r),t[e+3+64]=t[e+2+64]=t[e+0+96]=t[e+1+96]=t[e+2+96]=t[e+3+96]=r}function Ce(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96],a=t[e-1-32],o=t[e+0-32],l=t[e+1-32],h=t[e+2-32];t[e+0+0]=t[e+2+32]=i+a+1>>1,t[e+0+32]=t[e+2+64]=n+i+1>>1,t[e+0+64]=t[e+2+96]=s+n+1>>1,t[e+0+96]=r+s+1>>1,t[e+3+0]=Te(o,l,h),t[e+2+0]=Te(a,o,l),t[e+1+0]=t[e+3+32]=Te(i,a,o),t[e+1+32]=t[e+3+64]=Te(n,i,a),t[e+1+64]=t[e+3+96]=Te(s,n,i),t[e+1+96]=Te(r,s,n)}function Pe(t,e){var i;for(i=0;8>i;++i)ne(t,e+32*i,t,e-32,8)}function Re(t,e){var i;for(i=0;8>i;++i)se(t,e,t[e-1],8),e+=32}function De(t,e,i){var n;for(n=0;8>n;++n)se(e,i+32*n,t,8)}function Oe(t,e){var i,n=8;for(i=0;8>i;++i)n+=t[e+i-32]+t[e-1+32*i];De(n>>4,t,e)}function ke(t,e){var i,n=4;for(i=0;8>i;++i)n+=t[e+i-32];De(n>>3,t,e)}function Fe(t,e){var i,n=4;for(i=0;8>i;++i)n+=t[e-1+32*i];De(n>>3,t,e)}function Ve(t,e){De(128,t,e)}function Me(t,e,i){var n=t[e-i],s=t[e+0],r=3*(s-n)+Rn[1020+t[e-2*i]-t[e+i]],a=Dn[112+(r+4>>3)];t[e-i]=On[255+n+Dn[112+(r+3>>3)]],t[e+0]=On[255+s-a]}function Ge(t,e,i,n){var s=t[e+0],r=t[e+i];return kn[255+t[e-2*i]-t[e-i]]>n||kn[255+r-s]>n}function Ne(t,e,i,n){return 4*kn[255+t[e-i]-t[e+0]]+kn[255+t[e-2*i]-t[e+i]]<=n}function Be(t,e,i,n,s){var r=t[e-3*i],a=t[e-2*i],o=t[e-i],l=t[e+0],h=t[e+i],u=t[e+2*i],c=t[e+3*i];return 4*kn[255+o-l]+kn[255+a-h]>n?0:kn[255+t[e-4*i]-r]<=s&&kn[255+r-a]<=s&&kn[255+a-o]<=s&&kn[255+c-u]<=s&&kn[255+u-h]<=s&&kn[255+h-l]<=s}function We(t,e,i,n){var s=2*n+1;for(n=0;16>n;++n)Ne(t,e+n,i,s)&&Me(t,e+n,i)}function $e(t,e,i,n){var s=2*n+1;for(n=0;16>n;++n)Ne(t,e+n*i,1,s)&&Me(t,e+n*i,1)}function He(t,e,i,n){var s;for(s=3;0<s;--s)We(t,e+=4*i,i,n)}function Ue(t,e,i,n){var s;for(s=3;0<s;--s)$e(t,e+=4,i,n)}function Xe(t,e,i,n,s,r,a,o){for(r=2*r+1;0<s--;){if(Be(t,e,i,r,a))if(Ge(t,e,i,o))Me(t,e,i);else{var l=t,h=e,u=i,c=l[h-2*u],d=l[h-u],_=l[h+0],f=l[h+u],g=l[h+2*u],m=27*(w=Rn[1020+3*(_-d)+Rn[1020+c-f]])+63>>7,p=18*w+63>>7,w=9*w+63>>7;l[h-3*u]=On[255+l[h-3*u]+w],l[h-2*u]=On[255+c+p],l[h-u]=On[255+d+m],l[h+0]=On[255+_-m],l[h+u]=On[255+f-p],l[h+2*u]=On[255+g-w]}e+=n}}function Ye(t,e,i,n,s,r,a,o){for(r=2*r+1;0<s--;){if(Be(t,e,i,r,a))if(Ge(t,e,i,o))Me(t,e,i);else{var l=t,h=e,u=i,c=l[h-u],d=l[h+0],_=l[h+u],f=Dn[112+((g=3*(d-c))+4>>3)],g=Dn[112+(g+3>>3)],m=f+1>>1;l[h-2*u]=On[255+l[h-2*u]+m],l[h-u]=On[255+c+g],l[h+0]=On[255+d-f],l[h+u]=On[255+_-m]}e+=n}}function ze(t,e,i,n,s,r){Xe(t,e,i,1,16,n,s,r)}function Ke(t,e,i,n,s,r){Xe(t,e,1,i,16,n,s,r)}function je(t,e,i,n,s,r){var a;for(a=3;0<a;--a)Ye(t,e+=4*i,i,1,16,n,s,r)}function qe(t,e,i,n,s,r){var a;for(a=3;0<a;--a)Ye(t,e+=4,1,i,16,n,s,r)}function Je(t,e,i,n,s,r,a,o){Xe(t,e,s,1,8,r,a,o),Xe(i,n,s,1,8,r,a,o)}function Ze(t,e,i,n,s,r,a,o){Xe(t,e,1,s,8,r,a,o),Xe(i,n,1,s,8,r,a,o)}function Qe(t,e,i,n,s,r,a,o){Ye(t,e+4*s,s,1,8,r,a,o),Ye(i,n+4*s,s,1,8,r,a,o)}function ti(t,e,i,n,s,r,a,o){Ye(t,e+4,1,s,8,r,a,o),Ye(i,n+4,1,s,8,r,a,o)}function ei(){this.ba=new Z,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new tt,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function ii(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function ni(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function si(){this.ua=0,this.Wa=new I,this.vb=new I,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new r,this.yc=new n}function ri(){this.xb=this.a=0,this.l=new Gt,this.ca=new Z,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new _,this.Pb=0,this.wd=new _,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new si,this.ab=0,this.gc=ae(4,ni),this.Oc=0}function ai(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Gt,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function oi(t,e,i,n,s,r,a){for(t=null==t?0:t[e+0],e=0;e<a;++e)s[r+e]=t+i[n+e]&255,t=s[r+e]}function li(t,e,i,n,s,r,a){var o;if(null==t)oi(null,null,i,n,s,r,a);else for(o=0;o<a;++o)s[r+o]=t[e+o]+i[n+o]&255}function hi(t,e,i,n,s,r,a){if(null==t)oi(null,null,i,n,s,r,a);else{var o,l=t[e+0],h=l,u=l;for(o=0;o<a;++o)h=u+(l=t[e+o])-h,u=i[n+o]+(-256&h?0>h?0:255:h)&255,h=l,s[r+o]=u}}function ui(t,e,i,n){var s=e.width,r=e.o;if(ee(null!=t&&null!=e),0>i||0>=n||i+n>r)return null;if(!t.Cc){if(null==t.ga){var a;if(t.ga=new ai,(a=null==t.ga)||(a=e.width*e.o,ee(0==t.Gb.length),t.Gb=re(a),t.Uc=0,null==t.Gb?a=0:(t.mb=t.Gb,t.nb=t.Uc,t.rc=null,a=1),a=!a),!a){a=t.ga;var o=t.Fa,l=t.P,u=t.qc,c=t.mb,d=t.nb,_=l+1,f=u-1,m=a.l;if(ee(null!=o&&null!=c&&null!=e),gs[0]=null,gs[1]=oi,gs[2]=li,gs[3]=hi,a.ca=c,a.tb=d,a.c=e.width,a.i=e.height,ee(0<a.c&&0<a.i),1>=u)e=0;else if(a.$a=o[l+0]>>0&3,a.Z=o[l+0]>>2&3,a.Lc=o[l+0]>>4&3,l=o[l+0]>>6&3,0>a.$a||1<a.$a||4<=a.Z||1<a.Lc||l)e=0;else if(m.put=rt,m.ac=st,m.bc=at,m.ma=a,m.width=e.width,m.height=e.height,m.Da=e.Da,m.v=e.v,m.va=e.va,m.j=e.j,m.o=e.o,a.$a)t:{ee(1==a.$a),e=Tt();e:for(;;){if(null==e){e=0;break t}if(ee(null!=a),a.mc=e,e.c=a.c,e.i=a.i,e.l=a.l,e.l.ma=a,e.l.width=a.c,e.l.height=a.i,e.a=0,h(e.m,o,_,f),!St(a.c,a.i,1,e,null))break e;if(1==e.ab&&3==e.gc[0].hc&>(e.s)?(a.ic=1,o=e.c*e.i,e.Ta=null,e.Ua=0,e.V=re(o),e.Ba=0,null==e.V?(e.a=1,e=0):e=1):(a.ic=0,e=yt(e,a.c)),!e)break e;e=1;break t}a.mc=null,e=0}else e=f>=a.c*a.i;a=!e}if(a)return null;1!=t.ga.Lc?t.Ga=0:n=r-i}ee(null!=t.ga),ee(i+n<=r);t:{if(e=(o=t.ga).c,r=o.l.o,0==o.$a){if(_=t.rc,f=t.Vc,m=t.Fa,l=t.P+1+i*e,u=t.mb,c=t.nb+i*e,ee(l<=t.P+t.qc),0!=o.Z)for(ee(null!=gs[o.Z]),a=0;a<n;++a)gs[o.Z](_,f,m,l,u,c,e),_=u,f=c,c+=e,l+=e;else for(a=0;a<n;++a)ne(u,c,m,l,e),_=u,f=c,c+=e,l+=e;t.rc=_,t.Vc=f}else{if(ee(null!=o.mc),e=i+n,ee(null!=(a=o.mc)),ee(e<=a.i),a.C>=e)e=1;else if(o.ic||gi(),o.ic){o=a.V,_=a.Ba,f=a.c;var w=a.i,b=(m=1,l=a.$/f,u=a.$%f,c=a.m,d=a.s,a.$),T=f*w,S=f*e,y=d.wc,x=b<S?dt(d,u,l):null;ee(b<=T),ee(e<=w),ee(gt(d));e:for(;;){for(;!c.h&&b<S;){if(u&y||(x=dt(d,u,l)),ee(null!=x),p(c),256>(w=ut(x.G[0],x.H[0],c)))o[_+b]=w,++b,++u>=f&&(u=0,++l<=e&&!(l%16)&&pt(a,l));else{if(!(280>w)){m=0;break e}w=lt(w-256,c);var E,v=ut(x.G[4],x.H[4],c);if(p(c),!(b>=(v=ht(f,v=lt(v,c)))&&T-b>=w)){m=0;break e}for(E=0;E<w;++E)o[_+b+E]=o[_+b+E-v];for(b+=w,u+=w;u>=f;)u-=f,++l<=e&&!(l%16)&&pt(a,l);b<S&&u&y&&(x=dt(d,u,l))}ee(c.h==g(c))}pt(a,l>e?e:l);break e}!m||c.h&&b<T?(m=0,a.a=c.h?5:3):a.$=b,e=m}else e=wt(a,a.V,a.Ba,a.c,a.i,e,xt);if(!e){n=0;break t}}i+n>=r&&(t.Cc=1),n=1}if(!n)return null;if(t.Cc&&(null!=(n=t.ga)&&(n.mc=null),t.ga=null,0<t.Ga))return alert("todo:WebPDequantizeLevels"),null}return t.nb+i*s}function ci(t,e,i,n,s,r){for(;0<s--;){var a,o=t,l=e+(i?1:0),h=t,u=e+(i?0:3);for(a=0;a<n;++a){var c=h[u+4*a];255!=c&&(c*=32897,o[l+4*a+0]=o[l+4*a+0]*c>>23,o[l+4*a+1]=o[l+4*a+1]*c>>23,o[l+4*a+2]=o[l+4*a+2]*c>>23)}e+=r}}function di(t,e,i,n,s){for(;0<n--;){var r;for(r=0;r<i;++r){var a=t[e+2*r+0],o=15&(h=t[e+2*r+1]),l=4369*o,h=(240&h|h>>4)*l>>16;t[e+2*r+0]=(240&a|a>>4)*l>>16&240|(15&a|a<<4)*l>>16>>4&15,t[e+2*r+1]=240&h|o}e+=s}}function _i(t,e,i,n,s,r,a,o){var l,h,u=255;for(h=0;h<s;++h){for(l=0;l<n;++l){var c=t[e+l];r[a+4*l]=c,u&=c}e+=i,a+=o}return 255!=u}function fi(t,e,i,n,s){var r;for(r=0;r<s;++r)i[n+r]=t[e+r]>>8}function gi(){yn=ci,xn=di,En=_i,vn=fi}function mi(t,e,i){self[t]=function(t,n,s,r,a,o,l,h,u,c,d,_,f,g,m,p,w){var b,T=w-1>>1,S=a[o+0]|l[h+0]<<16,y=u[c+0]|d[_+0]<<16;ee(null!=t);var x=3*S+y+131074>>2;for(e(t[n+0],255&x,x>>16,f,g),null!=s&&(x=3*y+S+131074>>2,e(s[r+0],255&x,x>>16,m,p)),b=1;b<=T;++b){var E=a[o+b]|l[h+b]<<16,v=u[c+b]|d[_+b]<<16,L=S+E+y+v+524296,I=L+2*(E+y)>>3;x=I+S>>1,S=(L=L+2*(S+v)>>3)+E>>1,e(t[n+2*b-1],255&x,x>>16,f,g+(2*b-1)*i),e(t[n+2*b-0],255&S,S>>16,f,g+(2*b-0)*i),null!=s&&(x=L+y>>1,S=I+v>>1,e(s[r+2*b-1],255&x,x>>16,m,p+(2*b-1)*i),e(s[r+2*b+0],255&S,S>>16,m,p+(2*b+0)*i)),S=E,y=v}1&w||(x=3*S+y+131074>>2,e(t[n+w-1],255&x,x>>16,f,g+(w-1)*i),null!=s&&(x=3*y+S+131074>>2,e(s[r+w-1],255&x,x>>16,m,p+(w-1)*i)))}}function pi(){ms[Fn]=ps,ms[Vn]=bs,ms[Mn]=ws,ms[Gn]=Ts,ms[Nn]=Ss,ms[Bn]=ys,ms[Wn]=xs,ms[$n]=bs,ms[Hn]=Ts,ms[Un]=Ss,ms[Xn]=ys}function wi(t){return t&~Cs?0>t?0:255:t>>As}function bi(t,e){return wi((19077*t>>8)+(26149*e>>8)-14234)}function Ti(t,e,i){return wi((19077*t>>8)-(6419*e>>8)-(13320*i>>8)+8708)}function Si(t,e){return wi((19077*t>>8)+(33050*e>>8)-17685)}function yi(t,e,i,n,s){n[s+0]=bi(t,i),n[s+1]=Ti(t,e,i),n[s+2]=Si(t,e)}function xi(t,e,i,n,s){n[s+0]=Si(t,e),n[s+1]=Ti(t,e,i),n[s+2]=bi(t,i)}function Ei(t,e,i,n,s){var r=Ti(t,e,i);e=r<<3&224|Si(t,e)>>3,n[s+0]=248&bi(t,i)|r>>5,n[s+1]=e}function vi(t,e,i,n,s){var r=240&Si(t,e)|15;n[s+0]=240&bi(t,i)|Ti(t,e,i)>>4,n[s+1]=r}function Li(t,e,i,n,s){n[s+0]=255,yi(t,e,i,n,s+1)}function Ii(t,e,i,n,s){xi(t,e,i,n,s),n[s+3]=255}function Ai(t,e,i,n,s){yi(t,e,i,n,s),n[s+3]=255}function Mt(t,e){return 0>t?0:t>e?e:t}function Ci(t,e,i){self[t]=function(t,n,s,r,a,o,l,h,u){for(var c=h+(-2&u)*i;h!=c;)e(t[n+0],s[r+0],a[o+0],l,h),e(t[n+1],s[r+0],a[o+0],l,h+i),n+=2,++r,++o,h+=2*i;1&u&&e(t[n+0],s[r+0],a[o+0],l,h)}}function Pi(t,e,i){return 0==i?0==t?0==e?6:5:0==e?4:0:i}function Ri(t,e,i,n,s){switch(t>>>30){case 3:rn(e,i,n,s,0);break;case 2:an(e,i,n,s);break;case 1:ln(e,i,n,s)}}function Di(t,e){var i,n,s=e.M,r=e.Nb,a=t.oc,o=t.pc+40,l=t.oc,h=t.pc+584,u=t.oc,c=t.pc+600;for(i=0;16>i;++i)a[o+32*i-1]=129;for(i=0;8>i;++i)l[h+32*i-1]=129,u[c+32*i-1]=129;for(0<s?a[o-1-32]=l[h-1-32]=u[c-1-32]=129:(se(a,o-32-1,127,21),se(l,h-32-1,127,9),se(u,c-32-1,127,9)),n=0;n<t.za;++n){var d=e.ya[e.aa+n];if(0<n){for(i=-1;16>i;++i)ne(a,o+32*i-4,a,o+32*i+12,4);for(i=-1;8>i;++i)ne(l,h+32*i-4,l,h+32*i+4,4),ne(u,c+32*i-4,u,c+32*i+4,4)}var _=t.Gd,f=t.Hd+n,g=d.ad,m=d.Hc;if(0<s&&(ne(a,o-32,_[f].y,0,16),ne(l,h-32,_[f].f,0,8),ne(u,c-32,_[f].ea,0,8)),d.Za){var p=a,w=o-32+16;for(0<s&&(n>=t.za-1?se(p,w,_[f].y[15],4):ne(p,w,_[f+1].y,0,4)),i=0;4>i;i++)p[w+128+i]=p[w+256+i]=p[w+384+i]=p[w+0+i];for(i=0;16>i;++i,m<<=2)p=a,w=o+Ms[i],cs[d.Ob[i]](p,w),Ri(m,g,16*+i,p,w)}else if(p=Pi(n,s,d.Ob[0]),us[p](a,o),0!=m)for(i=0;16>i;++i,m<<=2)Ri(m,g,16*+i,a,o+Ms[i]);for(i=d.Gc,p=Pi(n,s,d.Dd),ds[p](l,h),ds[p](u,c),m=g,p=l,w=h,255&(d=i>>0)&&(170&d?on(m,256,p,w):hn(m,256,p,w)),d=u,m=c,255&(i>>=8)&&(170&i?on(g,320,d,m):hn(g,320,d,m)),s<t.Ub-1&&(ne(_[f].y,0,a,o+480,16),ne(_[f].f,0,l,h+224,8),ne(_[f].ea,0,u,c+224,8)),i=8*r*t.B,_=t.sa,f=t.ta+16*n+16*r*t.R,g=t.qa,d=t.ra+8*n+i,m=t.Ha,p=t.Ia+8*n+i,i=0;16>i;++i)ne(_,f+i*t.R,a,o+32*i,16);for(i=0;8>i;++i)ne(g,d+i*t.B,l,h+32*i,8),ne(m,p+i*t.B,u,c+32*i,8)}}function Oi(t,e,i,n,s,r,a,o,l){var u=[0],c=[0],d=0,f=null!=l?l.kd:0,g=null!=l?l:new ii;if(null==t||12>i)return 7;g.data=t,g.w=e,g.ha=i,e=[e],i=[i],g.gb=[g.gb];t:{var m=e,p=i,w=g.gb;if(ee(null!=t),ee(null!=p),ee(null!=w),w[0]=0,12<=p[0]&&!ie(t,m[0],"RIFF")){if(ie(t,m[0]+8,"WEBP")){w=3;break t}var b=E(t,m[0]+4);if(12>b||4294967286<b){w=3;break t}if(f&&b>p[0]-8){w=7;break t}w[0]=b,m[0]+=12,p[0]-=12}w=0}if(0!=w)return w;for(b=0<g.gb[0],i=i[0];;){t:{var T=t;p=e,w=i;var S=u,y=c,v=m=[0];if((A=d=[d])[0]=0,8>w[0])w=7;else{if(!ie(T,p[0],"VP8X")){if(10!=E(T,p[0]+4)){w=3;break t}if(18>w[0]){w=7;break t}var L=E(T,p[0]+8),I=1+x(T,p[0]+12);if(2147483648<=I*(T=1+x(T,p[0]+15))){w=3;break t}null!=v&&(v[0]=L),null!=S&&(S[0]=I),null!=y&&(y[0]=T),p[0]+=18,w[0]-=18,A[0]=1}w=0}}if(d=d[0],m=m[0],0!=w)return w;if(p=!!(2&m),!b&&d)return 3;if(null!=r&&(r[0]=!!(16&m)),null!=a&&(a[0]=p),null!=o&&(o[0]=0),a=u[0],m=c[0],d&&p&&null==l){w=0;break}if(4>i){w=7;break}if(b&&d||!b&&!d&&!ie(t,e[0],"ALPH")){i=[i],g.na=[g.na],g.P=[g.P],g.Sa=[g.Sa];t:{L=t,w=e,b=i;var A=g.gb;S=g.na,y=g.P,v=g.Sa;I=22,ee(null!=L),ee(null!=b),T=w[0];var C=b[0];for(ee(null!=S),ee(null!=v),S[0]=null,y[0]=null,v[0]=0;;){if(w[0]=T,b[0]=C,8>C){w=7;break t}var P=E(L,T+4);if(4294967286<P){w=3;break t}var R=8+P+1&-2;if(I+=R,0<A&&I>A){w=3;break t}if(!ie(L,T,"VP8 ")||!ie(L,T,"VP8L")){w=0;break t}if(C[0]<R){w=7;break t}ie(L,T,"ALPH")||(S[0]=L,y[0]=T+8,v[0]=P),T+=R,C-=R}}if(i=i[0],g.na=g.na[0],g.P=g.P[0],g.Sa=g.Sa[0],0!=w)break}i=[i],g.Ja=[g.Ja],g.xa=[g.xa];t:if(A=t,w=e,b=i,S=g.gb[0],y=g.Ja,v=g.xa,L=w[0],T=!ie(A,L,"VP8 "),I=!ie(A,L,"VP8L"),ee(null!=A),ee(null!=b),ee(null!=y),ee(null!=v),8>b[0])w=7;else{if(T||I){if(A=E(A,L+4),12<=S&&A>S-12){w=3;break t}if(f&&A>b[0]-8){w=7;break t}y[0]=A,w[0]+=8,b[0]-=8,v[0]=I}else v[0]=5<=b[0]&&47==A[L+0]&&!(A[L+4]>>5),y[0]=b[0];w=0}if(i=i[0],g.Ja=g.Ja[0],g.xa=g.xa[0],e=e[0],0!=w)break;if(4294967286<g.Ja)return 3;if(null==o||p||(o[0]=g.xa?2:1),a=[a],m=[m],g.xa){if(5>i){w=7;break}o=a,f=m,p=r,null==t||5>i?t=0:5<=i&&47==t[e+0]&&!(t[e+4]>>5)?(b=[0],A=[0],S=[0],h(y=new _,t,e,i),ot(y,b,A,S)?(null!=o&&(o[0]=b[0]),null!=f&&(f[0]=A[0]),null!=p&&(p[0]=S[0]),t=1):t=0):t=0}else{if(10>i){w=7;break}o=m,null==t||10>i||!Wt(t,e+3,i-3)?t=0:(f=t[e+0]|t[e+1]<<8|t[e+2]<<16,p=16383&(t[e+7]<<8|t[e+6]),t=16383&(t[e+9]<<8|t[e+8]),1&f||3<(f>>1&7)||!(f>>4&1)||f>>5>=g.Ja||!p||!t?t=0:(a&&(a[0]=p),o&&(o[0]=t),t=1))}if(!t)return 3;if(a=a[0],m=m[0],d&&(u[0]!=a||c[0]!=m))return 3;null!=l&&(l[0]=g,l.offset=e-l.w,ee(4294967286>e-l.w),ee(l.offset==l.ha-i));break}return 0==w||7==w&&d&&null==l?(null!=r&&(r[0]|=null!=g.na&&0<g.na.length),null!=n&&(n[0]=a),null!=s&&(s[0]=m),0):w}function ki(t,e,i){var n=e.width,s=e.height,r=0,a=0,o=n,l=s;if(e.Da=null!=t&&0<t.Da,e.Da&&(o=t.cd,l=t.bd,r=t.v,a=t.j,11>i||(r&=-2,a&=-2),0>r||0>a||0>=o||0>=l||r+o>n||a+l>s))return 0;if(e.v=r,e.j=a,e.va=r+o,e.o=a+l,e.U=o,e.T=l,e.da=null!=t&&0<t.da,e.da){if(!A(o,l,i=[t.ib],r=[t.hb]))return 0;e.ib=i[0],e.hb=r[0]}return e.ob=null!=t&&t.ob,e.Kb=null==t||!t.Sd,e.da&&(e.ob=e.ib<3*n/4&&e.hb<3*s/4,e.Kb=0),1}function Fi(t){if(null==t)return 2;if(11>t.S){var e=t.f.RGBA;e.fb+=(t.height-1)*e.A,e.A=-e.A}else e=t.f.kb,t=t.height,e.O+=(t-1)*e.fa,e.fa=-e.fa,e.N+=(t-1>>1)*e.Ab,e.Ab=-e.Ab,e.W+=(t-1>>1)*e.Db,e.Db=-e.Db,null!=e.F&&(e.J+=(t-1)*e.lb,e.lb=-e.lb);return 0}function Vi(t,e,i,n){if(null==n||0>=t||0>=e)return 2;if(null!=i){if(i.Da){var s=i.cd,r=i.bd,a=-2&i.v,o=-2&i.j;if(0>a||0>o||0>=s||0>=r||a+s>t||o+r>e)return 2;t=s,e=r}if(i.da){if(!A(t,e,s=[i.ib],r=[i.hb]))return 2;t=s[0],e=r[0]}}n.width=t,n.height=e;t:{var l=n.width,h=n.height;if(t=n.S,0>=l||0>=h||!(t>=Fn&&13>t))t=2;else{if(0>=n.Rd&&null==n.sd){a=r=s=e=0;var u=(o=l*Ws[t])*h;if(11>t||(r=(h+1)/2*(e=(l+1)/2),12==t&&(a=(s=l)*h)),null==(h=re(u+2*r+a))){t=1;break t}n.sd=h,11>t?((l=n.f.RGBA).eb=h,l.fb=0,l.A=o,l.size=u):((l=n.f.kb).y=h,l.O=0,l.fa=o,l.Fd=u,l.f=h,l.N=0+u,l.Ab=e,l.Cd=r,l.ea=h,l.W=0+u+r,l.Db=e,l.Ed=r,12==t&&(l.F=h,l.J=0+u+2*r),l.Tc=a,l.lb=s)}if(e=1,s=n.S,r=n.width,a=n.height,s>=Fn&&13>s)if(11>s)t=n.f.RGBA,e&=(o=Math.abs(t.A))*(a-1)+r<=t.size,e&=o>=r*Ws[s],e&=null!=t.eb;else{t=n.f.kb,o=(r+1)/2,u=(a+1)/2,l=Math.abs(t.fa);h=Math.abs(t.Ab);var c=Math.abs(t.Db),d=Math.abs(t.lb),_=d*(a-1)+r;e&=l*(a-1)+r<=t.Fd,e&=h*(u-1)+o<=t.Cd,e=(e&=c*(u-1)+o<=t.Ed)&l>=r&h>=o&c>=o,e&=null!=t.y,e&=null!=t.f,e&=null!=t.ea,12==s&&(e&=d>=r,e&=_<=t.Tc,e&=null!=t.F)}else e=0;t=e?0:2}}return 0!=t||null!=i&&i.fd&&(t=Fi(n)),t}var Mi=64,Gi=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],Ni=24,Bi=32,Wi=8,$i=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];R("Predictor0","PredictorAdd0"),self.Predictor0=function(){return 4278190080},self.Predictor1=function(t){return t},self.Predictor2=function(t,e,i){return e[i+0]},self.Predictor3=function(t,e,i){return e[i+1]},self.Predictor4=function(t,e,i){return e[i-1]},self.Predictor5=function(t,e,i){return O(O(t,e[i+1]),e[i+0])},self.Predictor6=function(t,e,i){return O(t,e[i-1])},self.Predictor7=function(t,e,i){return O(t,e[i+0])},self.Predictor8=function(t,e,i){return O(e[i-1],e[i+0])},self.Predictor9=function(t,e,i){return O(e[i+0],e[i+1])},self.Predictor10=function(t,e,i){return O(O(t,e[i-1]),O(e[i+0],e[i+1]))},self.Predictor11=function(t,e,i){var n=e[i+0];return 0>=V(n>>24&255,t>>24&255,(e=e[i-1])>>24&255)+V(n>>16&255,t>>16&255,e>>16&255)+V(n>>8&255,t>>8&255,e>>8&255)+V(255&n,255&t,255&e)?n:t},self.Predictor12=function(t,e,i){var n=e[i+0];return(k((t>>24&255)+(n>>24&255)-((e=e[i-1])>>24&255))<<24|k((t>>16&255)+(n>>16&255)-(e>>16&255))<<16|k((t>>8&255)+(n>>8&255)-(e>>8&255))<<8|k((255&t)+(255&n)-(255&e)))>>>0},self.Predictor13=function(t,e,i){var n=e[i-1];return(F((t=O(t,e[i+0]))>>24&255,n>>24&255)<<24|F(t>>16&255,n>>16&255)<<16|F(t>>8&255,n>>8&255)<<8|F(t>>0&255,n>>0&255))>>>0};var Hi=self.PredictorAdd0;self.PredictorAdd1=M,R("Predictor2","PredictorAdd2"),R("Predictor3","PredictorAdd3"),R("Predictor4","PredictorAdd4"),R("Predictor5","PredictorAdd5"),R("Predictor6","PredictorAdd6"),R("Predictor7","PredictorAdd7"),R("Predictor8","PredictorAdd8"),R("Predictor9","PredictorAdd9"),R("Predictor10","PredictorAdd10"),R("Predictor11","PredictorAdd11"),R("Predictor12","PredictorAdd12"),R("Predictor13","PredictorAdd13");var Ui=self.PredictorAdd2;W("ColorIndexInverseTransform","MapARGB","32b",(function(t){return t>>8&255}),(function(t){return t})),W("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",(function(t){return t}),(function(t){return t>>8&255}));var Xi,Yi=self.ColorIndexInverseTransform,zi=self.MapARGB,Ki=self.VP8LColorIndexInverseTransformAlpha,ji=self.MapAlpha,qi=self.VP8LPredictorsAdd=[];qi.length=16,(self.VP8LPredictors=[]).length=16,(self.VP8LPredictorsAdd_C=[]).length=16,(self.VP8LPredictors_C=[]).length=16;var Ji,Zi,Qi,tn,en,nn,sn,rn,an,on,ln,hn,un,cn,dn,_n,fn,gn,mn,pn,wn,bn,Tn,Sn,yn,xn,En,vn,Ln=re(511),In=re(2041),An=re(225),Cn=re(767),Pn=0,Rn=In,Dn=An,On=Cn,kn=Ln,Fn=0,Vn=1,Mn=2,Gn=3,Nn=4,Bn=5,Wn=6,$n=7,Hn=8,Un=9,Xn=10,Yn=[2,3,7],zn=[3,3,11],Kn=[280,256,256,256,40],jn=[0,1,1,1,0],qn=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],Jn=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],Zn=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],Qn=8,ts=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],es=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],is=null,ns=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],ss=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],rs=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],as=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],os=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],ls=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],hs=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],us=[],cs=[],ds=[],_s=1,fs=2,gs=[],ms=[];mi("UpsampleRgbLinePair",yi,3),mi("UpsampleBgrLinePair",xi,3),mi("UpsampleRgbaLinePair",Ai,4),mi("UpsampleBgraLinePair",Ii,4),mi("UpsampleArgbLinePair",Li,4),mi("UpsampleRgba4444LinePair",vi,2),mi("UpsampleRgb565LinePair",Ei,2);var ps=window.UpsampleRgbLinePair,ws=window.UpsampleBgrLinePair,bs=window.UpsampleRgbaLinePair,Ts=window.UpsampleBgraLinePair,Ss=window.UpsampleArgbLinePair,ys=window.UpsampleRgba4444LinePair,xs=window.UpsampleRgb565LinePair,Es=16,vs=1<<Es-1,Ls=-227,Is=482,As=6,Cs=(256<<As)-1,Ps=0,Rs=re(256),Ds=re(256),Os=re(256),ks=re(256),Fs=re(Is-Ls),Vs=re(Is-Ls);Ci("YuvToRgbRow",yi,3),Ci("YuvToBgrRow",xi,3),Ci("YuvToRgbaRow",Ai,4),Ci("YuvToBgraRow",Ii,4),Ci("YuvToArgbRow",Li,4),Ci("YuvToRgba4444Row",vi,2),Ci("YuvToRgb565Row",Ei,2);var Ms=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Gs=[0,2,8],Ns=[8,7,6,4,4,2,2,2,1,1,1,1],Bs=1;this.WebPDecodeRGBA=function(t,e,i,n,s){var r=Vn,a=new ei,o=new Z;a.ba=o,o.S=r,o.width=[o.width],o.height=[o.height];var l=o.width,u=o.height,c=new Q;if(null==c||null==t)var d=2;else ee(null!=c),d=Oi(t,e,i,c.width,c.height,c.Pd,c.Qd,c.format,null);if(0!=d?l=0:(null!=l&&(l[0]=c.width[0]),null!=u&&(u[0]=c.height[0]),l=1),l){o.width=o.width[0],o.height=o.height[0],null!=n&&(n[0]=o.width),null!=s&&(s[0]=o.height);t:{if(n=new Gt,(s=new ii).data=t,s.w=e,s.ha=i,s.kd=1,e=[0],ee(null!=s),(0==(t=Oi(s.data,s.w,s.ha,null,null,null,e,null,s))||7==t)&&e[0]&&(t=4),0==(e=t)){if(ee(null!=a),n.data=s.data,n.w=s.w+s.offset,n.ha=s.ha-s.offset,n.put=rt,n.ac=st,n.bc=at,n.ma=a,s.xa){if(null==(t=Tt())){a=1;break t}if(function(t,e){var i=[0],n=[0],s=[0];e:for(;;){if(null==t)return 0;if(null==e)return t.a=2,0;if(t.l=e,t.a=0,h(t.m,e.data,e.w,e.ha),!ot(t.m,i,n,s)){t.a=3;break e}if(t.xb=fs,e.width=i[0],e.height=n[0],!St(i[0],n[0],1,t,null))break e;return 1}return ee(0!=t.a),0}(t,n)){if(n=0==(e=Vi(n.width,n.height,a.Oa,a.ba))){e:{n=t;i:for(;;){if(null==n){n=0;break e}if(ee(null!=n.s.yc),ee(null!=n.s.Ya),ee(0<n.s.Wb),ee(null!=(i=n.l)),ee(null!=(s=i.ma)),0!=n.xb){if(n.ca=s.ba,n.tb=s.tb,ee(null!=n.ca),!ki(s.Oa,i,Gn)){n.a=2;break i}if(!yt(n,i.width))break i;if(i.da)break i;if((i.da||j(n.ca.S))&&gi(),11>n.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),null!=n.ca.f.kb.F&&gi()),n.Pb&&0<n.s.ua&&null==n.s.vb.X&&!v(n.s.vb,n.s.Wa.Xa)){n.a=1;break i}n.xb=0}if(!wt(n,n.V,n.Ba,n.c,n.i,i.o,ft))break i;s.Dc=n.Ma,n=1;break e}ee(0!=n.a),n=0}n=!n}n&&(e=t.a)}else e=t.a}else{if(null==(t=new Nt)){a=1;break t}if(t.Fa=s.na,t.P=s.P,t.qc=s.Sa,$t(t,n)){if(0==(e=Vi(n.width,n.height,a.Oa,a.ba))){if(t.Aa=0,i=a.Oa,ee(null!=(s=t)),null!=i){if(0<(l=0>(l=i.Md)?0:100<l?255:255*l/100)){for(u=c=0;4>u;++u)12>(d=s.pb[u]).lc&&(d.ia=l*Ns[0>d.lc?0:d.lc]>>3),c|=d.ia;c&&(alert("todo:VP8InitRandom"),s.ia=1)}s.Ga=i.Id,100<s.Ga?s.Ga=100:0>s.Ga&&(s.Ga=0)}Xt(t,n)||(e=t.a)}}else e=t.a}0==e&&null!=a.Oa&&a.Oa.fd&&(e=Fi(a.ba))}a=e}r=0!=a?null:11>r?o.f.RGBA.eb:o.f.kb.y}else r=null;return r};var Ws=[3,4,3,4,4,2,2,4,4,4,2,1,1]},new window.WebPDecoder,window.WebPRiffParser=function(t,e){var i={},n=0,s=!1,r=0,a=0;if(i.frames=[],!function(t,e,i,n){for(var s=0;s<n;s++)if(t[e+s]!=i.charCodeAt(s))return!0;return!1}(t,e,"RIFF",4)){for(ue(t,e+=4),e+=8;e<t.length;){var o=le(t,e),l=ue(t,e+=4);e+=4;var h=l+(1&l);switch(o){case"VP8 ":case"VP8L":void 0===i.frames[n]&&(i.frames[n]={}),(d=i.frames[n]).src_off=s?a:e-8,d.src_size=r+l+8,n++,s&&(s=!1,r=0,a=0);break;case"VP8X":(d=i.header={}).feature_flags=t[e];var u=e+4;d.canvas_width=1+he(t,u),u+=3,d.canvas_height=1+he(t,u),u+=3;break;case"ALPH":s=!0,r=h+8,a=e-8;break;case"ANIM":(d=i.header).bgcolor=ue(t,e),u=e+4,d.loop_count=(_=t)[(f=u)+0]<<0|_[f+1]<<8,u+=2;break;case"ANMF":var c,d;(d=i.frames[n]={}).offset_x=2*he(t,e),e+=3,d.offset_y=2*he(t,e),e+=3,d.width=1+he(t,e),e+=3,d.height=1+he(t,e),e+=3,d.duration=he(t,e),e+=3,c=t[e++],d.dispose=1&c,d.blend=c>>1&1}"ANMF"!=o&&(e+=h)}var _,f;return i}},window.ApicTools={parseGIF:t,decompressFrames:e},console.log("Using JsView HTML Forge");export default{};
|
|
1
|
+
/* eslint-disable */ import{parseGIF as t,decompressFrames as e}from"gifuct-js";void 0===window.Forge&&(window.Forge={});var i=window.Forge;class n{static getTextPixelWith(t,e){null===n.sCanvas&&(n.sCanvas=window.originDocument.createElement("canvas"));const i=n.sCanvas.getContext("2d");i.font=e;const s=i.measureText(t);return Math.ceil(s.width)}static GetTextWidth(t){let e="";t.bold&&(e="bold");let i="";return t.italic&&(i="italic"),this.getTextPixelWith(t.str,`${e} ${i} ${t.size}px ${t.font}`)}static GetTextRect(t,e,i,n,s){let r=Math.ceil(i.size*t.length/e.width)*s;r>e.height&&(r=e.height);return{width:e.width,height:r}}static GetCursorOffset(t,e,i,n,s,r,a){let o="";i.bold&&(o="bold");let l="";i.italic&&(l="italic");let h=0;if("right"===i.alignment){const n=this.getTextPixelWith(t,`${o} ${l} ${i.size}px ${i.font}`);(r-=e.width-n)<0&&(r=0)}let u=0;for(;r>=u&&h!==t.length;)u=this.getTextPixelWith(t.substr(0,h+1),`${o} ${l} ${i.size}px ${i.font}`),r>=u&&h++;return h}static GetCursorPosition(t,e,i,n,s,r){let a="";i.bold&&(a="bold");let o="";i.italic&&(o="italic");let l=0,h=t;if(r<t.length&&(h=h.substr(0,r)),l=this.getTextPixelWith(h,`${a} ${o} ${i.size}px ${i.font}`),"right"===i.alignment){const n=this.getTextPixelWith(t,`${a} ${o} ${i.size}px ${i.font}`);l=e.width-n+l}return{x:l,y:0}}}n.sCanvas=null,window.PlatformUtils=n;class s{constructor(t){this.state={},this.type=t,this._AutoPlay=!1}buildPlatformInstance(){this.Ele=window.originDocument.createElement(this.type),this.Ele.addEventListener("loadedmetadata",(()=>{this.hasOwnProperty("onload")&&this.onload(),this.hasOwnProperty("onloadedmetadata")&&this.onloadedmetadata()}))}set autoplay(t){void 0!==t&&(this._AutoPlay=!0,this.Ele.paused&&setTimeout((()=>{this.play()}),0))}get currentTime(){return this.Ele.currentTime}set currentTime(t){this.Ele.currentTime=t,this.setState("seek",t,"number")}get duration(){return this.Ele.duration}set loop(t){this.Ele.loop="boolean"==typeof t||void 0!==t}get muted(){return this.getState("muted")}set muted(t){this.setState("muted",t,"boolean")}get paused(){return this.Ele.paused}get playbackRate(){return this.getState("playbackRate")}set playbackRate(t){this.setState("playbackRate",t,"number")}set src(t){this.setState("src",t,"string"),t&&this._AutoPlay&&setTimeout((()=>{this.play()}),0)}get style(){const t=this;return{set bottom(e){t.setState("style",`{"bottom":"${e}"}`,"string")},set left(e){t.setState("style",`{"left":"${e}"}`,"string")},set right(e){t.setState("style",`{"right":"${e}"}`,"string")},set top(e){t.setState("style",`{"top":"${e}"}`,"string")},set height(e){t.setState("style",`{"height":"${e}"}`,"string")},set width(e){t.setState("style",`{"width":"${e}"}`,"string")}}}get volume(){return this.getState("volume")}set volume(t){this.setState("volume",t,"number")}get playableDuration(){return this.Ele.playableDuration}addEventListener(t,e){this[`on${t}`]=e,this.Ele.addEventListener(t,(e=>{this[`on${t}`](e)}))}load(){this.Ele.load()}pause(){this.Ele.pause(),this.setState("paused",!0,"boolean"),this.hasOwnProperty("onpause")&&this.onpause()}play(){this.setState("paused",!1,"boolean"),this.Ele.play(),this.hasOwnProperty("onplay")&&this.onplay()}unload(){this.setState("paused",!0,"boolean"),this.Ele.pause(),this.Ele.removeAttribute("src"),this.Ele.load()}setState(t,e,i){typeof e===i?("playbackRate"==t?this.Ele.playbackRate=e:this.Ele.setAttribute(t,e),this.state[t]=e,console.log(`set ${t} = ${e}`)):console.warn(`invalid paramter type to set ${t}. value is not ${i}`)}getState(t){let e=this.state[t];return console.log(`get ${t} = ${e}`),void 0===e&&(e=this.Ele.getAttribute(t),this.state[t]=e),e}onEnd(t){this.setState("paused",!0,"boolean"),this.hasOwnProperty("onended")&&this.onended()}onError(t){this.hasOwnProperty("onerror")&&this.onerror(t.currentTarget.error.code)}mediaHandler(){return this.Ele}static setDesignMapWidth(t){"number"==typeof t?s.prototype.designMapWidth=t:console.warn(`Invalid paramter type to set ${t}. It is not number.`)}}s.prototype.designMapWidth=0;class r extends s{constructor(t){super(t),super.buildPlatformInstance(t)}}class a extends r{constructor(){super("audio")}}window._ExtAudio=a;class o extends r{constructor(){super("video"),this.state.height=0,this.state.width=0,this.state.aspectRatiow="origin"}get height(){return this.getState("height")}set height(t){this.style.height=t,this.state.height=t}get poster(){return console.log("Video.poster() TODO"),null}set poster(t){console.log("Video.poster() TODO")}get videoAspectRatio(){return this.getState("aspectRatio")}set videoAspectRatio(t){this.setState("aspectRatio",t,"string")}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}get width(){return this.getState("width")}set width(t){this.style.width=t,this.state.width=t}onLoad(t){super.onLoad(t)}setRotation(t,e,i,n){let s=function(){let s=`rotate3d(0, 0, 1, ${t}deg)`;if(90==t||-90==t){let t,r;if(n?(t=i/e,r=e/i):(t=this.videoHeight/this.videoWidth,r=this.videoWidth/this.videoHeight),isNaN(t)||isNaN(r))return!1;s+=` scale3d(${t}, ${r}, 1)`}return this.Ele.style.transform=s,this.Ele.parentNode&&(this.Ele.parentNode.style.overflow="hidden"),!0};s=s.bind(this);s()||this.Ele.addEventListener("loadedmetadata",(()=>{s()}))}}window._ExtVideo=o;class l extends s{constructor(){super("video"),this._ReleaseCallbacks=[],this._ResourceTerminater=null,super.buildPlatformInstance()}setResourceTerminator(t){this._ResourceTerminater=t}hasTerminator(){return null!==this._ResourceTerminater}listenToRelease(t){this._ReleaseCallbacks.push(t)}unload(){super.unload(),null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}releaseResource(){for(let t=0;t<this._ReleaseCallbacks.length;t++)this._ReleaseCallbacks[t]();null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}confirmInitSetup(){}setRotation(){console.log("media.setRotation no implemented")}onPlatformDestroy(){}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}}window._ExtOVP=l,window.Audio=a,window.Video=o,window.OffscreenVideoPlayer=l;class h{constructor(t,e){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!t)return;if(!0===t.startsWith("url")){const e=t.indexOf("(")+1,i=t.lastIndexOf(")");t=t.substring(e,i).trim()}if(!0===t.startsWith("data:"))return void(this.href=t);if(!0===t.startsWith("/")&&(t=document.location.origin+t),!0===t.startsWith("./")){const e=document.location.pathname.lastIndexOf("/");let i="";e>0&&(i=document.location.pathname.substring(0,e)),t=document.location.origin+i+t.substring(1)}if(this.href=t,!e)return;let i=this.href.indexOf("?");const n=i>0?this.href.substring(0,i):this.href;this.search=i>1?this.href.substring(i):"",i=n.indexOf("://"),this.protocol=i>0?n.substring(0,i+1):"";const s=i>1?n.substring(i+3):"";i=s.indexOf("/"),this.host=i>0?s.substring(0,i):"",this.pathname=i>1?s.substring(i):"",this.origin=i>0?`${this.protocol}//${this.host}`:"",i=this.host.indexOf(":"),this.hostname=i>0?this.host.substring(0,i):this.host,this.port=i>1?this.host.substring(i+1):"",console.log("create total parse URL, this=",this)}replace(t){this.href=t}}const u=window.AudioContext||window.webkitAudioContext;if(u){const t=new u;let e=0,i=0;class n{constructor(t,e,i){this._Context=t,this._BufferSource=e,this._Gain=i,this._BufferSource.connect(this._Gain),this._Gain.connect(this._Context.destination)}start(t,e,i){this._BufferSource.start(t,e,i)}setVolume(t){this._Gain.gain.setValueAtTime(t,this._Context.currentTime)}stop(t){this._BufferSource.stop(t)}}class s{constructor(){this._SoundBufferMap={},this._StreamMap={}}load(i,n,s,r){const a=new h(i).href,o=e++;return this._requestBuffer(a,((e,i)=>{0===e?t.decodeAudioData(i,(t=>{this._SoundBufferMap[o]=t,r(o,0)})):r(-1,-1)})),o}unload(t){delete this._SoundBufferMap[t]}autoPause(){}autoResume(){}play(e,s,r,a,o,l){if(this._SoundBufferMap[e]){const r=i++,a=t.createBufferSource();a.buffer=this._SoundBufferMap[e],a.playbackRate.value=l,a.onended=t=>{this.stop(r)},o>0&&(a.loop=!0);const h=t.createGain();h.gain.setValueAtTime(s,t.currentTime);const u=new n(t,a,h);return this._StreamMap[r]=u,console.log("loop test",(o+1)*this._SoundBufferMap[e].duration),u.start(0,0,(o+1)*this._SoundBufferMap[e].duration),r}return-1}pause(t){}resume(t){}stop(t){this._StreamMap[t]&&(this._StreamMap[t].stop(),delete this._StreamMap[t])}release(){this._SoundBufferMap={},this._StreamMap={}}setVolume(t,e,i){this._StreamMap[t]&&this._StreamMap[t].setVolume(e)}setPriority(t,e){}setRate(t,e){}setLoop(t,e){}_requestBuffer(t,e){const i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=()=>{200===i.status?(console.log("http request succeed"),e(0,i.response)):(console.error(`download audio ${t} failed.`,i.status),e(-1,null))},i.send()}}window.SoundPool=s}else window.SoundPool=null;i.LogF=function(t){},i.LogE=function(t){},i.LogW=function(t){},i.LogI=function(t){},i.LogD=function(t){},i.LogM=function(t){},i.ThrowError=function(t){throw new Error(t)},i.Assert=function(t){if(!t)throw new Error("ASSERT!!!!!")},i.EnableLog=function(t){i.LogM=console.log.bind(console),t>0&&(i.LogF=console.error.bind(console)),t>1&&(i.LogE=console.error.bind(console)),t>2&&(i.LogW=console.warn.bind(console)),t>3&&(i.LogI=console.log.bind(console)),t>4&&(i.LogD=console.debug.bind(console))};i.RectArea=class{constructor(t,e,i,n){this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0,("number"!=typeof i||i<0)&&(i=0),this.width=i,("number"!=typeof n||n<0)&&(n=0),this.height=n}Equals(t){return null!==t&&(t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height)}};i.Coordinate=class{constructor(t,e){this.x=t,this.y=e}};i.Size=class{constructor(t,e){this.width=t,this.height=e}};i.RectUtils=class{FormatRectArea(t){let e=null;if(t instanceof i.RectArea)e=t;else if("object"==typeof t&&null!==t){if(isNaN(t.width)||isNaN(t.height))throw new Error("ERROR: target_size format should be {width:XXXX, height:XXXX}");e=new i.RectArea(0,0,t.width,t.height)}return e}},i.sRectUitls=new i.RectUtils,i.TextShaderType={LinearGradient:0,Image:1};i.TextShader=class{constructor(t,e){this.Type=t,this.Params=e}};class c{constructor(){const t=(new i.LayoutView).GetRenderer();this._Renderer=t,this.StringWithFont=i.sTextUtils.StringWithFont("",0,void 0,"center","middle",void 0,!1,!1,void 0,void 0,"top"),this.RectArea=new i.RectArea(0,0,0,0),this.TextAttr=i.sTextUtils.TextAttr("ellipsis","none"),this.Marquee=null,this.Shader=null,this.IsInstantLoad=!0,this.LineHeight=0,this.LatexMode=!1}SetInstantLoad(t){return this.IsInstantLoad=t,this}SetStringWithFont(t){return this.StringWithFont=t,this}SetLatexMode(t){return this.LatexMode=t,this}SetFontStyle(t,e,n,s,r,a,o,l,h,u){return this.StringWithFont="object"==typeof t?i.sTextUtils.StringWithFont("",void 0!==t.size?t.size:10,void 0!==t.font?t.font:"宋体",void 0!==t.hAlign?t.hAlign:"center",void 0!==t.vAlign?t.vAlign:"middle",void 0!==t.textColor?t.textColor:"#000000",void 0!==t.italic&&t.italic,void 0!==t.bold&&t.bold,void 0!==t.shadow?t.shadow:null,void 0!==t.strokeWidth?t.strokeWidth:null,void 0!==t.vAreaAlign?t.vAreaAlign:"top"):i.sTextUtils.StringWithFont("",t,e,n,s,r,a,o,l,h,u),this}SetRectArea(t){return t instanceof i.RectArea?this.RectArea=t:this.RectArea=new i.RectArea(t.x,t.y,t.width,t.height),this}SetViewSize(t){return t instanceof i.RectArea||(t=new i.RectArea(t.x,t.y,t.width,t.height)),this.SetRectArea(t),0===this.LineHeight&&0!==t.height&&(this.LineHeight=t.height),this}SetTextAttr(t){let e,i;return e=t.hasOwnProperty("textOverflow")?t.textOverflow:t.hasOwnProperty("text_overflow")?t.text_overflow:"clip",i=t.hasOwnProperty("wordWrap")?t.wordWrap:t.hasOwnProperty("word_wrap")?t.word_wrap:"none",this.TextAttr={word_wrap:i,text_overflow:e},this}SetMarquee(t){return t&&(this.Marquee={repetition:"infinite",direction:"left",speed:"normal"},t.repetition&&(this.Marquee.repetition=t.repetition),t.direction&&(this.Marquee.direction=t.direction),t.speed&&(this.Marquee.speed=t.speed)),this}SetShader(t){return this.Shader=t,this}SetLineHeight(t){return this.LineHeight=t,this}EnableDuplicateBuilder(){this.BuildCopyBag=!0}Clone(){const t=new c(null);return t.StringWithFont=this.StringWithFont,t.RectArea=this.RectArea,t.TextAttr=this.TextAttr,t.LineHeight=this.LineHeight,t}}i.TextViewParams=c,window.TextViewParams=i.TextViewParams;class d{constructor(t,e,n,s,r){this._layoutView=null,this._textWidth=0,this._textViewReahHeight=0,this._marqueeRunning=!0,this._marqueePause=!1,this._marqueeCurrentNum=2,this._textView=null,this._TextViewParams=e,this._NeedQuick=void 0!==s&&s,this._marquee=e.Marquee,this._rectArea=e.RectArea,this._DrawCount=0,this._ShowInterval=0,this._TextureManager=t,this._LatexMode=e.LatexMode,this._Shader=e.Shader,this._IsInstantLoad=e.IsInstantLoad?1:0,this._AutoHeight=!1,this._EnableTextureOnloadCallback=!!r,this._DuplicateBag=e.BuildCopyBag?{Set:null,Swf:null,Siz:null}:null;const a=this;let o=null;const l=e.RectArea.width,h=e.RectArea.height;let u=null,c=null;null!==this._marquee?(c=new i.ClipView,c.Init(),c.SetClipRect(0,0,l,h,!0),c.SetId("matrixClipLayoutview"),c.OnDettachFromSystem=function(){a._marqueeRunning=!1,i.ClipView.prototype.OnDettachFromSystem.call(this)}):(c=new i.LayoutView,c.OnDettachFromSystem=function(){this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null)}),o=c.GetRenderer(),this._Renderer=o;let d=n;d||(d=e.StringWithFont.str),d=this._ConvertEscToString(d);let _=!1;e.StringWithFont.italic.length>0&&(_=!0);let f=!1;e.StringWithFont.bold.length>0&&(f=!0),u=i.sTextUtils.StringWithFont(d,e.StringWithFont.size,e.StringWithFont.font,e.StringWithFont.alignment,e.StringWithFont.vertical_align,e.StringWithFont.textColour,_,f,e.StringWithFont.shadow,e.StringWithFont.stroke_width,e.StringWithFont.vertical_area_align),void 0!==e.Marquee&&null!==e.Marquee?this._textWidth=i.sTextUtils.GetTextWidth(u):this._NeedQuick?this._textWidth=e.RectArea.width-2*e.RectArea.x:this._textWidth=i.sTextUtils.GetTextWidth(u),this.addTextView(c,u,e.TextAttr,e.RectArea,e.Marquee,e.LineHeight),this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null),this._TextureOnloadCallbacksTimer=setTimeout((()=>{r&&r({width:this._textView.Element.clientWidth,height:this._textView.Element.clientHeight})}),0),this._layoutView=c,this._TextTexture=null,this._MarqueeTimer=null}_ConvertEscToString(t){let e=`${t}`;return-1!==e.indexOf(""")&&(e=e.replace(/"/gi,'"')),-1!==e.indexOf("&")&&(e=e.replace(/&/gi,"&")),-1!==e.indexOf("<")&&(e=e.replace(/</gi,">")),-1!==e.indexOf(">")&&(e=e.replace(/>/gi,"<")),-1!==e.indexOf(" ")&&(e=e.replace(/ /gi," ")),e}EnableAutoHeight(){this._AutoHeight=!0,this._textView.EnableAutoHeight()}addTextView(t,e,n,s,r,a){const o=s.height;let l;const h=i.Clone(s);let u=null;0!==e.str.length?(l=this._TextureManager.GetTextTextureByMultiRows(e,n,h,a,this._NeedQuick,this._Shader,this._IsInstantLoad,this._LatexMode,this._DuplicateBag),this._TextTexture=l.texture,this._textViewReahHeight=l.real_height,u=new i.LayoutView,u.Init(new i.TextureSetting(l.texture,null,null,!0)),u.SetId(`Text-${e.str}`),"middle"!==e.vertical_area_align&&"bottom"!==e.vertical_area_align||(u.Element.style.display="table-cell",u.Element.style.position="static",t.Element.style.display="table",t.Element.style.position="static"),t.AddView(u,new i.LayoutParams({x:0,y:0,width:h.width,height:o})),this._textView=u):(this._textViewReahHeight=0,i.LogI("t_StringWithFont.str.length is 0"))}GetDuplicateBuilder(){return this._DuplicateBag}GetLayoutView(){return this._layoutView}GetTextWidth(){return this._textView?this._textView.Element.clientWidth:Math.floor(this._textWidth+.5)}StartAnimation(t){t&&null!==this._textView&&this._textView.StartAnimation(t)}}i.TextViewEx=d,i.TextViewControl=d;i.CopiedTextViewEx=class{constructor(t,e,n,s,r){const a={x:0,y:0,width:n.width,height:n.height};this._ContainerView=new i.LayoutView,this._TextView=this._AddTextView(t,e,a,this._ContainerView,s,r)}_AddTextView(t,e,n,s,r,a){let o=null;if(e&&0!==e.length){const l=t.GetCopiedTextTexture(e,n,r,a);o=new i.LayoutView,o.Init(new i.TextureSetting(l,null,null,!0)),e.length<15?o.SetId(`Text-${e}`):o.SetId(`Text-Long${e.length}`),s.AddView(o,new i.LayoutParams({x:0,y:0,width:n.width,height:n.height})),a&&l.RegisterLoadImageCallback(null,a,null)}return o}EnableAutoHeight(){this._TextView&&this._TextView.EnableAutoHeight()}GetLayoutView(){return this._ContainerView}},i.Clone=function(t){return JSON.parse(JSON.stringify(t))},window.Clone=i.Clone;i.PersistTimer=new class{constructor(){this._AlreadyExited=!1,window.PersistTimer&&(this._AlreadyExited=!0)}setTimeout(t,e){return this._AlreadyExited&&window.PersistTimer.setTimeout?window.PersistTimer.setTimeout(t,e):window.setTimeout(t,e)}clearTimeout(t){this._AlreadyExited&&window.PersistTimer.clearTimeout?window.PersistTimer.clearTimeout(t):window.clearTimeout(t)}setInterval(t,e){if(!this._AlreadyExited||!window.PersistTimer.setInterval)return window.setInterval(t,e);window.PersistTimer.setInterval(t,e)}clearInterval(t){this._AlreadyExited&&window.PersistTimer.clearInterval?window.PersistTimer.clearInterval(t):window.clearInterval(t)}};i.ForegroundTimer=new class{setTimeout(t,e){return window.setTimeout(t,e)}clearTimeout(t){window.clearTimeout(t)}setInterval(t,e){return window.setInterval(t,e)}clearInterval(t){window.clearInterval(t)}},i.EasingTypeIn=0,i.EasingTypeOut=1,i.EasingTypeInOut=2,i.EasingTypeBezier=3,i.EasingTypeBlink=4,i.EasingTypeDeceleration=5,i.EasingTypeSteps=6;i.EasingBase=class{constructor(){this.Pacakge=this.Package}Package(){}_GetBasePackage(t){return{T:t,St:null}}};class _ extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeIn)}}i.EasingIn=_;class f extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeOut)}}i.EasingOut=f;class g extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeInOut)}}i.EasingInOut=g;class m extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeDeceleration)}}i.EasingDeceleration=m;class p extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeBlink)}}i.EasingBlink=p;class w extends i.EasingBase{constructor(t,e,i,n,s){super(),this._Inited=!1,this._X1=t,this._X2=i,this._Y1=e,this._Y2=n,this._Duration=s}Package(){const t=this._GetBasePackage(i.EasingTypeBezier);return t.St={X1:this._X1,X2:this._X2,Y1:this._Y1,Y2:this._Y2,Dur:this._Duration},t}}i.BezierEasing=w;class b extends i.EasingBase{constructor(t,e){super(),this._Steps=t,this._Type=e}Package(){const t=this._GetBasePackage(i.EasingTypeSteps);return t.St={S:this._Steps,T:this._Type},t}}i.StepsEasing=b,i.Easing={Circular:{In:new i.EasingIn,Out:new i.EasingOut,InOut:new i.EasingInOut,Deceleration:new i.EasingDeceleration}},window.Easing=i.Easing,i.ColorSpace={RGBA_8888:"RGBA_8888",RGBA_4444:"RGBA_4444",RGBA_5551:"RGBA_5551",RGB_565:"RGB_565",RGB_ETC1:"RGB_ETC1",RGBA_ETC1:"RGBA_ETC1"},i.QRCodeLevel={L:1,M:0,Q:3,H:2};class T{constructor(t,e,n){if(this._Manager=t,n){i.sRenderTextureDelegateManager.CreateTextureStatus().SetResourceInfo(n)}this.RenderTexture=i.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(e),this._CallbackIdToken=0,this._OnLoadCallback=[],i.ForgeDebug.EnableTextureTracer&&(t._ImageTextureTracer.push(this),this._TracerDescript="")}get Unloaded(){return null===this.RenderTexture||this.RenderTexture.Unloaded}set Unloaded(t){}get LoadTime(){return null!==this.RenderTexture?this.RenderTexture.LoadTime:0}set LoadTime(t){}get Width(){return null!==this.RenderTexture?this.RenderTexture.Width:0}set Width(t){}get Height(){return null!==this.RenderTexture?this.RenderTexture.Height:0}set Height(t){}UnloadTex(){this._OnLoadCallback=[],null!==this.RenderTexture&&(this._CallbackIdToken>0&&(this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken),this._CallbackIdToken=0),this.RenderTexture.UndoRef(),this.RenderTexture=null),this._TracerDescript=""}RegisterLoadImageCallback(t,e,n){if(this.IsLoaded()&&null!=e)return this.RenderTexture&&e({width:this.RenderTexture.Width,height:this.RenderTexture.Height},n),null;let s=null;return null!=e&&(s={callback:e,params:n},this._OnLoadCallback.push(s),0===this._CallbackIdToken&&(i.Assert(null!==this.RenderTexture),this._CallbackIdToken=this.RenderTexture.RegisterOnloadCallback(T.prototype._InvokeOnLoadCallbacks.bind(this)))),s}UnregisterLoadImageCallback(t){t&&this._OnLoadCallback.some(((e,i,n)=>{if(e===t)return n.splice(i,1),!0}))}EnableBackgroundLoad(t){}DisableBackgroundLoad(t){}_InvokeOnLoadCallbacks(){const t=this._OnLoadCallback;this._OnLoadCallback=[];for(let e=0;e<t.length;e++){const i=t[e];i.callback(i.params)}this.RenderTexture&&this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}SetTextureTracerDescript(t){this._TracerDescript=t}ReallocRenderTexture(){}}i.ImageTexture=T;class S extends i.ImageTexture{constructor(t,e,n,s,r,a){const o=i.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"IMG");o.Set={URL:e,Siz:s,Clr:r||"",IsF:n?1:0,NtS:a,ILd:0},super(t,o),this.Name="IMG",this.Source=e,this.IsForever=n?1:0,this.TargetSize=s,this.ColorSpace=r||"",this.NetSetting=a||null,this._InstantLoad=0,this._ImageElement=new Image,this._ImageElement.onload=function(){this._Loaded()}.bind(this),this._ImageElement.onerror=function(){this._Loaded()}.bind(this),this._ImageElement.src=e,this.RenderTexture.NeedCheckExpired=!0}_Loaded(){this.RenderTexture.Unloaded=!1,this.RenderTexture.LoadTime=Date.now(),this.RenderTexture.Width=this._ImageElement.width,this.RenderTexture.Height=this._ImageElement.height,this.RenderTexture.InvokeOnloadCallbacks()}InstantLoad(t){if(this._InstantLoad=t?1:0,this.RenderTexture){const t=this.RenderTexture.GetResourceInfo();null!==t&&(t.Set.ILd=this._InstantLoad,this.RenderTexture.SetResourceInfo(t))}return this}ReallocRenderTexture(){if(this.IsForever)return void i.LogE("ReallocRenderTexture(): NOT need for forever texture");const t=this.Source,e=this.TargetSize,n=this.ColorSpace,s=this.IsForever,r=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Manager.GetId(),this.Name);r.Set={URL:t,Siz:e,Clr:n,IsF:s,ILd:this._InstantLoad},this.RenderTexture=i.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(r),this._Manager.CachedTextureManager.CacheTheTexture(this)}}i.UrlImageTexture=S;class y extends i.ImageTexture{constructor(t,e,n,s,r){const a=i.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"GRAD");a.Set={URL:r},super(t,a),this.Gradient=r}}i.GradientTexture=y;class x extends i.ImageTexture{constructor(t,e,n,s,r,a,o,l,h,u,c){const d=i.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"TST");let _=null;c&&(_={x:0,y:0,w:0,h:0},Object.assign(_,c)),d.Set={ST:e,IDS:n.GetIdsPack(),W:Math.floor(r.width+.5),H:Math.floor(r.height+.5),FS:a,LA:h,EM:u,LH:Math.floor(o+.5),ILD:l?1:0,TLC:s?1:0,EA:_},super(t,d),this.Name="TST",this._TextStylePack=n,n.DoRef()}UnloadTex(){this._TextStylePack.UnRef(),super.UnloadTex()}}i.TextStyleTexture=x;i.CachedTextureManager=class{constructor(t){this._TextureManager=t,this._Renderer=t.GetRenderer(),this._CachedTextureStack=[],this._LockedTextureStack=[],this._MemoryLimited=10485760,this._VisibleMark=1}SetMemoryLimited(t){this._MemoryLimited=1024*t*1024}_FindTexture(t,e,i){for(let n=this._CachedTextureStack.length-1;n>=0;n--){const s=this._CachedTextureStack[n];if(s.Source===t&&(e===s.TargetSize||null!==e&&e.Equals(s.TargetSize))&&i===s.ColorSpace){if(null===s.RenderTexture)continue;return s}}return null}CacheTheTexture(t){for(let e=this._CachedTextureStack.length-1;e>=0;e--)if(t===this._CachedTextureStack[e])return;this._CachedTextureStack.push(t)}_MarkVisibleViewTextures(t,e){t.TextureSetting&&t.TextureSetting.Texture&&(t.TextureSetting.Texture.VisibleMark=e);const i=t.ChildViews.length;for(let n=0;n<i;n++){const i=t.ChildViews[n];i&&"VISIBLE"!==i.Visibility||this._MarkVisibleViewTextures(i,e)}}ReduceInvisibleTexture(t){this._MarkVisibleViewTextures(t,++this._VisibleMark);for(let t=0;t<this._CachedTextureStack.length;t++){const e=this._CachedTextureStack[t];e.VisibleMark!==this._VisibleMark&&(e.UnloadTex(),this._CachedTextureStack.splice(t,1),t--)}}GetCacheSize(){return this._CachedTextureStack.length}};const E=new Map;let v=0;const L=new Map;let I=0;class A{constructor(){this.CachedTextureManager=new i.CachedTextureManager(this),this._ForeverCachedTextureManager=new i.CachedTextureManager(this),this._AtlasDataInfo={atlas_data:[],buffer_data_offset:0,textures:[]},this._ClearTimer=-1,this._ImageTextureTracer=[],this._Id=A.sTextureManagerToken++,this._CacheMaxSize=100,this.StartScavengerCachedTimer()}StartScavengerCachedTimer(){-1===this._ClearTimer&&(this._ClearTimer=i.ForegroundTimer.setInterval(this.ScavengerCached.bind(this),3e4))}GetId(){return this._Id}GetRenderer(){return i.sDeprecatedRenderer}GetGifImage(t,e,i){return this.GetImage(t,e,i)}GetImage(t,e,n){if(!t)return i.LogI("GetImage, url is null!"),null;return this._GetImageInternal(t,null,i.ColorSpace.RGBA_8888,e,!1,n)}GetImage2(t,e,n,s,r){if(!t)return i.LogI("GetImage2, url is null!"),null;const a=i.sRectUitls.FormatRectArea(n);"string"!=typeof s&&(s=t.indexOf(".pkm")>=0?t.indexOf(".pkma")>=0?i.ColorSpace.RGBA_ETC1:i.ColorSpace.RGB_ETC1:i.ColorSpace.RGB_565);return this._GetImageInternal(t,a,s,e,!1,r)}CreateMiniGradientTexture(t,e,n,s){return new i.GradientTexture(this,t,e,n,s)}_GetImageInternal(t,e,n,s,r,a){if(s){const i=this._ForeverCachedTextureManager._FindTexture(t,e,n);if(i)return i}else{const i=this.CachedTextureManager._FindTexture(t,e,n);if(i)return i}const o=new i.UrlImageTexture(this,t,s,e,n,a);return o.IsForever?this._ForeverCachedTextureManager.CacheTheTexture(o):this.CachedTextureManager.CacheTheTexture(o),o}GetRoundCornerMask(t,e){return this.GetCustomCornerMask(t,e,e,e,e)}GetCustomCornerMask(t,e,n,s,r){const a=i.sRectUitls.FormatRectArea(t),o=Math.max(e,n,s,r);if(o>a.width/2||o>a.height/2)return i.LogE(`TextureManager.GetRoundCornerMask(): radius is too large, radius=${o} w=${a.width} h=${a.height}`),null;const l=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CCM");l.Set={W:a.width,H:a.height,LT:e,RT:n,LB:s,RB:r};const h=new i.ImageTexture(this,l);return i.ForgeDebug.EnableTextureTracer&&h.SetTextureTracerDescript("CornerMask"),h}GetOneCornerMask(t){const e=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"OCM");e.Set={Rad:t};const n=new i.ImageTexture(this,e);return i.ForgeDebug.EnableTextureTracer&&n.SetTextureTracerDescript("OneCornerMask"),n}GetTextTextureFromStylePack(t,e,n,s,r,a,o,l,h,u){return t&&0!==t.length?new i.TextStyleTexture(this,t,e,n,s,r,a,o,l,h,u):null}_getParamsId(t,e,i){const n=t.font,s=t.size,r=t.italic,a=t.bold,o=t.alignment,l=t.vertical_align,h=t.vertical_area_align,u=t.textColour,c=t.backgroundColour,d=t.shadow;let _="";t.stroke_width&&(_=t.stroke_width);const f=e.text_overflow,g=e.word_wrap,m=[n,r,a,d,_].join(":"),p=[s,o,l,h,f,g].join(":");let w="",b="";return E.has(m)?w=E.get(m):(w=`TS${v}`,E.set(m,w),v++),L.has(p)?b=L.get(p):(b=`DS${I}`,L.set(p,b),I++),[w,b,u,c]}GetTextTextureByMultiRows(t,e,n,s,r,a,o,l,h){const u=t.str;if(null===u||0===u.length)return null;const c=i.sRenderBridge.GetScreenInfo().scaleRatio,d=Object.assign(n);d.x*=c,d.y*=c,d.width*=c,d.height*=c;const _=Object.assign(t);_.size=Math.ceil(_.size*c),s*=c;const f={ST:t.str,AT:JSON.stringify({TO:e.text_overflow,WW:e.word_wrap}),RA:JSON.stringify({X:parseInt(d.x+.5,10),Y:parseInt(d.y+.5,10),W:parseInt(d.width+.5,10),H:parseInt(d.height+.5,10)}),LA:l,LH:parseInt(s+.5,10),ILD:void 0!==o?o:1};if(a&&(f.SH=JSON.stringify({T:a.Type,P:a.Params})),void 0!==window.JsView&&void 0!==window.JsView.ForgeNativeRevision&&window.JsView.ForgeNativeRevision>0){const t=this._getParamsId(_,e,a);f.PI={FS:t[0],DS:t[1],TC:t[2],BC:t[3]}}const g=this._BuildTextTextureAndSerialStatus(f,_);if(null!==h){const t=Object.assign({},f);t.ST=null,t.TLC=0,h.Set=t,h.Swf=Object.assign({},_)}let m=d.height;if(void 0!==window.PlatformUtils&&!1===r){m=window.PlatformUtils.GetTextRect(u,d,_,e,s).height}if(m=Math.floor(m/c+.5),i.ForgeDebug.EnableTextureTracer){let e=t.str;e.length>8&&(e=`${t.str.substr(0,8)}...`),g.SetTextureTracerDescript(`[${e}]`)}return{texture:g,real_height:m}}GetCopiedTextTexture(t,e,n,s){const r=Object.assign({},n.Set);r.ST=t,r.TLC=void 0!==s&&s?1:0;const a=n.Swf,o=i.sRenderBridge.GetScreenInfo().scaleRatio;r.RA=JSON.stringify({X:parseInt(e.x*o+.5,10),Y:parseInt(e.y*o+.5,10),W:parseInt(e.width*o+.5,10),H:parseInt(e.height*o+.5,10)});const l=this._BuildTextTextureAndSerialStatus(r,a);if(i.ForgeDebug.EnableTextureTracer&&t){let e=t;e.length>8&&(e=`${t.substr(0,8)}...`),l.SetTextureTracerDescript(`[${e}]`)}return l}_BuildTextTextureAndSerialStatus(t,e){i.sRenderTextureDelegateManager.AppendFontStatusIfNeed(t,e);let n=null;t.FO&&(n={STA:{Nam:"T",Sta:t.FO}});const s=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"T");return s.Set=t,new i.ImageTexture(this,s,n)}GetColorTexture(t){const e=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CT");e.Set={Clr:t};const n=new i.ImageTexture(this,e);return i.ForgeDebug.EnableTextureTracer&&n.SetTextureTracerDescript(`Color[${t}]`),n}GetColorTextureCached(t){return this.GetColorTexture(t)}ScavengerCached(){this.CachedTextureManager.GetCacheSize()>=this._CacheMaxSize&&this.CachedTextureManager.ReduceInvisibleTexture(i.sRootView)}GetOffScreenMediaTexture(t){if(void 0===window.OffscreenVideoPlayer||!(t instanceof window.OffscreenVideoPlayer))return null;if(!t.hasTerminator()){const e=this._BuildVideoTexture(t);t.setResourceTerminator((()=>{e.UnloadTex()}))}return this._BuildVideoTexture(t)}_BuildVideoTexture(t){const e=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"VPLY");e.Set={Hdl:t.mediaHandler()};const n=new i.ImageTexture(this,e);return i.ForgeDebug.EnableTextureTracer&&n.SetTextureTracerDescript(`Video[${t.mediaHandler()}]`),n}}A.sTextureManagerToken=100,i.TextureManager=A,window.TextureManager=i.TextureManager;i.LayoutViewDebugClass=class{SetTextureTracer(t){}GetTextureTracer(){return null}},i.ForgeDebug=new i.LayoutViewDebugClass,window.ForgeDebug=i.ForgeDebug;class C{constructor(){this.Width=0,this.Height=0,this.MarginTop=0,this.MarginLeft=0,this.MarginRight=0,this.MarginBottom=0,this.Z=0,this.SizeAdjust=!1}SetPosition(t,e,i){this.MarginTop=e,this.MarginLeft=t,i&&(this.Z=i)}SetSize(t,e){this.Width=t,this.Height=e}Clone(){const t=new C(null);return t.Width=this.Width,t.Height=this.Height,t.MarginTop=this.MarginTop,t.MarginLeft=this.MarginLeft,t.MarginRight=this.MarginRight,t.MarginBottom=this.MarginBottom,t.Z=this.Z,t.SizeAdjust=this.SizeAdjust,t}Equals(t){return t.Width===this.Width&&t.Height===this.Height&&t.MarginTop===this.MarginTop&&t.MarginLeft===this.MarginLeft&&t.MarginRight===this.MarginRight&&t.MarginBottom===this.MarginBottom&&t.Z===this.Z}}i.LayoutParamsBase=C;class P extends i.LayoutParamsBase{constructor(t){super(),t instanceof i.RectArea&&(t={x:t.x,y:t.y,width:t.width,height:t.height}),t&&(t.x?this.MarginLeft=t.x:t.marginLeft&&(this.MarginLeft=t.marginLeft),t.y?this.MarginTop=t.y:t.marginTop&&(this.MarginTop=t.marginTop),t.z&&(this.Z=t.z),t.width&&(this.Width=t.width),t.height&&(this.Height=t.height),isNaN(this.MarginTop)&&(i.LogE("isNaN(this.MarginTop)!"),this.MarginTop=0),isNaN(this.MarginLeft)&&(i.LogE("isNaN(this.MarginLeft)!"),this.MarginLeft=0),"MatchParent"!==this.Width?isNaN(this.Width)&&i.LogE("isNaN(this.Width)!"):this.SizeAdjust=!0,"MatchParent"!==this.Height?isNaN(this.Height)&&i.LogE("isNaN(this.Height)!"):this.SizeAdjust=!0)}}i.LayoutParams=P,window.LayoutParams=i.LayoutParams;i.RenderTextureDelegateManager=class{constructor(){this._IdTokenGenerator=66,i.sRenderTextureDelegateManager=this,this._CheckExpiredTime=0}CreateTextureHeadStatus(){const t=new i.RenderTextureDelegate(this,0);return t.DoRef(),t}CreateTextureStatus(){const t=new i.RenderTextureDelegate(this,0);return t.DoRef(),t}CreateTexture(){const t=new i.RenderTextureDelegate(this,this._IdTokenGenerator++);return t.DoRef(),t}RecycleTexture(t){}CreateResourceInfo(t,e){return{Id:0,Nam:e,Set:null,TmId:t,NdLd:0}}AppendFontStatusIfNeed(t,e){const i={};i.Fo=e.font,i.Si=e.size,i.It=e.italic,i.Bo=e.bold,i.Al=e.alignment,i.Ve=e.vertical_align,i.Vaa=e.vertical_area_align,i.Tx=e.textColour,i.Ba=e.backgroundColour,i.En=e.enableBlend,i.Sh=e.shadow,e.stroke_width?i.Stk=e.stroke_width:i.Stk=-1,t.FO=JSON.stringify(i)}},i.sRenderTextureDelegateManager=new i.RenderTextureDelegateManager;i.RenderTextureDelegate=class{constructor(t,e){this.IdToken=e,this._Manager=t,this._Reference=0,this._SyncingResourceInfo=null,this._OnloadCallbacks={},this._OnloadCallbacksSize=0,this._OnloadCallbackIdGenerator=1,this.Unloaded=!0,this.LoadTime=0,this.RequireTime=0,this.ForceExpire=!1,this.NeedCheckExpired=!1;if(i.ForgeDebug.GetTextureTracer()){const t=new Error;this.Stack=t.stack}}DoRef(){this._Reference++}UndoRef(){this._Reference--,0===this._Reference&&(this._OnloadCallbacksSize>0&&(this._OnloadCallbacks={}),this._Manager.RecycleTexture(this))}SetResourceInfo(t){t.Id=this.IdToken,this._SyncingResourceInfo=t}GetResourceInfo(){return this._SyncingResourceInfo}ReadSyncInfo(){const t=this._SyncingResourceInfo;return this._SyncingResourceInfo=null,t}RegisterOnloadCallback(t){const e=this._OnloadCallbackIdGenerator++;return this._OnloadCallbacks[`${e}`]=t,this._OnloadCallbacksSize++,null!==this._SyncingResourceInfo&&(this._SyncingResourceInfo.NdLd=1),e}UnregisterOnloadCallback(t){delete this._OnloadCallbacks[`${t}`],this._OnloadCallbacksSize--}InvokeOnloadCallbacks(){if(this._OnloadCallbacksSize>0)for(const t in this._OnloadCallbacks)this._OnloadCallbacks.hasOwnProperty(t)&&this._OnloadCallbacks[t]()}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}};i.DeprecatedRenderer=class{constructor(){i.sDeprecatedRenderer=this,this._SharedTextureManager=this.CreateTextureManager()}SetUserId(t){i.sRenderBridge.UpdateUserId(t)}GetScreenInfo(){return i.sRenderBridge.GetScreenInfo()}StringWithFont(){return i.sTextUtils.StringWithFont.apply(this,arguments)}GetTextWidth(){return i.sTextUtils.GetTextWidth.apply(this,arguments)}GetTextUtils(){return i.sTextUtils}RectArea(t,e,n,s){return new i.RectArea(t,e,n,s)}TextAttr(){return i.sTextUtils.TextAttr.apply(this,arguments)}GarbageCollect(){i.LogM("GarbageCollect called")}TriggerFrameDraw(){i.sRenderBridge.RequestSwap()}GetSharedTextureManager(){return this._SharedTextureManager}CreateTextureManager(){return new i.TextureManager}},i.sDeprecatedRenderer=null;const R={STRING:Symbol("STRING"),FUNCTION:Symbol("FUNCTION"),LINE_FEED:Symbol("LINE_FEED"),LEFT_BRACE:Symbol("LEFT_BRACE"),RIGHT_BRACE:Symbol("RIGHT_BRACE")};const D={},O={BASE:Symbol("BASE"),COLOR:Symbol("COLOR"),BOLD:Symbol("BOLD"),ITALIC:Symbol("ITALIC"),DECORATION:Symbol("DECORATION"),SUPERSCRIPT:Symbol("SUPERSCRIPT"),SUBSCRIPT:Symbol("SUBSCRIPT")};class k{constructor(){this.style,this.styleValue=""}}class F{constructor(){this.textStyle=new k,this.childNodes=[],this.parent}}class V extends F{constructor(){super(),this.styleList=[],this.indexPair,this.lineFeedNode=!1,this.testValue}}function M(t){if(null===t||0===t.length)return null;const e=function(t){const e=[];let i=0;for(;i<t.length;)if("\\"===t[i])if(i<t.length-1)if("\\"===t[i+1]||"{"===t[i+1]||"}"===t[i+1]){const t=[i+1,i+2],n={type:R.STRING,indexPair:t};e.push(n),i+=2}else{++i;const n=i;let s=i,r=!1;for(;i<t.length&&"{"!==t[i]&&"}"!==t[i];)" "!==t[i]&&(r=!0)," "===t[i]&&r?++i:s=++i;const a=[n,s],o={type:R.FUNCTION,indexPair:a};e.push(o)}else console.error("backslash at end.");else if("{"===t[i]){const t={type:R.LEFT_BRACE,indexPair:null};e.push(t),++i}else if("}"===t[i]){const t={type:R.RIGHT_BRACE,indexPair:null};e.push(t),++i}else if("\n"===t[i]){const t={type:R.LINE_FEED,indexPair:null};e.push(t),++i}else{const n=i;let s=i;for(;i<t.length&&"\\"!==t[i]&&"{"!==t[i]&&"}"!==t[i]&&"\n"!==t[i];)++i,s=i;const r=[n,s],a={type:R.STRING,indexPair:r};e.push(a)}for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.type===R.STRING){let s=!0;for(let e=n.indexPair[0];e<n.indexPair[1];e++)if(" "!==t[e]){s=!1;break}!(s&&i>0&&i<e.length-1)||e[i-1].type!==R.LEFT_BRACE&&e[i-1].type!==R.RIGHT_BRACE||e[i+1].type!==R.RIGHT_BRACE&&e[i+1].type!==R.LEFT_BRACE||e.splice(i,1)}}return e}(t),i=[],n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.type===R.STRING){const t=new V;n.push(t),t.indexPair=r.indexPair,t.textStyle.style=O.BASE,i.push(t)}else if(r.type===R.LINE_FEED){const t=new V;n.push(t),t.lineFeedNode=!0}else if(r.type===R.LEFT_BRACE)i.push(D);else if(r.type===R.RIGHT_BRACE)if(i.length>0){const t=[];let e=i.pop();for(;e!==D&&(t.push(e),i.length>0);)e=i.pop();if(i.length>0){const e=i[i.length-1];if(e.textStyle.style===O.BASE)console.error("lack of function");else for(;t.length>0;){const i=t.pop();e.childNodes.push(i),i.parent=e}}else console.error("lack of function")}else console.error("extra }");else if(r.type===R.FUNCTION){const n=t.substring(r.indexPair[0],r.indexPair[1]),a=new F;switch(n){case"textcolor":if(s<e.length-3){a.textStyle.style=O.COLOR;const i=e[s+1],n=e[s+2],r=e[s+3];i.type===R.LEFT_BRACE&&n.type===R.STRING&&r.type===R.RIGHT_BRACE?(a.textStyle.styleValue=t.substring(n.indexPair[0],n.indexPair[1]),s+=3):console.error("textcolor param format error.")}else console.error("textcolor param format error.");break;case"textb":a.textStyle.style=O.BOLD;break;case"texti":a.textStyle.style=O.ITALIC;break;case"textdecoration":if(s<e.length-3){a.textStyle.style=O.DECORATION;const i=e[s+1],n=e[s+2],r=e[s+3];i.type===R.LEFT_BRACE&&n.type===R.STRING&&r.type===R.RIGHT_BRACE?(a.textStyle.styleValue=t.substring(n.indexPair[0],n.indexPair[1]),s+=3):console.error("textdecoration param format error.")}else console.error("textdecoration param format error.");break;case"textsup":a.textStyle.style=O.SUPERSCRIPT;break;case"textsub":a.textStyle.style=O.SUBSCRIPT;break;default:console.error(`undefined style type: ${n}`)}i.push(a)}++s}return n.forEach(((t,e,i)=>{let n=t.parent;for(;n;)t.styleList.push(n.textStyle),n=n.parent})),{nodeList:n,text:t}}function G(){this.positionQueue=[],this.timeQueue=[]}G.prototype.reset=function(){this.positionQueue=[],this.timeQueue=[]},G.prototype.pruneQueue=function(t){for(;this.timeQueue.length&&this.timeQueue[0]<Date.now()-t;)this.timeQueue.shift(),this.positionQueue.shift()},G.prototype.updatePosition=function(t){this.positionQueue.push(t),this.timeQueue.push(Date.now()),this.pruneQueue(50)},G.prototype.getVelocity=function(){this.pruneQueue(1e3);const t=this.timeQueue.length;if(t<2)return 0;const e=(this.timeQueue[t-1]-this.timeQueue[0])/1e3,i=this.positionQueue[t-1]-this.positionQueue[0];return console.log(`getVelocity distance:${i}, time:${e}, velocity:${i/e}, this.timeQueue[length-1]:${this.timeQueue[t-1]}, this.timeQueue[0]:${this.timeQueue[0]}`),i/e},window.gRootView=null,i.sRootView=null;i.TextureSetting=class{constructor(t,e,n,s){this.Texture=t,this._IsTextureExternal=!1,e instanceof i.ImageTexture?(e&&e.RenderTexture&&e.RenderTexture.NeedCheckExpired&&(e.RenderTexture.RequireTime=0),this.MaskSetting=new i.ViewTextureMask(e)):this.MaskSetting=e,t&&t.RenderTexture&&t.RenderTexture.NeedCheckExpired&&(t.RenderTexture.RequireTime=0),this._IsMaskTextureExternal=!1,this.TextureBeforeImageLoad=n,this._IsPreloadImageTextureExternal=!1,void 0===s&&(s=!0),this.HasAlpha=s}SetExternal(t,e,i){this._IsTextureExternal=t,this._IsMaskTextureExternal=e,this._IsPreloadImageTextureExternal=i}ReleaseInternalTexture(t,e){!this._IsTextureExternal&&this.Texture&&(this.Texture.UnloadTex(),this.Texture=null),!this._IsMaskTextureExternal&&this.MaskSetting&&(this.MaskSetting.UnLoad(),this.MaskSetting=null),!this._IsPreloadImageTextureExternal&&this.TextureBeforeImageLoad&&(this.TextureBeforeImageLoad.UnloadTex(),this.TextureBeforeImageLoad=null)}DebugPrint(){return` _IsTextureExternal=${this._IsTextureExternal}`}},window.TextureSetting=i.TextureSetting;class N extends i.TextureSetting{constructor(t,e,i,n){super(t,e,i,n),this.SetExternal(!0,!0,!0)}}i.ExternalTextureSetting=N,window.ExternalTextureSetting=i.ExternalTextureSetting;i.PackedLayout=class{constructor(t){const e=t.RectInfo;this.RectInfo={coordX:e.coordX,coordY:e.coordY,width:e.width,height:e.height},this.LayoutParams=JSON.parse(JSON.stringify(t.LayoutParams))}ApplyToView(t){const e=this.RectInfo;t.RectInfo={coordX:e.coordX,coordY:e.coordY,width:e.width,height:e.height},t.LayoutParams=JSON.parse(JSON.stringify(this.LayoutParams))}};i.ViewMask=class{constructor(){this._MaskType="COMMON"}Type(){return this._MaskType}UnLoad(){}};class B extends i.ViewMask{constructor(t){super(),this._MaskType="TEXTURE",this.ImageTexture=t}UnLoad(){this.ImageTexture.UnloadTex()}}i.ViewTextureMask=B;class W extends i.ViewMask{constructor(t,e,i,n){super(),this._MaskType="CORNER",this._TopLeft=t,this._TopRight=isNaN(e)?t:e,this._BottomLeft=isNaN(i)?t:i,this._BottomRight=isNaN(n)?t:n,this._CornersWidth=[0,0,0,0],this._CornersDisable=[0===this._TopLeft?1:0,0===this._TopRight?1:0,0===this._BottomLeft?1:0,0===this._BottomRight?1:0]}UnLoad(){}}i.ViewRoundCornerMask=W;i.DragSetting=class{constructor(t,e,n,s,r,a){this.DragDirection=t||0,this.TriggerMovedDistance=e||0,this._EnableJsFling=n?1:0,this.SlidePile=s||new i.RectArea(0,0,1280,720),this.PageWidth=r>0?r:65535,this.EnableTabMode=r>0,this.PageEdge=a||1/4}},i.DragSetting.DIRECTION_DISABLE=0,i.DragSetting.DIRECTION_VERTICAL=1,i.DragSetting.DIRECTION_HORIZONTAL=2,i.DragSetting.DIRECTION_AUTO=i.DragSetting.DIRECTION_VERTICAL|i.DragSetting.DIRECTION_HORIZONTAL,i.DragInfo=class{constructor(){this.Settings=null,this.Listener=null,this.ListenerFlags=0,this.OverListener=null,this.OverListenerFlags=0,this.Formula=null,this.SyncString=null}SetListener(t){this.Listener=t}},i.DragInfo.INFLEXION=.35,i.DragInfo.DECELERATION_RATE=Math.log(.78)/Math.log(.9),i.DragInfo.PHYSICAL_COEF=51890.2,i.DragInfo.SCROLL_FRICTION=.06,i.DragInfo.EVENT_TYPE={OnDown:0,OnTap:1,OnLongPress:2,OnDragStart:3,OnMoved:4,OnDragEnd:5,OnRelease:6,OnFling:7};let $=0;class H{constructor(t,e){this.TextureSetting=t,t&&console.error("LayoutViewBase constructor texture_setting not undefined!"),this._dispatchLongPress=this._dispatchLongPress.bind(this),this.Visibility="VISIBLE",this.LayoutParams=null,this.ParentView=null,this.ChildViews=[],this.zIndex=0,this._Perspective=0,this._PerspectiveAnchor=[.5,.5],this._BackfaceVisibility=1,this._DebugCount=++$,this.childZIndexCount=0,this._IsChildOfRootView=!1,this._DetachFromSystemCallback=null,this.Element=null,this.InnerChildElement=null,"root"===e?(this.Element=window.originDocument.getElementById(e),this.Element||(this.Element=window.originDocument.getElementById("app"))):"svg"===e||"path"===e?this.Element=document.createElementNS("http://www.w3.org/2000/svg",e):e&&(this.Element=window.originDocument.createElement(e),"div"!=e&&(this.Element.style.position="absolute")),this.TransitionStore={},this.TransformAnimationObj=null,this._TextureAnimationObj=null,this._DragInfo=null,this.DragControl=null,this._Velocity={x:new G,y:new G},this._TouchSlopSquare=64,this._InDragging=null,this._InLongPress=null,this._AlwaysInTapRegion=null,this._LastFocusX=null,this._LastFocusY=null,this._DownFocusX=null,this._DownFocusY=null,this._LastTimeStamp=null,this._ObjectFitTestCache=null,this._ProxyView=null,this.Expired=!1}Init(t){this.ResetTexture(t)}SetElementProp(t,e){t&&Object.keys(t).forEach((e=>{switch(e){case"jsv_enable_fade":case"jsv_poster_on_top":case"jsv_media_usetexture":case"jsv_text_definition":break;case"jsv_innerview":{const n=i.sViewStore.get(t[e]);if(n){const t=n.view;null==this.LayoutParams&&this.ResetLayoutParams({x:0,y:0,width:0,height:0});let e=this.LayoutParams;this.ResetLayoutParams({x:0,y:0,width:0,height:0}),t&&(null===this._ProxyView?this._InsertProxyLayer(t,e):t!==this._ProxyView&&console.error("Error: Can not reset proxy view"))}break}default:i.LogE(`Error: View Unknown prop name=${e}`)}}))}InsertView(t,e,i,n){this._InsertView(t,e,i,n)}AddView(t,e,i){this._InsertView(t,null,e,i)}MoveChildView(t,e,n){if(null!=this._ProxyView&&t!=this._ProxyView)return void this._ProxyView.MoveChildView(t,e);let s=!1;for(var r=0;r<this.ChildViews.length;r++)if(this.ChildViews[r]==t){0!=t.zIndex&&this.childZIndexCount--,this.ChildViews.splice(r,1),t.ParentView=null,s=!0;break}s||i.LogE("MoveChildView(): view is not in child list stack="),e._InsertView(t,n,t.LayoutParams);let a=null;n&&(a=e.ChildViews[e.ChildViews.indexOf(n)+1]),a&&e.Element.contains(a.Element)?e.Element.insertBefore(t.Element,a.Element):e.Element.appendChild(t.Element)}_InsertView(t,e,n,s){if(n?n instanceof i.LayoutParamsBase?t.LayoutParams=n.Clone():t.LayoutParams=new i.LayoutParams(n):t.LayoutParams||(t.LayoutParams=new i.LayoutParams({x:0,y:0})),null!==t.LayoutParams&&(t.LayoutParams.MarginLeft&&(t.Element.style.left=`${t.LayoutParams.MarginLeft}px`),t.LayoutParams.MarginTop&&(t.Element.style.top=`${t.LayoutParams.MarginTop}px`),t.LayoutParams.Width&&(t.Element.style.width=`${t.LayoutParams.Width}px`),t.LayoutParams.Height?t.Element.style.height=`${t.LayoutParams.Height}px`:t.Element.style.height=""),t.ParentView=this,e){let i=this.ChildViews.indexOf(e);i<0&&(i=this.ChildViews.length),this.ChildViews.splice(i,0,t)}else this.ChildViews.push(t);this._ChildrenListDirty=!0,this._IsChildOfRootView&&t._OnAttachToSystem(),0!=t.zIndex&&this.childZIndexCount++,this.childZIndexCount>0&&this._RequestZIndexReorder()}SetZIndex(t){if(t!=this.zIndex){var e=this.zIndex;this.zIndex=t;var n=this.ParentView;n&&(0==e&&0!=t?n.childZIndexCount++:0!=e&&0==t&&n.childZIndexCount--,n.childZIndexCount<0&&i.ThrowError("ERROR: LayoutViewBase, child z-index count ERROR"),n._RequestZIndexReorder())}}_RequestZIndexReorder(){let t=[],e=[],i=0,n=this.ChildViews.length;for(var s=0;s<n;s++){let n=this.ChildViews[s].zIndex;n<0?(n<i&&(i=n),t.push(this.ChildViews[s])):n>0&&e.push(this.ChildViews[s])}i=1e3*Math.floor(-i/1e3)+1e3;let r=t.length,a=e.length;if(r>0){t.sort(((t,e)=>t.zIndex-e.zIndex));for(s=0;s<r;s++)t[s].Element.style.zIndex=t[s].zIndex+i}if(this.ChildViews.length-t.length-e.length>0)for(s=0;s<n;s++)0==this.ChildViews[s].zIndex&&(this.ChildViews[s].Element.style.zIndex=i);if(a>0){e.sort(((t,e)=>t.zIndex-e.zIndex));for(s=0;s<a;s++)e[s].Element.style.zIndex=e[s].zIndex+i}}SetPerspective(t,e){this.Element.style.perspective=`${t}px`,this.Element.style.webkitPerspective=`${t}px`,this.Element.style.perspectiveOrigin=e,this.Element.style.webkitPerspectiveOrigin=e,this._Perspective=t,this._PerspectiveOrigin=e}SetBackfaceVisibility(t){console.log("set back face",t),this.Element.style.backfaceVisibility=t?"visible":"hidden",this.Element.style.webkitBackfaceVisibility=t?"visible":"hidden",console.log(`back face style ${this.Element.style.backfaceVisibility}`),this._BackfaceVisibility=t?1:0}SetTransformStyle(t){this.Element.style.transformStyle=t,this.Element.style.webkitTransformStyle=t,this._TransformStyle=t}EnableDivTouch(t,e){t.eventHandlers&&t.eventHandlers.onClick&&(this.Element.onclick=e=>{t.eventHandlers.onClick(),e.preventDefault&&e.preventDefault()},this.Element.style.pointerEvents="auto")}_DoDragPause(t){this._DragInfo.Settings.EnableTabMode||this.DragControl&&this.DragControl.pause(((e,i)=>{if(null!==this.Element.style.transform){let n=this.GetLayoutParams();n=this._GetMovedLayoutParams(e-n.MarginLeft,i-n.MarginTop),this.ResetLayoutParams(n),this._DragImactSensorRecycle(),console.log(`_DoDragPause lp.MarginLeft:${n.MarginLeft}, lp.MarginTop:${n.MarginTop}`),this.DragControl=null,this.Element.style.transform=null,t.viewX=e,t.viewY=i,this._DragInfo.Listener.OnFling(t)}}))}TouchEventProcess(t){let e=!1;switch(t.type){case i.DragInfo.EVENT_TYPE.OnDown:console.log("TouchEventProcess OnDown in"),this._DoDragPause(t),this._DragInfo.Listener&&this._DragInfo.Listener.OnDown&&(e=this._DragInfo.Listener.OnDown(t));break;case i.DragInfo.EVENT_TYPE.OnTap:this._DragInfo.Listener&&this._DragInfo.Listener.OnTap&&(e=this._DragInfo.Listener.OnTap(t));break;case i.DragInfo.EVENT_TYPE.OnLongPress:this._DragInfo.Listener&&this._DragInfo.Listener.OnLongPress&&(e=this._DragInfo.Listener.OnLongPress(t));break;case i.DragInfo.EVENT_TYPE.OnDragStart:this._DragMovedDistanceX=0,this._DragMovedDistanceY=0,this._DragInfo.Listener&&this._DragInfo.Listener.OnDragStart&&(e=this._DragInfo.Listener.OnDragStart(t));break;case i.DragInfo.EVENT_TYPE.OnMoved:this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved&&(e=this._DoDragMove(t,!0));break;case i.DragInfo.EVENT_TYPE.OnDragEnd:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnDragEnd){e=!!this._SlideIfEnableTabMod(t,-1)||this._DoDragEnd(t)}break;case i.DragInfo.EVENT_TYPE.OnRelease:this._DragInfo.Listener&&this._DragInfo.Listener.OnRelease&&(e=this._DragInfo.Listener.OnRelease(t));break;case i.DragInfo.EVENT_TYPE.OnFling:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnFling){e=!!this._SlideIfEnableTabMod(t,-1)||this._DoFling(t)}break;default:console.log(`TouchEventProcess:${t}`)}return e}DisableDrag(){this._DragInfo=null}EnableDrag(t,e,n){t instanceof i.DragSetting||i.ThrowError("EnableDrag The setting is not Forge.DragSetting"),null===e&&i.ThrowError("EnableDrag The listener is null");const s=new i.DragInfo;s.Settings=t,s.SetListener(e),s.Formula=n,this._DragInfo=s,this.DragControl=null,this._AddEventListener(),i.sRenderBridge.RequestSwap()}RemoveView(t){for(let e=0;e<this.ChildViews.length;e++)if(this.ChildViews[e]===t){t.IsChildOfRootView()&&t._OnDetachFromSystem(),this.ChildViews.splice(e,1),t.ParentView=null;break}}_OnDetachFromSystem(){this._IsChildOfRootView=!1,this._DetachFromSystemCallback?(this._DetachFromSystemCallback.some(((t,e,i)=>{t()})),this._DetachFromSystemCallback=null):this.OnDettachFromSystem();for(let t=0;t<this.ChildViews.length;t++){this.ChildViews[t]._OnDetachFromSystem()}this.ParentView.Element.removeChild(this.Element),this._releaseViewResources()}RegisterDetachCallback(t){t&&(null==this._DetachFromSystemCallback&&(this._DetachFromSystemCallback=[]),this._DetachFromSystemCallback.push(t))}UnregisterDetachCallback(t){if(t&&this._DetachFromSystemCallback){let e=!1,i=this._DetachFromSystemCallback;for(let n=0;n<i.length;n++)if(i[n]===t){i.splice(n,1),e=!0;break}e?0==i.length&&(this._DetachFromSystemCallback=null):console.error("no found")}else console.error("Unregister nothing...")}OnDettachFromSystem(){}_releaseViewResources(){this.Expired||(this.StopAnimation(),this.StopTextureAnimation(),this.Expired=!0)}ClearViews(){const t=this.ChildViews.length;if(0!==t){for(let e=0;e<t;e++){const t=this.ChildViews[e];t&&t.IsChildOfRootView()&&t._OnDetachFromSystem()}this.ChildViews=[]}}_ResetTextStyle(t){this.Element.style.overflow="hidden";let e=i.sTextStyleCache.GetDsFromId(t.Set.IDS.DS).Describe,n=i.sTextStyleCache.GetFsFromId(t.Set.IDS.FS).Describe,s=i.sTextStyleCache.GetCsFromId(t.Set.IDS.CS).Describe,r=null;"DISABLE"!==t.Set.IDS.SS&&(r=i.sTextStyleCache.GetSsFromId(t.Set.IDS.SS).Describe),this.Element.style.fontFamily=n.font,this.Element.style.fontSize=`${t.Set.FS}px`,n.italic&&(this.Element.style.fontStyle="italic"),n.bold?this.Element.style.fontWeight="bold":this.Element.style.fontWeight="normal",this.Element.style.textOverflow=e.text_overflow,this.Element.style.wordBreak="normal";let a=e.word_wrap;"none"===a?this.Element.style.whiteSpace="nowrap":a&&(this.Element.style.wordWrap=a.replace("_","-")),this.Element.style.textAlign=e.alignment,this.Element.style.verticalAlign=e.vertical_area_align,this.Element.style.direction=e.direction;let o=s.text_color;o.startsWith("#")&&9===o.length&&(o="#"+o.substr(3,6)),this.Element.style.color=o;let l=s.bg_color,h=!1;if(l.startsWith("#")&&9===l.length&&(h=l.startsWith("#00"),l="#"+l.substr(3,6)),h||(this.Element.style.backgroundColor=l),r&&(r.shadow_blur>0&&(this.Element.style.textShadow=`${r.shadow_offset_x}px ${r.shadow_offset_y}px ${r.shadow_blur}px ${r.shadow_color}`),r.stroke_width>0&&(this.Element.style.WebkitTextStroke=`${r.stroke_width}px ${r.stroke_color}`)),this.Element.style.width=`${t.Set.W}px`,this.Element.style.height=`${t.Set.H}px`,t.Set.LH&&(this.Element.style.lineHeight=`${t.Set.LH}px`),t.Set.EA){let e=t.Set.EA,i=window.originDocument.createElement("div");i.style.float=e.x>0?"right":"left",i.style.width=e.w+"px",i.style.height=e.h-1+"px",i.style.backgroundColor="rgba(0,0,0,0)",i.style.position="relative",this.Element.appendChild(i)}if(t.Set.LA){const e=M(t.Set.ST);!function(t,e){const i=e.text;for(const n of e.nodeList){if(n.lineFeedNode){t.appendChild(window.originDocument.createElement("br"));continue}const e=i.substring(n.indexPair[0],n.indexPair[1]),s=window.originDocument.createElement("span");let r,a=s;for(const t of n.styleList)switch(t.style){case O.BASE:break;case O.BOLD:r=window.originDocument.createElement("b"),a.appendChild(r),a=r;break;case O.ITALIC:r=window.originDocument.createElement("i"),a.appendChild(r),a=r;break;case O.COLOR:s.style.color=t.styleValue;break;case O.DECORATION:s.style.textDecoration=t.styleValue;break;case O.SUPERSCRIPT:r=window.originDocument.createElement("sup"),a.appendChild(r),a=r;break;case O.SUBSCRIPT:r=window.originDocument.createElement("sub"),a.appendChild(r),a=r}a.textContent=e,t.appendChild(s)}}(this.Element,e)}else{let e=window.originDocument.createElement("span");e.textContent=t.Set.ST,this.Element.appendChild(e)}}_SetBorderRadius(t){(this.InnerChildElement?this.InnerChildElement:this.Element).style.borderRadius=`${t._TopLeft}px ${t._TopRight}px ${t._BottomRight}px ${t._BottomLeft}px`}_InsertProxyLayer(t,e){if(t.ParentView=this,this._IsChildOfRootView){for(let t of this.ChildViews)t._AdvanceDepthForProxyLayer();t._OnAttachToSystem()}t.ChildViews=t.ChildViews.concat(this.ChildViews),t._ChildrenListDirty=!0;for(let e=0;e<t.ChildViews.length;e++)t.ChildViews[e].ParentView=t,t._RequestLayoutForAddingView(t.ChildViews[e]);null!==e?e instanceof i.LayoutParamsBase?t.LayoutParams=e.Clone():t.LayoutParams=new i.LayoutParams(e):null===t.LayoutParams&&(t.LayoutParams=new i.LayoutParams({x:0,y:0})),t.ResetLayoutParams(t.LayoutParams),this.ChildViews=[t],this._ChildrenListDirty=!0,this._RequestLayoutForAddingView(t),this._ProxyView=t,this._IsChildOfRootView&&t._OnAttachToSystem()}_RequestLayoutForAddingView(t){this._RequestLayout()}ResetTexture(t){if(this.TextureSetting=t,t){if(t.Texture.Source)"IMG"===this.Element.tagName?this.Element.src=t.Texture.Source:(this.Element.style.backgroundImage=`url(${t.Texture.Source})`,this.Element.style.backgroundSize="100% 100%");else if(t.Texture.Gradient)this.Element.style.backgroundImage=t.Texture.Gradient;else if(t.Texture.RenderTexture&&t.Texture.RenderTexture._SyncingResourceInfo){const e=t.Texture.RenderTexture._SyncingResourceInfo;if("TST"===e.Nam)this._ResetTextStyle(e);else if("CT"===e.Nam)this.Element.style.backgroundColor=e.Set.Clr;else if("VPLY"===e.Nam){const t=e.Set.Hdl;t.style.width="100%",t.style.height="100%",t.style.objectFit="fill",this.Element.appendChild(t),this.InnerChildElement=t}}t.MaskSetting&&"CORNER"===t.MaskSetting._MaskType&&this._SetBorderRadius(t.MaskSetting)}else this.Element.style.backgroundColor="",this.Element.style.backgroundImage="",this.Element.style.borderRadius=""}SetVisibility(t){this.Element.style.visibility="string"==typeof t?t.toLocaleLowerCase():"inherit"}_OnAttachToSystem(){"svg"!==this.Element.id&&"path"!==this.Element.id||console.log("_OnAttachToSystem appendChild");let t=this.ParentView.ChildViews[this.ParentView.ChildViews.indexOf(this)+1];t&&this.ParentView.Element.contains(t.Element)?this.ParentView.Element.insertBefore(this.Element,t.Element):this.ParentView.Element.appendChild(this.Element),this._IsChildOfRootView=!0;const e=this.ChildViews;let i;for(let t=0;t<e.length;t++)i=e[t],i._OnAttachToSystem()}IsChildOfRootView(){return this._IsChildOfRootView}StartAnimation(t,e,i){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(t),this.TransformAnimationObj=null,window.jsvInAndroidWebView?this.Element.style.webkitAnimation=null:this.Element.style.animation=null),null==this._ProxyView?(this.TransformAnimationObj=t,!isNaN(i)&&i>0&&t.EnableDelay(i),t.Start(this)):this._ProxyView.StartAnimation(t,e,i)}ApplyStyleTransition(t){this.TransitionStore={...this.TransitionStore,...t};let e="";Object.values(this.TransitionStore).forEach((t=>{e&&(e+=","),e+=t})),window.jsvInAndroidWebView?this.Element.style.webkitTransition=e:this.Element.style.transition=e}StopAnimation(){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(),this.TransformAnimationObj=null),null==this._ProxyView||this._ProxyView.StopAnimation()}StartTextureAnimation(t){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(t),this._TextureAnimationObj=null),this._TextureAnimationObj=t,t.AsTextureAnimation(),t.Start(this),this._RequestLayout()}_RequestLayout(){}StopTextureAnimation(){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(),this._TextureAnimationObj=null)}StopAllAnimations(){this.StopAnimation(),this.StopTextureAnimation();for(let t=0;t<this.ChildViews.length;t++)this.ChildViews[t].StopAllAnimations()}GetAnimation(){return this.TransformAnimationObj}DetachAnimation(t){this.TransformAnimationObj===t&&(this.TransformAnimationObj=null,window.jsvInAndroidWebView?(this.Element.style.webkitAnimation=null,this.Element.style.webkitTransition=null):(this.Element.style.animation=null,this.Element.style.transition=null))}ResetCssTransform(t,e){t===this._CssTransform&&e===this._CssTransformOrigin||(window.jsvInAndroidWebView?(this.Element.style.webkitTransform=t,this.Element.style.webkitTransformOrigin=e):(this.Element.style.transform=t,this.Element.style.transformOrigin=e),this._CssTransform=t,this._CssTransformOrigin=e)}ResetTextureCssTransform(t,e){this.ResetCssTransform(t,e)}SetId(t){this.Id=t}ResetLayoutParams(t){null==this._ProxyView?null!==t?(t instanceof i.LayoutParamsBase?this.LayoutParams=t.Clone():this.LayoutParams=new i.LayoutParams(t),this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`,this.LayoutParams.Width&&(this.Element.style.width=`${this.LayoutParams.Width}px`),this.LayoutParams.Height&&(this.Element.style.height=`${this.LayoutParams.Height}px`)):i.ThrowError("ResetLayoutParams(): new params is null"):this._ProxyView.ResetLayoutParams(t)}GetRenderer(){return i.LayoutViewBase.sRenderer}GetLayoutParams(){return this.LayoutParams?this.LayoutParams.Clone():new i.LayoutParams}EnableAutoHeight(){this._AutoHeight=!0}WaitTextureToResize(t){}ApplyObjectFit(t,e,i,n,s,r){null===this._ObjectFitTestCache&&(this._ObjectFitTestCache={frameWidth:NaN,frameHeight:NaN,textureWidth:NaN,textureHeight:NaN,objectFit:null,clipLayout:null});const a=this._ObjectFitTestCache;if(a.frameWidth===t&&a.objectFit===s&&a.frameHeight===e&&a.textureWidth===i&&a.textureHeight===n)return a.clipLayout;const o={x:0,y:0,width:t,height:e,overflow:!1};a.frameWidth=t,a.frameHeight=e,a.textureWidth=i,a.textureHeight=n,a.objectFit=s,a.clipLayout=o;let l={width:0,height:0},h=t/e;const u=i/n;if(!u)return console.warn("Warning:Texture size is 0!"),o;if(0===t||0===e){if(0===t&&0===e)return o;0===t?t=e*u:e=t/u,h=t/e}let c="";switch(s){case r.FILL:l.width=t,l.height=e,c="fill";break;case r.NONE:l.width=i,l.height=n,c="none";break;case r.COVER:l=this._StretchSize(t,e,u,u<h),c="cover";break;case r.SCALEDOWN:{let s=u>h;t>i&&e>n&&(s=u<h),l=this._StretchSize(t,e,u,s),c="scaledown";break}case r.CONTAIN:l=this._StretchSize(t,e,u,u>h),c="contain";break;default:throw new Error("Unexpected object-fit.")}l.width=Math.floor(l.width),l.height=Math.floor(l.height),o.width=Math.min(l.width,t),o.height=Math.min(l.height,e),o.x=Math.floor((t-o.width)/2),o.y=Math.floor((e-o.height)/2),o.overflow=l.width>t||l.height>e;const d=this.InnerChildElement?this.InnerChildElement:this.Element;return d.style.width=`${t}px`,d.style.height=`${e}px`,d.style.objectFit=c,o}_StretchSize(t,e,i,n){const s={width:0,height:0};return n?(s.width=t,s.height=t/i):(s.height=e,s.width=e*i),s}GetPositionOffset(t){let e=this,n=0,s=0;for(;t!==e;)n+=e.LayoutParams?e.LayoutParams.MarginLeft:0,s+=e.LayoutParams?e.LayoutParams.MarginTop:0,e=e.ParentView,e||i.ThrowError("ERROR: Target parent layoutview is not found in LayoutView tree");return new i.Coordinate(n,s)}_dispatchLongPress(){this._LongPressDelayRequestTaskId=0,this._InLongPress=!0;const t={type:i.DragInfo.EVENT_TYPE.OnLongPress,x:this._CurrentDownEvent.designX,y:this._CurrentDownEvent.designY};this.TouchEventProcess(t)}_onMouseDown(t,e,n){this._Velocity.x.reset(),this._Velocity.y.reset(),this._Velocity.x.updatePosition(t),this._Velocity.y.updatePosition(e),this._LastFocusX=t,this._DownFocusX=this._LastFocusX,this._LastFocusY=e,this._DownFocusY=this._LastFocusY,this._CurrentDownEvent={designX:t,designY:e,timeStamp:n},this._AlwaysInTapRegion=!0,this._InLongPress=!1,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0),this._LongPressDelayRequestTaskId=setTimeout(this._dispatchLongPress,600);return{type:i.DragInfo.EVENT_TYPE.OnDown,x:t,y:e,deltaX:0,deltaY:0}}_onMouseMove(t,e,n){if(!this._CurrentDownEvent)return null;this._Velocity.x.updatePosition(t),this._Velocity.y.updatePosition(e);const s=parseInt(t-this._LastFocusX,10),r=parseInt(e-this._LastFocusY,10),a=parseInt(t-this._DownFocusX,10),o=parseInt(e-this._DownFocusY,10);let l=null;if(this._AlwaysInTapRegion){a*a+o*o>this._TouchSlopSquare&&(l={type:i.DragInfo.EVENT_TYPE.OnDragStart,x:t,y:e},this._LastFocusX=t,this._LastFocusY=e,this._LastTimeStamp=n,this._AlwaysInTapRegion=!1,this._InLongPress=!1,this._InDragging=!0,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0))}else this._InDragging&&(Math.abs(s)>=1||Math.abs(r)>=1)&&(l={type:i.DragInfo.EVENT_TYPE.OnMoved,x:t,y:e,deltaX:a,deltaY:o,_deltaX:s,_deltaY:r,timeStamp:parseInt((this._LastTimeStamp-n)/1e3,10)},this._LastFocusX=t,this._LastFocusY=e,this._LastTimeStamp=n);return l}_onMouseUp(t,e,n){let s=null;if(this._CurrentDownEvent){const n=window.Forge.DesignMap(),r=Math.floor(n.displayScale*n.width),a=window.innerWidth/r,o=this._Velocity.x.getVelocity()/a,l=this._Velocity.y.getVelocity()/a;let h=t-this._CurrentDownEvent.designX,u=e-this._CurrentDownEvent.designY;const c=t-this._LastFocusX,d=e-this._LastFocusY;this._InLongPress||(this._AlwaysInTapRegion?s={type:i.DragInfo.EVENT_TYPE.OnTap,x:t,y:e,velocityX:0,velocityY:0,deltaX:h,deltaY:u,_deltaX:c,_deltaY:d}:(Math.abs(l)>70||Math.abs(o)>70?(h=this._GetSplineFlingDistance(o),u=this._GetSplineFlingDistance(l),s={type:i.DragInfo.EVENT_TYPE.OnFling,x:t,y:e,velocityX:o,velocityY:l,deltaX:o<0?-h:h,deltaY:l<0?-u:u,_deltaX:c,_deltaY:d}):s={type:i.DragInfo.EVENT_TYPE.OnDragEnd,x:t,y:e,deltaX:h,deltaY:u,_deltaX:c,_deltaY:d},this.TouchEventProcess(s),s={type:i.DragInfo.EVENT_TYPE.OnRelease,x:t,y:e,deltaX:h,deltaY:u,_deltaX:c,_deltaY:d},this._CurrentDownEvent=null)),this._InLongPress=!1,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0)}return s}_onTouchEvent(t){const e=window.Forge.DesignMap(),i=Math.floor(e.displayScale*e.width),n=window.innerWidth/i,s=t.clientX/n,r=t.clientY/n;let a=null;switch(t.type){case"touchstart":case"mousedown":a=this._onMouseDown(s,r,t.timeStamp);break;case"touchmove":case"mousemove":a=this._onMouseMove(s,r,t.timeStamp);break;case"touchend":case"touchcancel":case"mouseup":a=this._onMouseUp(s,r,t.timeStamp)}return!!a&&this.TouchEventProcess(a)}_AddEventListener(){this.Element.style.pointerEvents="auto",this._ValidTouch=!1;"ontouchstart"in window?(this.Element.addEventListener("touchstart",(t=>{if(console.log("touchstart",t),this._ValidTouch=!0,t.touches&&t.touches.length>0){console.log(`touchstart event.touches[0].clientX:${t.touches[0].clientX}, event.touches[0].clientY:${t.touches[0].clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchmove",(t=>{if(this._ValidTouch&&(console.log("touchmove",t),t.touches&&t.touches.length>0)){console.log(`touchmove event.touches[0].clientX:${t.touches[0].clientX}, event.touches[0].clientY:${t.touches[0].clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchend",(t=>{if(console.log(`touchend event.touches.length:${t.touches.length}, event.clientX:${t.clientX}, event.pageX:${t.pageX}`),this._ValidTouch=!1,t.changedTouches&&t.changedTouches.length>0){console.log(`touchend event.changedTouches[0].clientX:${t.changedTouches[0].clientX}, event.changedTouches[0].pageX:${t.changedTouches[0].pageX}`);this._onTouchEvent({type:t.type,clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchcancel",(t=>{if(this._ValidTouch=!1,console.log("touchcancel",t),t.changedTouches&&t.changedTouches.length>0){console.log(`touchcancel event.clientX:${t.clientX}, event.clientY:${t.clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0)):(this.Element.addEventListener("mousedown",(t=>{console.log("mousedown",t),this._ValidTouch=!0;this._onTouchEvent(t)&&t.stopPropagation()}),!0),this.Element.addEventListener("mousemove",(t=>{if(this._ValidTouch){this._onTouchEvent(t)&&t.stopPropagation()}}),!0),this.Element.addEventListener("mouseup",(t=>{console.log("mouseup",t),this._ValidTouch=!1;this._onTouchEvent(t)&&t.stopPropagation()}),!0))}_GetSplineDeceleration(t){return Math.log(i.DragInfo.INFLEXION*Math.abs(t)/(i.DragInfo.SCROLL_FRICTION*i.DragInfo.PHYSICAL_COEF))}_GetSplineFlingDistance(t){const e=this._GetSplineDeceleration(t),n=i.DragInfo.DECELERATION_RATE-1;return i.DragInfo.SCROLL_FRICTION*i.DragInfo.PHYSICAL_COEF*Math.exp(i.DragInfo.DECELERATION_RATE/n*e)}_DoDragMove(t,e){let n=t._deltaX,s=t._deltaY;this._DragMovedDistanceX+=n,this._DragMovedDistanceY+=s,e||(n=t.deltaX,s=t.deltaY);const r=t.timeStamp/1e3;let a=`left ${r}s, top ${r}s`;this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_VERTICAL?(n=0,a=`top ${r}s`):this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_HORIZONTAL?(s=0,a=`left ${r}s`):this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_DISABLE&&(n=0,s=0);let o=this.GetLayoutParams();return o=this._GetMovedLayoutParams(n,s),e&&(this.Element.style.transition=a,this.ResetLayoutParams(o)),!!((Math.abs(this._DragMovedDistanceX)>=this._DragInfo.Settings.TriggerMovedDistance||Math.abs(this._DragMovedDistanceY)>=this._DragInfo.Settings.TriggerMovedDistance)&&this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved)&&(t.viewX=o.MarginLeft,t.viewY=o.MarginTop,this._DragInfo.Listener.OnMoved(t))}_GetMovedLayoutParams(t,e){const i=this.GetLayoutParams();let n=i.MarginLeft+t,s=i.MarginTop+e;return n>this._DragInfo.Settings.SlidePile.x?n=this._DragInfo.Settings.SlidePile.x:n+i.Width<this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width&&(n=this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width-i.Width),s>this._DragInfo.Settings.SlidePile.y?s=this._DragInfo.Settings.SlidePile.y:s+i.Height<this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height&&(s=this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height-i.Height),i.SetPosition(n,s),i}_SlideIfEnableTabMod(t,e){if(!this._DragInfo.Settings.EnableTabMode)return!1;const n=t._deltaX,s=t._deltaY;let r=t.deltaX,a=t.deltaY,o=this._DragInfo.Settings.PageWidth*this._DragInfo.Settings.PageEdge;const l=this.GetLayoutParams(),h=l.MarginLeft+n,u=l.MarginTop+s;switch(t.type===i.DragInfo.EVENT_TYPE.OnFling&&(o=0),this._DragInfo.Settings.DragDirection){case i.DragSetting.DIRECTION_VERTICAL:if(r=0,a>=0){const t=this._DragInfo.Settings.PageWidth-Math.abs(u)%this._DragInfo.Settings.PageWidth;a=t>=o?this._DragInfo.Settings.PageWidth-t:-t}else{const t=Math.abs(u)%this._DragInfo.Settings.PageWidth;a=t>=o?-(this._DragInfo.Settings.PageWidth-t):t}break;case i.DragSetting.DIRECTION_HORIZONTAL:if(a=0,r>=0){const t=this._DragInfo.Settings.PageWidth-Math.abs(h)%this._DragInfo.Settings.PageWidth;r=t>=o?this._DragInfo.Settings.PageWidth-t:-t,console.log(`right, left_width:${t}, distance_x:${r}`)}else{const t=Math.abs(h)%this._DragInfo.Settings.PageWidth;r=t>=o?-(this._DragInfo.Settings.PageWidth-t):t,console.log(`left, left_width:${t}, distance_x:${r}`)}break;case i.DragSetting.DIRECTION_AUTO:console.log("slideIfEnableTabMode DragDirection error DRAG_DIRECTION_AUTO")}if(0===r&&0===a)return console.log("slideIfEnableTabMode distance_x === 0 && distance_y === 0"),!1;const c=Math.sqrt(r*r+a*a)/.3;return t.deltaX=r,t.deltaY=a,this._DonFlingAnim(t,c),!0}_DoDragEnd(t){let e=t._deltaX,n=t._deltaY;this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_VERTICAL?e=0:this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_HORIZONTAL?n=0:this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_DISABLE&&(e=0,n=0),console.log("_DoDragEnd event:",t,this.Element.style);let s=this.GetLayoutParams();return s=this._GetMovedLayoutParams(e,n),this.ResetLayoutParams(s),t.viewX=s.MarginLeft,t.viewY=s.MarginTop,this._DragInfo.Listener.OnDragEnd(t)}_DragImactSensorRecycle(){console.log("_DragImactSensorRecycle this._DragImactSensor:",this._DragImactSensor),this._DragImactSensor&&this._DragImactSensor.Recycle()}_DonFlingAnim(t,e){const n=t.deltaX,s=t.deltaY,r=this.GetLayoutParams(),a=r.MarginLeft,o=r.MarginTop,l=r.MarginLeft+n,h=r.MarginTop+s,u=this._GetMovedLayoutParams(n,s);if(u.MarginLeft===r.MarginLeft&&u.MarginTop===r.MarginTop)return void console.log("_DonFlingAnim adjust_lp.MarginLeft === lp.MarginLeft && adjust_lp.MarginTop === lp.MarginTop");this.DragControl=new i.DragTranslateControl,this.DragControl._SetView(this),this.DragControl.speed(e),console.log(`OnFling speed:${e}`);const c=this._DragInfo.Settings;this._DragImactSensorRecycle(),this.Element.style.transform=null,this.DragControl.target(r.MarginLeft,r.MarginTop).jumpSilent(),r.SetPosition(0,0),this.ResetLayoutParams(r);let d=0;this.DragControl.target(l,h).start(((e,i)=>{this.DragControl=null,r.SetPosition(e,i),this.ResetLayoutParams(r),this.Element.style.transform=null,this._DragImactSensorRecycle(),t.viewX=e,t.viewY=i,this._DragInfo.Listener.OnFling(t),console.log(`_DonFlingAnim end view_x:${e}, view_y:${i}, distance_x:${n}, distance_y:${s}`)}),(t=>{const e=n*t,i=s*t;if(console.log(`_DonFlingAnim progress:${t}, deltaX:${e}, deltaY:${i}`),Math.abs(e)>this._DragInfo.Settings.TriggerMovedDistance||Math.abs(i)>this._DragInfo.Settings.TriggerMovedDistance){const t={deltaX:a+e,deltaY:o+i,_deltaX:e,_deltaY:i,timeStamp:parseInt((Date.now()-d)/1e3,10)};this._DoDragMove(t,!1),d=Date.now()}}));const _=this.GetPositionOffset(this.ParentView);this._DragImactSensor=new i.DragImpactSensor([{x:c.SlidePile.x+_.x,y:c.SlidePile.y+_.y},{x:c.SlidePile.x+_.x+c.SlidePile.width,y:c.SlidePile.y+_.y},{x:c.SlidePile.x+_.x,y:c.SlidePile.y+_.y+c.SlidePile.height},{x:c.SlidePile.x+_.x+c.SlidePile.width,y:c.SlidePile.y+_.y+c.SlidePile.height}],this.Element,new i.sImpactSensorManager.Callback((e=>{this._DoDragPause(t),this._DragImactSensorRecycle()}),null))}_DoFling(t){let e=t.deltaX,n=t.deltaY,s=!0,r=0;switch(this._DragInfo.Settings.DragDirection){case i.DragSetting.DIRECTION_VERTICAL:e=0,0===n&&(s=!1),r=Math.abs(t.velocityY);break;case i.DragSetting.DIRECTION_HORIZONTAL:n=0,0===e&&(s=!1),r=Math.abs(t.velocityX);break;case i.DragSetting.DIRECTION_DISABLE:s=!1;break;default:r=Math.sqrt(t.velocityX**2,t.velocityY**2)}return s&&(t.deltaX=e,t.deltaY=n,this._DonFlingAnim(t,r)),!0}GetBoundingClientRect(){return new Promise(((t,e)=>{this.Element?setTimeout((()=>{let e=this,n=0;for(;e;)e.TransformAnimationObj&&e.TransformAnimationObj.repeatTimes>0&&(n++,e.TransformAnimationObj.AddAnimationListener(new i.AnimationListener(null,(e=>{if(n--,n<=0){const{left:e,top:i,width:n,height:s}=this.Element.getBoundingClientRect();t({left:e,top:i,width:n,height:s})}})))),e=e.ParentView;if(0==n){const{left:e,top:i,width:n,height:s}=this.Element.getBoundingClientRect();t({left:e,top:i,width:n,height:s})}}),1):e(new Error("BrowserError: dom element is null."))}))}}H.DivId=0,i.LayoutViewBase=H;class U extends i.LayoutViewBase{constructor(t,e){!t||t instanceof i.TextureSetting||i.ThrowError("ERROR:LayoutView need TextureSetting as parameter"),super(t,e=e||"div")}}i.LayoutView=U,window.LayoutView=i.LayoutView;class X extends i.LayoutView{constructor(){super(void 0,"root"),this._ViewType=1,this._IsChildOfRootView=!0,window.gRootView=this,i.sRootView=this}Init(t,e,i,n,s){this.InitLayoutViewStaticValues(t),this.ResetLayoutParams({x:0,y:0,width:1280,height:720})}InitLayoutViewStaticValues(t){i.LayoutViewBase.sRenderer=t,i.LayoutViewBase.sInternalTextureManager=t.GetSharedTextureManager(),i.LayoutViewBase.sIdentityMat4=new i.Mat4,i.LayoutViewBase.sNullDirectParentMat4=new i.Mat4,i.LayoutViewBase.sBakeFlipYMat4=(new i.Mat4).rotatex(180)}}i.RootView=X,window.RootView=i.RootView;class Y{constructor(t,e,i,n,s){this.coordX=t,this.coordY=e,this.width=i,this.height=n,this.useScissors=s,this.maskStencil=null}updateInfo(t,e,i,n,s){this.coordX=t,this.coordY=e,this.width=i,this.height=n,this.useScissors=s}setMaskStencil(t){this.maskStencil=t}}class z extends i.LayoutView{constructor(t){super(t,"div"),this._ClipRectInfo=null,this.Id="ClipView",this.TextureSetting=null}SetId(t){this.Id=`${t}_ClipView`}SetClipRect(t,e,i,n,s){null===this._ClipRectInfo?this._ClipRectInfo=new Y(t,e,i,n,s):this._ClipRectInfo.updateInfo(t,e,i,n,s);const r=t,a=e,o=this.LayoutParams.Width-r-i,l=this.LayoutParams.Height-a-n;s?(this.Element.style.overflow="hidden",this.Element.style.clipPath=`inset(${a}px ${o}px ${l}px ${r}px)`):(this.Element.style.overflow="visible",this.Element.style.clipPath="unset")}}i.ClipView=z,window.ClipView=i.ClipView;class K extends i.LayoutView{constructor(t){super(t,"div"),this._HorizontalRepeats=[0,0,0,0],this._VerticalRepeats=[0,0,0,0],this._HorizontalPadding=[0,0],this._VerticalPadding=[0,0],this._ImageDspWidth=0,this._ImageDspHeight=0}ResetTexture(t){this.TextureSetting=t,this._ApplyChanges()}SetRepeat(t,e){i.Assert(t.length<=2),i.Assert(e.length<=2);for(let i=0;i<2;i++)i<t.length?(this._HorizontalRepeats[2*i]=t[i].start,this._HorizontalRepeats[2*i+1]=t[i].width):(this._HorizontalRepeats[2*i]=0,this._HorizontalRepeats[2*i+1]=0),i<e.length?(this._VerticalRepeats[2*i]=e[i].start,this._VerticalRepeats[2*i+1]=e[i].width):(this._VerticalRepeats[2*i]=0,this._VerticalRepeats[2*i+1]=0);return this._ApplyChanges(),this}SetPadding(t,e){return i.Assert(null!==t),i.Assert(null!==e),this._VerticalPadding[0]=e.start,this._VerticalPadding[1]=e.width,this._HorizontalPadding[0]=t.start,this._HorizontalPadding[1]=t.width,this._ApplyChanges(),this}SetImageDspSize(t,e){this._ImageDspWidth=t,this._ImageDspHeight=e}_ApplyChanges(){let t=this.TextureSetting;if(t){if(t.MaskSetting&&"CORNER"===t.MaskSetting._MaskType&&this._SetBorderRadius(t.MaskSetting),t.Texture.Source){const e=t.Texture.RenderTexture.Width,i=t.Texture.RenderTexture.Height,n=e/this._ImageDspWidth,s=i/this._ImageDspHeight,r=this._HorizontalRepeats[0],a=this._ImageDspWidth-this._HorizontalRepeats[1]-r,o=this._VerticalRepeats[0],l=this._ImageDspHeight-this._VerticalRepeats[1]-o;let h=Math.floor(this._HorizontalRepeats[0]*n),u=e-Math.floor(this._HorizontalRepeats[1]*n)-h,c=Math.floor(this._VerticalRepeats[0]*s),d=i-Math.floor(this._VerticalRepeats[1]*s)-c;h+u>=e&&(h-=1,u-=1),c+d>=i&&(c-=1,d-=1);const _=`${c} ${u} ${d} ${h}`;this.Element.style.borderImage=`url(${t.Texture.Source}) ${_} fill`;const f=this._HorizontalPadding[0],g=this._ImageDspWidth-this._HorizontalPadding[1]-f,m=this._VerticalPadding[0],p=this._ImageDspHeight-this._VerticalPadding[1]-m;this.Element.style.borderImageWidth=`${o}px ${a}px ${l}px ${r}px`,this.Element.style.borderImageOutset=`${m}px ${g}px ${p}px ${f}px`}}else this.Element.style.borderRadius="",this.Element.style.borderImage=""}}i.NinePatchView=K;class j extends i.LayoutView{constructor(t){let e;e=t.startsWith("jsve-")?t.substr(5):t.substr(3),super(void 0,e)}setAttribute(t,e){this.Element.setAttribute(t,e)}removeAttribute(t){this.Element.removeAttribute(t)}getAttribute(t){return this.Element.getAttribute(t)}hasAttribute(t){return this.Element.hasAttribute(t)}get textContent(){return this.Element.textContent}set textContent(t){this.Element.textContent=t}}i.JsvElementView=j;class q extends i.LayoutView{constructor(t,e){super(e),this._ViewType=8,this.Element=t.Ele,this.Id="VideoView"}SetId(t){this.Id=`${t}_VideoView`}ResetLayoutParams(t){null!==t?(t instanceof i.LayoutParamsBase?this.LayoutParams=t.Clone():this.LayoutParams=new i.LayoutParams(t),this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`,this.LayoutParams.Width&&(this.Element.style.width=`${this.LayoutParams.Width}px`),this.LayoutParams.Height&&(this.Element.style.height=`${this.LayoutParams.Height}px`)):i.ThrowError("ResetLayoutParams(): new params is null")}_OnDetachFromSystem(){super._OnDetachFromSystem(),this._VideoPlayerHdl&&(this._VideoPlayerHdl.unload(),this._VideoPlayerHdl=null)}}i.VideoView=q;class J extends i.LayoutView{constructor(){super(null,"input"),this._ViewType=5,this._InputType=i.TextInputType.TEXT,this.Id="EditControlView"}_OnAttachToSystem(){super._OnAttachToSystem(),this.Element.style.left="-1920px",this.Element.style.top="-1080px",this.Element.style.width="1px",this.Element.style.height="1px",this.Element.style.pointerEvents="auto",this.Element.addEventListener("keydown",(t=>{t=t||window.event;let e=this.Element.selectionStart;console.log(`keydown cur_offset:${e}`),37===t.keyCode?(--e,e<0&&(e=0),e!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,e,!0),t.stopPropagation&&t.stopPropagation()):this.Element.blur()):39===t.keyCode?(++e,e>this.Element.value.length&&(e=this.Element.value.length),e!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,e,!0),t.stopPropagation&&t.stopPropagation()):this.Element.blur()):38!==t.keyCode&&40!==t.keyCode||this.Element.blur()})),this.Element.onfocus=t=>{console.log("onfocus in"),this.OnStatusChanged(1)},this.Element.onblur=t=>{console.log("onblur in"),this.OnStatusChanged(0)};this.Element.oninput=t=>{if(console.log("oninput:",t),t.target.value.length>0&&t.target.selectionStart>0){const n=t.target.selectionStart-1,s=t.target.selectionStart,r=t.target.value.slice(n,s);e=r,"0".charCodeAt()<=e.charCodeAt()&&e.charCodeAt()<="9".charCodeAt()||this._InputType!==i.TextInputType.NUMBER||(t.target.value=t.target.value.substr(0,n)+t.target.value.substr(s),t.target.selectionStart=n)}var e;const n=t.target.value,s=t.target.selectionStart;this.OnTextChanged(decodeURIComponent(n),s)}}SetId(t){this.Id=`${t}_EditControlView`}showIme(t,e,n){this.Element?t!==i.TextInputType.NONE?(null==n&&(n=e.length>0?e.length:0),n<0?n=0:n>e.length&&(n=e.length>0?e.length:0),this._InputType=t,this.Element.type="text",this.Element.value=e,this.Element.focus(),this.Element.selectionStart=n,this.Element.selectionEnd=n):console.log("showIme input_type error"):console.log("showIme but ele is null!")}hideIme(){this.Element?this.Element.blur():console.log("hideIme, but ele is null!")}updateCursorOffset(t,e){this.Element?(this.Element.selectionStart=e,this.Element.selectionEnd=e,this.Element.value=t):console.log("updateCursorOffset, but ele is null!")}OnTextChanged(t,e,i){console.log(`OnTextChanged value:${t}`)}OnStatusChanged(t){}OnEditAction(t){}}class Z extends i.LayoutView{constructor(t,e=1){super(t),this._ViewType=10,this._FilterType=e,this.Id="FilterView",this.Element.style.filter="grayscale(100%)"}FilterSwitch(t){this.Element&&(this.Element.style.filter=t?"grayscale(100%)":"")}SetId(t){this.Id=t+"_FilterView"}}i.FilterView=Z,i.TextInputType={NONE:0,TEXT:1,PASSWORD:2,TEXT_AREA:3,CONTENT_EDITABLE:4,SEARCH:5,URL:6,EMAIL:7,TELEPHONE:8,NUMBER:9},i.EditControlView=J;class Q{constructor(t){this._Current=new Array(t).fill(0),this._Target=new Array(t).fill(0),this._RepeatStart=new Array(t).fill(0),this._JumpTarget=null,this._Jumping=!1,this._ParameterCount=t,this._StateIndex=0,this._StateLocked=!1,this._StartSwitcher=!1,this._PausedCallback=null,this._EndCallback=null,this._NextEndCallback=null,this._Token=0,this._Repeat=!1,this._OnRepeatCallback=null,this._SpriteView=null,this._AdvanceCallback=null}setRepeat(t,e){return this._Repeat=t,this._OnRepeatCallback=t?e:null,this}start(t,e){this._NextEndCallback=t,this._EndCallback=null,this._AdvanceCallback=e,this._StartSwitcher=!0,this._Jumping=!1,this._StateMachineNext()}pause(t){this._AdvanceCallback=null,null===this._EndCallback&&null===this._NextEndCallback||(this._EndCallback=null,this._NextEndCallback=null),0===this._StateIndex?t&&this._CallbackWithCatch(this._Current,t):(t&&(this._PausedCallback=t),this._StateMachineNext())}jump(){this._JumpTarget=[...this._Target],this._Jumping=!0,this._StartSwitcher=!0,this._StateMachineNext()}jumpSilent(){this._JumpTarget=[...this._Target]}startFpsTesting(){i.sRenderBridge.SetStepFpsSwitch(!0)}stopFpsTesting(){i.sRenderBridge.SetStepFpsSwitch(!1)}_WrapBuildAnimation(t,e,i,n){console.warn("Should Override")}_WrapCallback(t,e){console.warn("Should Override")}_CallbackWithCatch(t,e){try{this._WrapCallback(t,e)}catch(t){console.error("Error:in callback"),console.error(t)}}_StateMachineNext(){this._StateLocked||(0===this._StateIndex?this._StartSwitcher&&(this._StartSwitcher=!1,this._StartAnimation()&&(this._StateIndex=1)):1===this._StateIndex&&this._StopAnimation())}_StartAnimation(){this._EndCallback=this._NextEndCallback,this._NextEndCallback=null;const t=this._JumpTarget?[...this._JumpTarget]:[...this._Current],e=this._Target,n=this._Repeat?[...this._RepeatStart]:null,s=this._WrapBuildAnimation(n,t,e,this._Jumping);if(this._JumpTarget=null,this._Jumping=!1,null===s)return;const r=[...e],a=this,o=(new i.AnimationListener).OnFinalProgress((e=>{a._OnPaused(null!==n?n:t,r,e)})).OnAdvance((t=>{this._AdvanceCallback&&this._AdvanceCallback(t)}));return this._OnRepeatCallback&&o.OnRepeat((t=>{a._OnRepeatCallback&&a._OnRepeatCallback(t)})),s.AddAnimationListener(o),s.Enable(i.AnimationEnable.KeepTransform),this._Repeat&&s.EnableInfinite(),this._SpriteView.StartAnimation(s),!0}_StopAnimation(){this._SpriteView.StopAnimation()}_OnPaused(t,e,i){for(let n=0;n<this._ParameterCount;n++)this._Current[n]=Math.floor((e[n]-t[n])*i+t[n]);this._StateLocked=!0;const n=this._PausedCallback,s=this._EndCallback;this._PausedCallback=null,n&&this._CallbackWithCatch(this._Current,n),s&&1===i&&(this._EndCallback=null,this._CallbackWithCatch(this._Current,s)),this._StateLocked=!1,this._StateIndex=0;this._StateMachineNext()}_SetView(t){this._SpriteView=t}}i.DragTranslateControl=class extends Q{constructor(){super(2),this._Mode=0,this._Speed=0,this._VerlocityAcc=0,this._VerlocityInit=0,this._AccAlongX=!0,this._AnimationRef=null,this._AllowFrameStep=!1}allowFrameStepMode(t){return this._AllowFrameStep=t,this}selectMode(t){switch(t){case"UniformMotion":this._Mode=0;break;case"AcceleratedMotion":this._Mode=1,this.setRepeat(!1);break;default:console.error(`Unsupported input=${t}`)}return this}targetX(t){return this._Target[0]=t,this}targetY(t){return this._Target[1]=t,this}target(t,e){return this._Target[0]=t,this._Target[1]=e,this}enableRepeatFrom(t,e,i){if(this._ComfirmMode(0))return this.setRepeat(!0,i),this._RepeatStart[0]=t,this._RepeatStart[1]=e,this}speed(t){if(console.log(`speed, pixel_per_second:${t}`),this._ComfirmMode(0))return this._Speed=t,this}accelerateX(t,e){if(this._ComfirmMode(1))return this._Target[0]=e,this._VerlocityAcc=t,this._VerlocityInit=0,this._AccAlongX=!0,this}accelerateY(t,e){if(this._ComfirmMode(1))return this._Target[1]=e,this._VerlocityAcc=t,this._VerlocityInit=0,this._AccAlongX=!1,this}decelerateX(t,e){if(this._ComfirmMode(1))return this._VerlocityAcc=t,this._VerlocityInit=e,this._AccAlongX=!0,this}decelerateY(t,e){if(this._ComfirmMode(1))return this._VerlocityAcc=t,this._VerlocityInit=e,this._AccAlongX=!1,this}decelerate(t,e,i,n){if(1===this._Mode)return this._VerlocityAcc[0]=t,this._VerlocityAcc[1]=e,this._VerlocityInit[0]=i,this._VerlocityInit[1]=n,this;console.error("Error: mode error")}_ComfirmMode(t){return this._Mode===t||(console.error("Error: mode error"),!1)}_WrapBuildAnimation(t,e,i,n){return n?this._AnimationRef=this._UniformMove(null,e,i,n):0===this._Mode?this._AnimationRef=this._UniformMove(t,e,i,!1):1===this._Mode&&(this._AnimationRef=this._AccelerMove(e,i)),this._AnimationRef}_UniformMove(t,e,n,s){let r=0,a=0,o=0,l=1;const h=e[0],u=e[1],c=n[0],d=n[1];if(null!==t){r=t[0],a=t[1];const e=this._Distance(h,u,c,d),i=this._Distance(r,a,c,d);o=(i-e)/i,s||(l=1e3*i/this._Speed)}else r=h,a=u,o=0,s||(l=1e3*this._Distance(h,u,c,d)/this._Speed);s||0!==l||console.warn("Discard starting request for no distance");let _=null;if(r!==c&&a!==d||s||!this._AllowFrameStep||!window.JsView)_=new i.TranslateAnimation(r,c,a,d,l,null);else{console.log("Using frame translate animation");let t=0,e=0,n=!0;r!==c?(t=r,e=c,n=!0):(t=a,e=d,n=!1),_=new i.TranslateFrameAnimation(t,e,this._Speed,n)}return 0!==o&&(o<0?console.warn("Warning: start position out of repeating range"):_.SetStartPos(o)),_}_AccelerMove(t,e){const n=this._AccAlongX?t[0]:t[1],s=this._VerlocityInit,r=this._VerlocityAcc;let a,o,l,h,u=!0;if(0!==r)return 0===s?(a=this._AccAlongX?e[0]:e[1],o=Math.floor(1e3*Math.sqrt(2*Math.abs(a-n)/r)),u=!0):(o=Math.floor(1e3*Math.abs(s)/r),a=n+Math.floor(5e-4*s*o),u=!1),0===o&&console.warn("no moved..."),this._AccAlongX?(l=a,this._Target[0]=l,h=this._Target[1]):(l=this._Target[0],h=a,this._Target[1]=h),new i.TranslateAnimation(t[0],l,t[1],h,o,u?i.Easing.Circular.In:i.Easing.Circular.Out);console.error("Error: no found acceleration")}_Distance(t,e,i,n){const s=i-t,r=n-e;return Math.sqrt(s*s+r*r)}_WrapCallback(t,e){this._AnimationRef=null,e&&e(t[0],t[1])}};class tt extends i.LayoutView{constructor(){super(),this._ChildTextView=null}PutChildTextView(t){this._ChildTextView=t,this.AddView(t)}EnableAutoHeight(){this._ChildTextView.EnableAutoHeight()}}class et{StringWithFont(t,e,i,n,s,r,a,o,l,h,u){e||(e=et._sDefaultFontSize),i||(i=et._sDefaultFont);let c="";!0===a&&(c="italic");let d="";return!0===o&&(d="bold"),n||(n="left"),s||(s="middle"),r||(r=et._sDefaultFontColor),l||(l=null),u||(u="top"),h||(h=-1),{str:`${t}`,font:i,size:e,italic:c,bold:d,stroke_width:h,alignment:n,vertical_align:s,textColour:r,backgroundColour:et._sDefaultBackgroundColor,enableBlend:!0,shadow:l,vertical_area_align:u}}TextAttr(t,e){return t||(t="none"),e||(e="none"),{text_overflow:t,word_wrap:e}}GetTextWidth(...t){if(t.length<=1){let e=t[0];return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextWidth(e):e.str.length*e.size+1}{let e=t[0];if(void 0!==window.PlatformUtils){let i={str:e,font:t[1]?t[1]:"黑体",size:t[2],bold:t[3],italic:t[4]};return window.PlatformUtils.GetTextWidth(i)}return e.length*e.size+1}}GetTextRect(t,e,i,n,s){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextRect(t,e,i,n,s):{width:e.width,height:e.height}}GetTextInfo(t,e,i,n,s){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextInfo(t,e,i,n,s):{start:0,end:t.length,width:e.width,height:e.height}}GetCursorOffset(t,e,i,n,s,r,a){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorOffset(t,e,i,n,s,r,a):0}GetCursorPosition(t,e,i,n,s,r){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorPosition(t,e,i,n,s,r):{x:0,y:0}}BuildTextView(t,e,n,s,r,a,o,l,h,u,c){r.width=isNaN(r.width)?0:r.width,r.height=isNaN(r.height)?0:r.height,a=isNaN(a)?10:a,o=isNaN(o)?0:o;let d=new i.LayoutView;const _=t.GetTextTextureFromStylePack(e,n,!!s,r,a,o,l,h,u,c);if(s&&setTimeout((()=>{s({width:d.Element.clientWidth,height:d.Element.clientHeight})})),null===_)return console.error("Error: Build text texture failed!"),null;d.ResetTexture(new i.TextureSetting(_,null,null,!0)),e.length<10?d.SetId("Text-"+e):d.SetId("Text-Long-"+e.length),d.ResetLayoutParams({x:0,y:0,width:r.width,height:r.height});const f=n.DS.Describe;if("ellipsis"!==f.text_overflow&&("middle"===f.vertical_area_align||"bottom"===f.vertical_area_align)){const t=new tt;t.PutChildTextView(d),d.Element.style.display="table-cell",d.Element.style.position="static",t.Element.style.display="table",t.Element.style.position="static",d=t}return d}}et._sDefaultFont="黑体",et._sDefaultFontSize=30,et._sDefaultFontColor="#FFFFFF",et._sDefaultBackgroundColor="rgba(0, 0, 0, 0)",i.TextUtils=et,i.sTextUtils=new i.TextUtils;class it{constructor(){this._InnerViews={},this._ViewToken=1}add(t){const e=++this._ViewToken;return this._InnerViews[`${e}`]=t,e}remove(t){this._InnerViews[t]&&delete this._InnerViews[t]}get(t){return this._InnerViews[t]}clear(){this._InnerViews={},this._ViewToken=1}}i.ViewStore=it,i.sViewStore=new it;i.ViewInfo=class{constructor(t,e){this.view=t,this.layout_params=e}};let nt=0;i.AnimationBase=class{constructor(){this.IdToken=nt++,this._AttachedGroup=null,this.AnimationListenerObj=null,this._AnimationClose=!1,this._LayoutViewRef=null,this._IsTextureAnim=!1}SetAnimationListener(t){this.AnimationListenerObj=t,this.OnNewListener(t)}AddAnimationListener(t){this.AnimationListenerObj&&t.AddInherit(this.AnimationListenerObj),this.AnimationListenerObj=t,this.OnNewListener(t)}OnNewListener(t){}GetAnimationListener(){return this.AnimationListenerObj}Cancel(t){this._LayoutViewRef&&this._LayoutViewRef.DetachAnimation(this);const e=this.AnimationListenerObj;if(e&&e.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,e.OnAnimationEnd(!1)),this._AttachedGroup){let e=!0;t&&(e=t._AttachedGroup!==this._AttachedGroup),e&&(this._AttachedGroup.CancelFromInternalAnimation(this),this._AttachedGroup=null)}}AttachToGroup(t){null!==this._AttachedGroup&&i.ThrowError("ERROR: In TransformAnimation.AttachToGroup(), animation already attached to other group"),this._AttachedGroup=t}RemoveFromGroup(){this._AttachedGroup=null}AsTextureAnimation(){this._IsTextureAnim=!0}Start(t){this._LayoutViewRef=t}SetCannotDisable(t){}OnStart(){const t=this.AnimationListenerObj;t&&t.OnAnimationStart&&t.OnAnimationStart()}OnEnd(t){this._LayoutViewRef&&!t&&(this._LayoutViewRef.DetachAnimation(this),this._LayoutViewRef=null);const e=this.AnimationListenerObj;e&&e.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,e.OnAnimationEnd(!0))}OnRepeatEvent(){const t=this.AnimationListenerObj;t&&t.OnAnimRepeat&&t.OnAnimRepeat()}OnViewHide(){const t=this.AnimationListenerObj;t&&t.OnViewNoVisible&&t.OnViewNoVisible()}OnFinalProgress(t){const e=this.AnimationListenerObj;e&&e.OnAnimFinal&&e.OnAnimFinal(t)}OnAnimAdvance(t){const e=this.AnimationListenerObj;e&&e.OnAnimAdvance&&e.OnAnimAdvance(t)}};i.AnimationListener=class{constructor(t,e,i){this.OnAnimationStart=t,this._OnAnimationStart=t,this.OnAnimationEnd=e,this._OnAnimationEnd=e,this.OnViewNoVisible=i,this._OnViewNoVisible=i,this.OnAnimFinal=null,this._OnAnimFinal=null,this.OnAnimRepeat=null,this._OnAnimRepeat=null,this._AttachedGroup=null,this._InheritListener=[],this._OnAnimAdvance=null,this.OnAnimAdvance=null}OnStart(t){return this._OnAnimationStart=t,this.OnAnimationStart=t,this}OnEnd(t){return this._OnAnimationEnd=t,this.OnAnimationEnd=t,this}OnAdvance(t){return this._OnAnimAdvance=t,this.OnAnimAdvance=t,this}OnFinalProgress(t){return this._OnAnimFinal=t,this.OnAnimFinal=t,this}OnRepeat(t){return this._OnAnimRepeat=t,this.OnAnimRepeat=t,this}AddInherit(t){if(t){if(0===this._InheritListener.length){const t=this;this.OnAnimationStart=function(){t._OnAnimationStart&&t._OnAnimationStart();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimationStart&&t._InheritListener[e].OnAnimationStart()},this.OnAnimationEnd=function(e){t._OnAnimationEnd&&t._OnAnimationEnd(e);for(let i=0;i<t._InheritListener.length;i++)t._InheritListener[i].OnAnimationEnd&&t._InheritListener[i].OnAnimationEnd(e)},this.OnViewNoVisible=function(){t._OnViewNoVisible&&t._OnViewNoVisible();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnViewNoVisible&&t._InheritListener[e].OnViewNoVisible()},this.OnAnimFinal=function(e){t._OnAnimFinal&&t._OnAnimFinal(e);for(let i=0;i<t._InheritListener.length;i++)t._InheritListener[i].OnAnimFinal&&t._InheritListener[i].OnAnimFinal(e)},this.OnAnimRepeat=function(){t._OnAnimRepeat&&t._OnAnimRepeat();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimRepeat&&t._InheritListener[e].OnAnimRepeat()},this.OnAnimAdvance=function(){t._OnAnimAdvance&&t._OnAnimAdvance();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimAdvance&&t._InheritListener[e].OnAnimAdvance()}}this._InheritListener.push(t)}}};class st{constructor(t){this._SS=t}insertRule(t){window.jsvInAndroidWebView&&(t=(t=t.replace(/@keyframes/,"@-webkit-keyframes")).replace(/transform/g,"-webkit-transform"));const e=this._SS.cssRules.length;this._SS.insertRule(t,e)}removeRule(t){this.removeMultiRules([t])}hasRule(t){const e=this._SS.cssRules;for(let i=e.length-1;i>=0;i--)if(e[i].name===t)return!0;return!1}removeMultiRules(t){const e=this._SS,i=this._SS.cssRules;for(let n=i.length-1;n>=0;n--)for(const s in t)if(i[n].name===t[s]){t.splice(s,1),e.deleteRule(n);break}}}let rt=null;function at(){return null===rt&&(rt=function(t){let e=null;const i=document.styleSheets;if(!i||0===i.length)return console.error("Error: styleSheet empty"),null;if(t){for(let n=0;n<i.length;++n){const s=i[n];if(s.cssRules[0]&&s.cssRules[0].name&&s.cssRules[0].name===t){e=s;break}}if(null===e)return console.error(`Error: no found tag=${t}`),null}else e=i[0];return new st(e)}()),rt}function ot(t){let e="linear";if(t&&void 0!==t.T)switch(t.T){case i.EasingTypeIn:e="ease-in";break;case i.EasingTypeOut:e="ease-out";break;case i.EasingTypeInOut:e="ease-in-out";break;case i.EasingTypeBezier:e=`cubic-bezier(${t.St.X1},${t.St.Y1},${t.St.X2},${t.St.Y2})`;break;case i.EasingTypeSteps:e=`steps(${t.St.S},${0===t.St.T?"start":"end"})`;case i.EasingTypeBlink:case i.EasingTypeDeceleration:}return e}function lt(t,e){const i=-1===t.repeatTimes?"infinite":t.repeatTimes;let n="linear";t.easing&&(n=ot(t.easing));return`${e} ${t.duration/1e3}s ${n} ${t.delayedTime/1e3}s ${i}`}const ht=t=>t>=65&&t<=90||t>=97&&t<=122,ut=t=>t>=48&&t<=57,ct=t=>{if(!t)return null;let e="",i="",n=[],s=0;for(let r=0;r<t.length;r++){const a=t.charCodeAt(r);if(0===s?(ht(a)||ut(a))&&(e+=t[r]):(ut(a)||46===a||45===a||101===a)&&(i+=t[r]),40===a)s=1,i="",n=[];else{if(41===a)return n.push(parseFloat(i)),{name:e,params:n};44===a&&(n.push(parseFloat(i)),i="")}}return console.error("transform error",t),null};function dt(t){const e=t.Element.children;let i=null;for(let t=0;t<e.length;t++)if("_AnimateProgressTracer"===e[t].id){i=e[t];break}return null===i&&(i=window.originDocument.createElement("div"),i.id="_AnimateProgressTracer",t.Element.appendChild(i)),i}let _t=0;class ft{constructor(t){this._TracerDiv=dt(t),this._IdToken=_t++,this._KeyFrameName=null,this._AdvanceTimer=null,this._AdvanceListener=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=t=>{t.stopPropagation()},this._TracerDiv.addEventListener("animationend",this._OnEndListener)}_ClearAdvanceTimer(){null!==this._AdvanceTimer&&(clearInterval(this._AdvanceTimer),this._AdvanceTimer=null)}_NotifyAdvance(){this._ClearAdvanceTimer(),null!==this._AdvanceListener&&(this._AdvanceTimer=setInterval((()=>{const t=this.GetProgress();this._AdvanceListener(t),1===t&&this._ClearAdvanceTimer()}),100))}Start(t,e,i){this._AdvanceListener=i,this._KeyFrameName&&console.error("Error: Asset!! should Stop before start"),this._TracerDiv._ForgeProgressToken=(this._TracerDiv._ForgeProgressToken+1)%2,this._KeyFrameName=this._BuildTraceKeyFrame(e,this._IdToken,this._TracerDiv._ForgeProgressToken),this._TracerDiv.style.animation=lt(t,this._KeyFrameName),this._TracerDiv.addEventListener("animationend",this._OnEndListener),this._NotifyAdvance()}Stop(){const t=this.GetProgress();return this._TracerDiv.style.animation=null,this._KeyFrameName&&(this._RemoveTraceKeyFrame(this._KeyFrameName),this._KeyFrameName=null),this._AdvanceListener&&(this._ClearAdvanceTimer(),this._AdvanceListener(t),this._AdvanceListener=null),t}GetProgress(){const t=window.getComputedStyle(this._TracerDiv);if(0===t.transform.length);else if(t.transform.length>0&&"none"!==t.transform){const e=ct(t.transform);return null!==e?e.params[4]/1e3:(console.error("Error:internal error"),0)}return 1}_BuildTraceKeyFrame(t,e,i){const n=`_AnimateProgress_${e}_${i}`,s=at(),r=`@keyframes ${n}\n {0%{transform:translate3d(${Math.floor(1e3*t)}px,0,0)}\n 100%{transform:translate3d(1000px,0,0)}}`;return s.insertRule(r),n}_RemoveTraceKeyFrame(t){at().removeRule(t)}}class gt{constructor(t,e){this._TracerDiv=dt(t),this._IdToken=_t++,this._KeyFrameNameArray=null,this._StepsTotal=e,this._RunAnimList=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=t=>{t.stopPropagation()},this._TracerDiv.addEventListener("animationend",this._OnEndListener)}Start(t){this._KeyFrameName&&console.error("Error: Asset!! should Stop before start"),this._TracerDiv._ForgeProgressToken=(this._TracerDiv._ForgeProgressToken+1)%2,this._BuildTraceKeyFrameGroup(this._IdToken,this._TracerDiv._ForgeProgressToken),this._RunAnimList=this._ConvertToAnimationStyle(t),this._TracerDiv.style.animation=this._RunAnimList[0]}TriggerNextStep(t){this._TracerDiv.style.animation=this._RunAnimList[t]}Stop(){const t=this.GetProgress();return this._TracerDiv.style.animation=null,null!==this._KeyFrameNameArray&&(this._RemoveTraceKeyFrameGroup(),this._KeyFrameNameArray=null),t}GetProgress(){const t=window.getComputedStyle(this._TracerDiv);if(0===t.transform.length);else if("none"!==t.transform){const e=ct(t.transform);if(null!==e){return e.params[4]/(100*this._StepsTotal)}return console.error("Error:internal error"),0}return 1}_BuildTraceKeyFrameGroup(t,e){this._KeyFrameNameArray=new Array(this._StepsTotal);const i=at();for(let n=0;n<this._KeyFrameNameArray.length;n++){const s=`_AnimateGroupProgress_${t}_${e}_Cnt_${n===this._KeyFrameNameArray.length-1?"finalStep":`${n}`}`,r=`@keyframes ${s}\n {0%{transform:translate3d(${100*n}px,0,0)}\n 100%{transform:translate3d(${100+100*n}px,0,0)}}`;i.insertRule(r),this._KeyFrameNameArray[n]=s}}_RemoveTraceKeyFrameGroup(){const t=at();this._KeyFrameNameArray.forEach((e=>{t.removeRule(e)}))}_ConvertToAnimationStyle(t){const e=[];for(let i=0;i<t.length;i++){let n="linear";const s=t[i];s.easing&&(n=ot(s.easing)),e.push(`${this._KeyFrameNameArray[i]} ${s.duration/1e3}s ${n}`)}return e}}let mt=0;i.AnimationDelegate=class extends i.AnimationBase{constructor(t,e,i){super();let n=null;i&&(n=i.Package()),this.typeName=t,this.duration=e,this.easing=n,this.repeatTimes=1,this.delayedTime=0,this.enableFlags=-1,this.enableStartPos=0,this._Progress=null}EnableDelay(t){return this.delayedTime=t,this}SetStartPos(t){this.enableStartPos=t}EnableInfinite(){return this.repeatTimes=-1,this}SetRepeat(t){return this.repeatTimes=t,this}Enable(t){return this._EnableFlagsInner(t),this}OnNewListener(t){let e=0;t.OnAnimFinal&&(e|=i.AnimationEnable.AckFinalProgress),t.OnAnimRepeat&&(e|=i.AnimationEnable.AckRepeat),0!==e&&this._EnableFlagsInner(e)}_EnableFlagsInner(t){-1!==this.enableFlags?this.enableFlags|=t:this.enableFlags=t}_GetCSSKeyframesRule(t){let e=null;const i=document.styleSheets;for(let n=0;n<i.length;++n)if(i[n]&&i[n].cssRules){for(const s in i[n].cssRules)if(i[n].cssRules[s].name===t){e=i[n].cssRules[s];break}if(e)break}return e}CheckCssAnimationFormat(t){const e=this._GetCSSKeyframesRule(t);if(e&&e.cssRules)for(const i in e.cssRules){if(!e.cssRules[i]||!e.cssRules[i].style)continue;if(!e.cssRules[i].style.opacity&&!e.cssRules[i].style.transform)continue;const n=e.cssRules[i].style.transform;n&&(-1!==n.indexOf("rotate(")?console.error(`@keyframe ${t}, only support rotate3d, current transform:${n}`):-1!==n.indexOf("translate(")?console.error(`@keyframe ${t}, only support translate3d, current transform:${n}`):-1!==n.indexOf("scale(")&&console.error(`@keyframe ${t}, only support scale3d, current transform:${n}`))}}},i.KeyFrameAnimation=class extends i.AnimationDelegate{constructor(t,e,i){super(t,e,i),this._KeyFrameNameToRecycle=null,this._TestRepeat=this._TestRepeat.bind(this),this._LatestProgressValue=0;const n=this;this._OnEndEvent=t=>{t.stopPropagation(),n._PerformAnimationEnd(!0)},this._CurrentEndEventFunc=null}Start(t){super.Start(t),t.ResetCssTransform(null,null),t.Element&&(t.Element.style.pointerEvents="auto"),this.enableStartPos>0?this._EnableStarterAnimation():this._EnableCssAnimation(this._BuildKeyFrame(),this._OnEndEvent,0)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableStarterAnimation(){let t=this._OnEndEvent;if(1!==this.repeatTimes){const e=this;t=t=>{t.stopPropagation(),null!==e._Progress&&e._Progress.Stop(),e.delayedTime=0,e.repeatTimes>0&&(e.repeatTimes-=1),this.OnRepeatEvent(),e._EnableCssAnimation(e._BuildKeyFrame(),e._OnEndEvent,0)}}const e=this.repeatTimes,i=this.duration;this.repeatTimes=1,this.duration*=1-this.enableStartPos,this._EnableCssAnimation(this._BuildStarterKeyFrame(),t,this.enableStartPos),this.repeatTimes=e,this.duration=i}_EnableCssAnimation(t,e,n){if(null===t)return;null!==t.keyFrameString&&(at().insertRule(t.keyFrameString),this._KeyFrameNameToRecycle=t.name);const s=t.name;this.CheckCssAnimationFormat(s);const r=this._LayoutViewRef.Element;0==(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&i.AnimationEnable.KeepTransform)&&0==(this.enableFlags&i.AnimationEnable.AckRepeat)||(this._Progress=new ft(this._LayoutViewRef),this._Progress.Start(this,n,(t=>{this.OnAnimAdvance(t)})),0!=(this.enableFlags&i.AnimationEnable.AckRepeat)&&(this._LatestProgressValue=0,i.sRenderBridge.RegisterPerFrameCallback(this._TestRepeat)));const a=lt(this,s);window.jsvInAndroidWebView?(r.style.webkitAnimation=a,r.addEventListener("webkitAnimationEnd",e)):(r.style.animation=a,r.addEventListener("animationend",e)),this._CurrentEndEventFunc=e}_PerformAnimationEnd(t){if(null!==this._CurrentEndEventFunc){const t=this._LayoutViewRef.Element,e=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?t.removeEventListener("webkitAnimationEnd",e):t.removeEventListener("animationend",e)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(t&&this.OnEnd());0!=(this.enableFlags&i.AnimationEnable.AckRepeat)&&i.sRenderBridge.UnregisterPerFrameCallback(this._TestRepeat);let e=this._Progress.Stop();if(t&&(e=1),0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(e);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),0!=(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(e)}),0),null!==this._KeyFrameNameToRecycle&&(at().removeRule(this._KeyFrameNameToRecycle),this._KeyFrameNameToRecycle=null)}_TestRepeat(){const t=this._Progress.GetProgress();this._LatestProgressValue>t&&this.OnRepeatEvent(),this._LatestProgressValue=t}_BuildStarterKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_BuildKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}},i.TranslateAnimation=class extends i.KeyFrameAnimation{constructor(t,e,i,n,s,r){super("TL",s,r),this.startX=t,this.startY=i,this.endX=e,this.endY=n}_BuildStarterKeyFrame(){if(this.enableStartPos>0){const t=(this.endX-this.startX)*this.enableStartPos+this.startX,e=(this.endY-this.startY)*this.enableStartPos+this.startY,i="_ForgeAnim_TL_"+mt++;return{name:i,keyFrameString:`@keyframes ${i} {0%{transform:translate3d(${t}px,${e}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}console.error("Error: no enabled starter position")}_BuildKeyFrame(){const t="_ForgeAnim_TL_"+mt++;return{name:t,keyFrameString:`@keyframes ${t} {0%{transform:translate3d(${this.startX}px,${this.startY}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}_GetFrozenTransform(t){return{transform:`translate3d(${Math.floor((this.endX-this.startX)*t+this.startX)}px,${Math.floor((this.endY-this.startY)*t+this.startY)}px,0)`,transformOrigin:null}}},i.FuncAnimation=class extends i.AnimationDelegate{constructor(t,e,i){super("FC2",e,i),this.formula=t,console.warn("NO implemented")}},i.RotateAnimation=class extends i.AnimationDelegate{constructor(t,e,n,s,r,a){super("RO",r,a),n instanceof i.Vec3||(n=new i.Vec3(n)),s instanceof i.Vec3||(s=new i.Vec3(s)),this.startAngle=t,this.offsetAngle=e,this.anchorVec3=n,this.axisVec3=s,console.warn("NO implemented")}},i.BasicScaleAnimation=class extends i.AnimationDelegate{constructor(t,e,i,n,s,r,a,o,l,h){super("SC",a,o),console.warn("NO implemented")}},i.ScaleAnimation=class extends i.BasicScaleAnimation{constructor(t,e,i,n,s,r){const a=200;super(t*a,t*a,e*a,e*a,i,n,s,r,200,200)}},i.OpacityAnimation=class extends i.AnimationDelegate{constructor(t,e,i,n){super("OP",i,n),console.warn("NO implemented")}},i.CssKeyframeAnimation=class extends i.KeyFrameAnimation{constructor(t,e,i,n,s){super("CK",e,i),this._keyFramesSet=t}_BuildKeyFrame(){const t=this._keyFramesSet;if(t.indexOf("@keyframes")<0&&t.indexOf("@-webkit-keyframes")<0)return console.warn("Warning:keyframes array empty"),null;let e=t.split(" ")[1];return e.indexOf("{")>=0&&(e=e.substr(0,e.indexOf("{"))),{name:e,keyFrameString:null}}_GetLastKeyframeTransform(t){let e=t.indexOf("to");if(e<0&&(e=t.indexOf("100%")),e<0)return"";{let i=t.indexOf("transform:",e);return i<0?"":t.substring(i+10,t.indexOf(";",i))}}_GetFrozenTransform(t){let e={transform:"",transformOrigin:null};return 1===t?e={transform:this._GetLastKeyframeTransform(this._keyFramesSet),transformOrigin:null}:console.warn("CssKeyframeAnimation can not get transform whill progress is not 1"),e}},i.CssTransitionAnimation=class extends i.AnimationDelegate{constructor(t){super("CT",null,null),this._transArray=t}Start(t){super.Start(t);const e=this,i=this._transArray,n={};if(0===i.length)return void console.warn("Warning:transition empty");let s="";for(let t=0;t<i.length;t++){let e="linear";const r=i[t];r.tf&&(e=ot(r.tf)),s=`${r.name} ${r.dur/1e3}s ${e} ${r.dly/1e3}s`,n[r.name]=s}t.ApplyStyleTransition(n),s&&(t.Element.addEventListener("transitionend",(t=>{t.stopPropagation(),e.OnEnd(!0)})),t.Element.addEventListener("webkitTransitionEnd",(t=>{t.stopPropagation(),e.OnEnd(!0)})))}},i.KeyFrameGroupAnimation=class extends i.AnimationDelegate{constructor(t){super(t,0,null),this._KeyFrameArray=null,this._LatestProgressValue=0,this._CurrentEndEventFunc=null,this._Progress=null,this._AnimRunList=null,this._AnimationRunIndex=0;const e=this;this._OnEndEvent=t=>{t.stopPropagation(),this._TestFinalKeyFrame(t)?e._PerformAnimationEnd(!0):(this._AnimationRunIndex++,this._LayoutViewRef.Element.style.animation=this._AnimRunList[this._AnimationRunIndex],this._Progress.TriggerNextStep(this._AnimationRunIndex),e._OnSubKeyFrameDone(t))}}Start(t){super.Start(t),t.ResetCssTransform(null,null),t.Element&&(t.Element.style.pointerEvents="auto"),this._EnableCssAnimation(this._BuildKeyFrameGroup(),this._OnEndEvent)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableCssAnimation(t,e){if(null===t)return;this._KeyFrameArray=new Array(t.length);const n=at();for(let e=0;e<t.length;e++){const i=t[e];this.CheckCssAnimationFormat(i.name),this._KeyFrameArray[e]={name:i.name,easing:i.ease.Package(),duration:i.duration,needRecycle:!1},null!==i.keyFrameString&&(n.insertRule(i.keyFrameString),this._KeyFrameArray.needRecycle=!0)}const s=this._LayoutViewRef.Element;0==(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&i.AnimationEnable.KeepTransform)||(this._Progress=new gt(this._LayoutViewRef,this._KeyFrameArray.length),this._Progress.Start(this._KeyFrameArray)),this._AnimRunList=this._ConvertToAnimationStyle(this._KeyFrameArray),this._AnimationRunIndex=0,window.jsvInAndroidWebView?(s.style.webkitAnimation=this._AnimRunList[0],s.addEventListener("webkitAnimationEnd",e)):(s.style.animation=this._AnimRunList[0],s.addEventListener("animationend",e)),this._CurrentEndEventFunc=e}_PerformAnimationEnd(t){if(null!==this._CurrentEndEventFunc){const t=this._LayoutViewRef.Element,e=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?t.removeEventListener("webkitAnimationEnd",e):t.removeEventListener("animationend",e)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(t&&this.OnEnd());let e=this._Progress.Stop();if(t&&(e=1),0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(e);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),0!=(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(e)}),0);const n=at();for(const t of this._KeyFrameArray)t.needRecycle&&n.removeRule(t.name);this._KeyFrameArray=null}_ConvertToAnimationStyle(t){const e=[];for(let i=0;i<t.length;i++){let n="linear";const s=t[i];s.easing&&(n=ot(s.easing)),e.push(`${s.name} ${s.duration/1e3}s ${n}`)}return e}_BuildKeyFrameGroup(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_TestFinalKeyFrame(t){console.warn("Warning:Should override")}_OnSubKeyFrameDone(t){console.warn("Warning:Should override")}},i.TranslateFrameAnimation=class extends i.TranslateAnimation{constructor(t,e,i,n,s,r){let a=s,o=r,l=s,h=r;n?(a=t,l=e):(o=t,h=e);super(a,l,o,h,Math.abs(Math.floor((e-t)/i*1e3)),null)}},i.ThrowAnimation=class extends i.KeyFrameGroupAnimation{constructor(t,e,i,n,s,r,a,o){super("Thr"),this._FromX=t,this._FromY=e,this._XorY=i,this._InitV=n,this._Acc=s,this._To=r,this._HasPole=a,this._PoleCallback=null,this._PolePosition=o,this._IsPositiveMove=this._InitV>0||0===this._InitV&&this._Acc>0}SetPoleCallback(t){this._PoleCallback=t}_MakeTranslateString(t,e,i){return`@keyframes ${t} {0%{transform:translate3d(${e.x.value}px,${e.y.value}px,0);}100%{transform:translate3d(${i.x.value}px,${i.y.value}px,0);}}`}_BuildKeyFrameGroup(){const t=""+mt++,e=[],n={x:{value:this._FromX},y:{value:this._FromY}},s={x:{value:this._FromX},y:{value:this._FromY}},r=0===this._XorY?n.x:n.y,a=0===this._XorY?s.x:s.y;if(this._HasPole){let o=`_ForgeAnim_Thr_Forw_${t}`;a.value=this._PolePosition;let l=this._MakeTranslateString(o,n,s);e.push({name:o,keyFrameString:l,ease:i.Easing.Circular.Out,duration:Math.floor(-this._InitV/this._Acc*1e3)}),o=`_ForgeAnim_Thr_Backw_${t}`,r.value=this._PolePosition,a.value=this._To,l=this._MakeTranslateString(o,n,s),e.push({name:o,keyFrameString:l,ease:i.Easing.Circular.In,duration:Math.floor(1e3*Math.sqrt(2*(this._To-this._PolePosition)/this._Acc))})}else{const o=`_ForgeAnim_Thr_Forw_${t}`;a.value=this._To;const l=this._MakeTranslateString(o,n,s),h=this._IsPositiveMove?this._InitV:-this._InitV,u=this._IsPositiveMove?this._Acc:-this._Acc,c=this._IsPositiveMove?a.value-r.value:r.value-a.value;e.push({name:o,keyFrameString:l,ease:u>0?i.Easing.Circular.In:i.Easing.Circular.Out,duration:Math.floor((Math.sqrt(h*h+2*u*c)-h)/u*1e3)})}return e}_GetFrozenTransform(t){const e={x:{value:this._FromX},y:{value:this._FromY}};let i=0===this._XorY?e.x.value:e.y.value;const n=0===this._XorY?e.x:e.y;let s=0;i=this._IsPositiveMove?i:-i;const r=this._IsPositiveMove?this._To:-this._To,a=this._IsPositiveMove?this._PolePosition:-this._PolePosition;if(this._HasPole){const e=(2*a-i-r)*t;s=e>a-i?a-(e-(a-i)):i+e}else s=i+(r-i)*t;n.value=Math.floor(this._IsPositiveMove?s:-s);return{transform:`translate3d(${e.x.value}px,${e.y.value}px,0)`,transformOrigin:null}}_TestFinalKeyFrame(t){return this._HasPole?t.animationName.indexOf("_ForgeAnim_Thr_Backw_")>=0:t.animationName.indexOf("_ForgeAnim_Thr_Forw_")>=0}_OnSubKeyFrameDone(t){this._HasPole&&this._PoleCallback&&this._PoleCallback()}},i.AnimationEnable={ReleaseAfterEndCallback:1,KeepTransform:2,AckFinalProgress:4,AckRepeat:8};let pt=0;class wt extends i.AnimationDelegate{constructor(t,e){super(t,e,null),this._StepsCount=1,this._Running=!1,this._NextStepIndex=0;const i=this;this._OnStepEnd=()=>{i._NextStep()}}SetStepsCount(t){this._StepsCount=t,this._SplitSteps()}Start(t){super.Start(t),window.jsvInAndroidWebView?this._LayoutViewRef.Element.addEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.addEventListener("animationend",this._OnStepEnd),this._Running=!0,this._NextStep()}Cancel(){this._Running=!1}_NextStep(){null!==this._KeyFrameName&&(at().removeRule(this._KeyFrameName),this._KeyFrameName=null);const t=this._NextStepIndex===this._StepsCount;if(!this._Running||t)return void this._PerformAnimationEnd(t);const e=this._CreateOneStepKeyFrame(this._NextStepIndex);this._KeyFrameName=e.name,at().insertRule(e.keyFrameString);const i=lt({repeatTimes:this.repeatTimes,easing:this.easing,delayedTime:0,duration:this.duration/this._StepsCount},this._KeyFrameName),n=this._LayoutViewRef.Element;window.jsvInAndroidWebView?n.style.webkitAnimation=i:n.style.animation=i,this._NextStepIndex++}_PerformAnimationEnd(t){window.jsvInAndroidWebView?this._LayoutViewRef.Element.removeEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.removeEventListener("animationend",this._OnStepEnd);const e=this._NextStepIndex/this._StepsCount;if(0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(this._NextStepIndex-1);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),window.setTimeout((()=>{this.OnFinalProgress(e)}),0)}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_SplitSteps(){console.warn("Warning: should be override by child class")}_CreateOneStepKeyFrame(t){console.warn("Warning: should be override by child class")}}i.TranslateStepAnimation=class extends wt{constructor(t,e,i,n,s){super("TL-S",s),this.startX=t,this.startY=i,this.endX=e,this.endY=n,this._StepsArray=null}_SplitSteps(){const t=this._StepsCount,e=(this.endX-this.startX)/t,i=(this.endY-this.startY)/t;this._StepsArray=new Array(t);let n=this.startX,s=this.startY;for(let r=0;r<t-1;r++)n+=e,s+=i,this._StepsArray[r]={targetX:Math.floor(n),targetY:Math.floor(s)};this._StepsArray[t-1]={targetX:this.endX,targetY:this.endY}}_CreateOneStepKeyFrame(t){let e=0,i=0;0===t?(e=this.startX,i=this.startY):(e=this._StepsArray[t-1].targetX,i=this._StepsArray[t-1].targetY);const n=this._StepsArray[t].targetX,s=this._StepsArray[t].targetY,r="_ForgeStepAnim_TL_"+pt++;return{name:r,keyFrameString:`@keyframes ${r} {\n 0%{transform:translate3d(${e}px,${i}px,0);}\n 100%{transform:translate3d(${n}px,${s}px,0);}}`}}_GetFrozenTransform(t){return{transform:`translate3d(${this._StepsArray[t].targetX}px,${this._StepsArray[t].targetY}px,0)`,transformOrigin:null}}};i.RenderBridge=class{constructor(){this._ScreenInfo={width:160,height:90,x:2/160,y:2/90,perspective:2/160,scaleRatio:1,designedWidth:1280},this._FrameLoopFunc=null,this._CallbacksPerFrame=new Set,this._WillSwapCallbacks=new Map,this._DoWillSwapCallback=this._OnWillSwap.bind(this)}BeginHtmlFrameLoop(){null===this._FrameLoopFunc&&window.requestAnimationFrame&&(this._FrameLoopFunc=this._OnAnimation.bind(this),window.requestAnimationFrame(this._FrameLoopFunc))}_OnAnimation(){let t=!1;if(i.sViewSensorManager.HtmlHasActiveSensor()&&(i.sViewSensorManager.HtmlDoWorkOnFrame(),i.sViewSensorManager.HtmlHasActiveSensor()&&(t=!0)),this._CallbacksPerFrame.size>0){for(const t of this._CallbacksPerFrame)t();this._CallbacksPerFrame.size>0&&(t=!0)}t?window.requestAnimationFrame(this._FrameLoopFunc):this._FrameLoopFunc=null}GetScreenInfo(){return this._ScreenInfo}InitScreenBuffer(t,e){isNaN(t)&&(t=1),isNaN(e)&&(e=1280);const i=e*t,n=i/16*9;this._ScreenInfo.width=Math.floor(i),this._ScreenInfo.height=Math.floor(n),this._ScreenInfo.x=2/this._ScreenInfo.width,this._ScreenInfo.y=2/this._ScreenInfo.height,this._ScreenInfo.perspective=this._ScreenInfo.x,this._ScreenInfo.scaleRatio=t,this._ScreenInfo.designedWidth=e}RequestSwap(){this._OnRequesting||(this._OnRequesting=!0,Promise.resolve().then(this._DoRequestSwap.bind(this)))}SetGlobalConfig(t){}AddWillSwapListener(t,e){this._WillSwapCallbacks.set(t,e)}_DoRequestSwap(){this._WillSwapCallbacks.size>0&&this._WillSwapCallbacks.forEach(this._DoWillSwapCallback),this._OnRequesting=!1}InstantPerformSwap(){this._OnRequesting&&(this._OnRequesting=!1,this._DoRequestSwap(!1))}_OnWillSwap(t){t()}RegisterPerFrameCallback(t){this._CallbacksPerFrame.add(t)}UnregisterPerFrameCallback(t){this._CallbacksPerFrame.delete(t)}},i.sRenderBridge=new i.RenderBridge;class bt{constructor(t,e,i){this._TextureManager=t,this._GL=e,this._Loaded=!1,this._OnLoad=i,this.TextureId=null,this._TextureSource=null}_setGLTexture(){this.TextureId=this._GL.createTexture(),this._GL.activeTexture(this._GL.TEXTURE0),this._GL.bindTexture(this._GL.TEXTURE_2D,this.TextureId),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_WRAP_S,this._GL.CLAMP_TO_EDGE),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_WRAP_T,this._GL.CLAMP_TO_EDGE),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_MIN_FILTER,this._GL.NEAREST),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_MAG_FILTER,this._GL.LINEAR),this._GL.texImage2D(this._GL.TEXTURE_2D,0,this._GL.RGBA,this._GL.RGBA,this._GL.UNSIGNED_BYTE,this._TextureSource)}loaded(){return this._Loaded}recycle(){this._TextureManager.recycle(this._TextureSource)}}bt.IMAGE=Symbol("Texture.IMAGE"),bt.COLOR=Symbol("Texture.COLOR");class Tt extends bt{constructor(t,e,i,n){if(super(t,e,i),n){const t=n.trim();if(0===t.indexOf("http"))this.Url=t;else if(0===t.indexOf("url")){const e=t.indexOf("("),i=t.indexOf(")");this.Url=t.substring(e+1,i)}else this.Url=n;this._TextureSource=new Image,this._TextureSource.onload=()=>{this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()},this._TextureSource.src=this.Url}}}class St{constructor(){this._Canvas=window.originDocument.createElement("canvas"),this._Canvas.setAttribute("width","1px"),this._Canvas.setAttribute("height","1px"),this._Canvas.setAttribute("style","position: absolute; pointer-events: none;"),document.body.appendChild(this._Canvas),this._GL=this._Canvas.getContext("2d")}getColorImageData(t,e,i,n){const s=this._GL.createImageData(1,1);return s.data[0]=t,s.data[1]=e,s.data[2]=i,s.data[3]=n,s}}let yt=null;class xt extends bt{constructor(t,e,i,n){super(t,e,i),null===yt&&(yt=new St),this.Color=n;const s=(t=>{if(!t)return null;if(0===(t=t.trim()).indexOf("rgba")){const e=t.indexOf("("),i=t.indexOf(")");return t.substr(e+1,i-e-1).split(",").map(((t,e)=>3===e?Math.ceil(255*parseFloat(t)):parseInt(t,10)))}if(0===t.indexOf("#")){let e=t.substr(1);const i=e.length;if(6===i||8===i){6===i&&(e+="FF");const t=parseInt(`0x${e}`,10);return[t>>24&255,t>>16&255,t>>8&255,255&t]}return null}return null})(this.Color);this._TextureSource=yt.getColorImageData(...s),this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()}}const Et=new class{constructor(){this._TextureMap={}}getTexture(t,e,i,n){let s;if(this._TextureMap[n])s=this._TextureMap[n].texture,this._TextureMap[n].useCount++;else{switch(t){case bt.IMAGE:s=new Tt(this,e,i,n);break;case bt.COLOR:s=new xt(this,e,i,n);break;default:console.log(`getTexture type is error:${t}`)}this._TextureMap[n]={texture:s,useCount:1}}return s}recycle(t){this._TextureMap[t]&&(this._TextureMap[t].useCount--,this._TextureMap[t].useCount<0&&delete this._TextureMap[t])}},vt=(t,e)=>Math.random()*(e-t)+t;class Lt{constructor(t,e,i,n,s){this._ViewId=t,this._Type=e.type,this._ParticleNum=e.particleNum,this._DeltaAngle=e.deltaAngle/180*Math.PI,this._DeltaWidthFact=e.deltaWidth/n.width,this._DeltaHeightFact=e.deltaHeight/n.height,this._PointSizeMin=e.pointSizeMin,this._PointSizeMax=e.pointSizeMax,this._SpeedMin=e.speedMin,this._SpeedMax=e.speedMax,this._LifeMin=e.lifeMin/1e3,this._LifeMax=e.lifeMax/1e3,this._AddNumSpeed=e.addNumSpeed,this._AcceletateX=e.accelerateX,this._AcceletateY=e.accelerateY,this._EnableFade=e.enableFade,this._EnableShrink=e.enableShrink,this._Texture=i,this._Buffer=new Float32Array(7*this._ParticleNum),this._AddedParticleNum=0,this._Element=s,this._StartTime=-1,this._LastFrameTime=-1,this._Stopped=!1,this._getTransform=this._getTransform.bind(this)}_getTransform(){let t=this._Element.jsvMainView.Element;const e=Ct(t.style.width),i=Ct(t.style.height);let n=new window.WebKitCSSMatrix;for(;t.parentElement;){const e=getComputedStyle(t);if(e.transform){const i=e.transformOrigin?e.transformOrigin:e.webkitTransformOrigin;if(i){const s=Ct(i),r=new window.WebKitCSSMatrix(`translate(-${s[0]}px,-${s[1]}px)`),a=new window.WebKitCSSMatrix(`translate(${s[0]}px,${s[1]}px)`),o=new window.WebKitCSSMatrix(`translate(${t.offsetLeft}px,${t.offsetTop}px)`),l=new window.WebKitCSSMatrix(e.transform);n=o.multiply(a.multiply(l.multiply(r.multiply(n))))}else n=new window.WebKitCSSMatrix(e.transform).multiply(n)}t=t.parentElement}const s=new window.WebKitCSSMatrix;s.m11=0,s.m12=0,s.m14=1,s.m21=e,s.m22=0,s.m24=1,s.m31=0,s.m32=i,s.m34=1,s.m41=e,s.m42=i,s.m44=1,n=n.multiply(s);return[n.m11,n.m12,n.m21,n.m22,n.m31,n.m32,n.m41,n.m42]}_updateParticleInfo(t,e,i,n,s,r){const a=vt(0,2*this._DeltaWidthFact),o=vt(0,2*this._DeltaHeightFact);this._Buffer[7*t]=a*i[0]+o*n[0]+e[0],this._Buffer[7*t+1]=a*i[1]+o*n[1]+e[1],this._Buffer[7*t+2]=s+vt(-this._DeltaAngle,this._DeltaAngle),this._Buffer[7*t+3]=vt(this._SpeedMin,this._SpeedMax),this._Buffer[7*t+4]=r,this._Buffer[7*t+5]=vt(this._LifeMin,this._LifeMax),this._Buffer[7*t+6]=vt(this._PointSizeMin,this._PointSizeMax)}onDrawFrame(t,e,i){if(!this._Texture.loaded()||this._Stopped)return;this._StartTime<0&&(this._StartTime=Date.now()),this._LastFrameTime<0&&(this._LastFrameTime=this._StartTime);const n=this._getTransform();for(let t=0;t<n.length;t++)n[t]=t%2==0?2*n[t]/window.innerWidth-1:1-2*n[t]/window.innerHeight;const s=(Date.now()-this._StartTime)/1e3,r=[n[0],n[1]],a=[n[2]-n[0],n[3]-n[1]],o=[n[4]-n[0],n[5]-n[1]],l=Math.sqrt(a[0]*a[0]+a[1]*a[1]),h=-a[1]/l,u=a[0]/l>0?Math.acos(h):2*Math.PI-Math.acos(h);if(0===this._Type)if(this._AddedParticleNum<this._ParticleNum){for(let t=0;t<this._ParticleNum;t++)this._updateParticleInfo(t,r,a,o,u,s);this._AddedParticleNum=this._ParticleNum}else{let t=!0;for(let e=0;e<this._ParticleNum;e++)if(this._Buffer[7*e+4]+this._Buffer[7*e+5]>s){t=!1;break}t&&(this._Stopped=!0)}else if(this._AddedParticleNum<this._ParticleNum){let t=Math.round((Date.now()-this._LastFrameTime)*this._AddNumSpeed);this._AddedParticleNum+t>this._ParticleNum&&(t=this._ParticleNum-this._AddedParticleNum);for(let e=0;e<t;e++)this._updateParticleInfo(this._AddedParticleNum+e,r,a,o,u,s);this._AddedParticleNum+=t}else for(let t=0;t<this._ParticleNum;t++)this._Buffer[7*t+4]+this._Buffer[7*t+5]<s&&this._updateParticleInfo(t,r,a,o,u,s);const c=t.getUniformLocation(e,"uTime");t.uniform1f(c,s);const d=t.getUniformLocation(e,"uAccelerate");t.uniform2f(d,this._AcceletateX,this._AcceletateY);const _=t.getUniformLocation(e,"uEnableFade");t.uniform1i(_,this._EnableFade?1:0);const f=t.getUniformLocation(e,"uEnableShrink");t.uniform1i(f,this._EnableShrink?1:0),t.bindBuffer(t.ARRAY_BUFFER,i),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this._Texture.TextureId),t.bufferSubData(t.ARRAY_BUFFER,0,this._Buffer);const g=this._Buffer.BYTES_PER_ELEMENT,m=t.getAttribLocation(e,"aPosition");t.vertexAttribPointer(m,2,t.FLOAT,!1,7*g,0),t.enableVertexAttribArray(m);const p=t.getAttribLocation(e,"aSpeed");t.vertexAttribPointer(p,2,t.FLOAT,!1,7*g,2*g),t.enableVertexAttribArray(p);const w=t.getAttribLocation(e,"aLife");t.vertexAttribPointer(w,2,t.FLOAT,!1,7*g,4*g),t.enableVertexAttribArray(w);const b=t.getAttribLocation(e,"aPointSize");t.vertexAttribPointer(b,1,t.FLOAT,!1,7*g,6*g),t.enableVertexAttribArray(b),t.drawArrays(t.POINTS,0,this._AddedParticleNum)}recycle(){this._Buffer=null,this._Texture.recycle(),this._Stopped=!0}}let It=0;i.sParticleManager=new class{constructor(){this._Inited=!1,this._Canvas=null,this._GL=null,this._GLProgram=null,this._VBO=null,this._ParticleViewMap={},this._LoopStarted=!1,this._onDrawFrame=this._onDrawFrame.bind(this)}_initCanvas(){if(this._Canvas=window.originDocument.createElement("canvas"),this._Canvas.setAttribute("width",`${window.innerWidth}px`),this._Canvas.setAttribute("height",`${window.innerHeight}px`),this._Canvas.setAttribute("style","position: absolute; pointer-events: none;"),document.body.appendChild(this._Canvas),this._GL=this._Canvas.getContext("webgl"),!this._GL)return void console.error("init webgl failed");console.log("webgl info: ",this._GL.getParameter(this._GL.VERSION),this._GL.getParameter(this._GL.SHADING_LANGUAGE_VERSION),this._GL.getParameter(this._GL.VENDOR));const t=this._GL.createShader(this._GL.VERTEX_SHADER);this._GL.shaderSource(t,"attribute vec2 aPosition;attribute vec2 aSpeed;attribute vec2 aLife;attribute float aPointSize;uniform float uTime;uniform vec2 uAccelerate;uniform bool uEnableFade;uniform bool uEnableShrink;varying float alpha;void main() { float use_time = (uTime - aLife.x) / 10.0; float x = aSpeed.y * cos(aSpeed.x) * use_time + 0.5 * uAccelerate.x * use_time * use_time; float y = aSpeed.y * sin(aSpeed.x) * use_time + 0.5 * uAccelerate.y * use_time * use_time; float percent = (uTime - aLife.x) / aLife.y; percent = percent > 1.0 ? 0.0 : cos(1.57 * percent); alpha = uEnableFade ? percent : 1.0; gl_PointSize = uEnableShrink ? aPointSize * percent : aPointSize; gl_Position = vec4(x + aPosition.x, y + aPosition.y, 0.0, 1.0);}"),this._GL.compileShader(t);const e=this._GL.createShader(this._GL.FRAGMENT_SHADER);this._GL.shaderSource(e,"precision mediump float;uniform sampler2D uTexture;varying float alpha;void main(void) { vec4 texture = texture2D(uTexture, gl_PointCoord) * alpha; gl_FragColor = texture;}"),this._GL.compileShader(e),this._GLProgram=this._GL.createProgram(),this._GL.attachShader(this._GLProgram,t),this._GL.attachShader(this._GLProgram,e),this._GL.linkProgram(this._GLProgram);const i=new Float32Array(3500),n=i.BYTES_PER_ELEMENT;this._VBO=this._GL.createBuffer(),this._GL.bindBuffer(this._GL.ARRAY_BUFFER,this._VBO),this._GL.bufferData(this._GL.ARRAY_BUFFER,i,this._GL.DYNAMIC_DRAW);const s=this._GL.getAttribLocation(this._GLProgram,"aPosition");this._GL.vertexAttribPointer(s,2,this._GL.FLOAT,!1,7*n,0),this._GL.enableVertexAttribArray(s);const r=this._GL.getAttribLocation(this._GLProgram,"aSpeed");this._GL.vertexAttribPointer(r,2,this._GL.FLOAT,!1,7*n,2*n),this._GL.enableVertexAttribArray(r);const a=this._GL.getAttribLocation(this._GLProgram,"aLife");this._GL.vertexAttribPointer(a,2,this._GL.FLOAT,!1,7*n,4*n),this._GL.enableVertexAttribArray(a);const o=this._GL.getAttribLocation(this._GLProgram,"aPointSize");this._GL.vertexAttribPointer(o,1,this._GL.FLOAT,!1,7*n,6*n),this._GL.enableVertexAttribArray(o),this._GL.useProgram(this._GLProgram);const l=this._GL.getUniformLocation(this._GLProgram,"uTexture");this._GL.uniform1i(l,0),this._GL.enable(this._GL.BLEND),this._GL.enable(this._GL.SAMPLE_ALPHA_TO_COVERAGE),this._GL.blendFunc(this._GL.ONE,this._GL.ONE_MINUS_SRC_ALPHA),this._Inited=!0}_onDrawFrame(){this._GL.clear(this._GL.COLOR_BUFFER_BIT),this._GL.useProgram(this._GLProgram);for(const t in this._ParticleViewMap)this._ParticleViewMap.hasOwnProperty(t)&&this._ParticleViewMap[t].onDrawFrame(this._GL,this._GLProgram,this._VBO);window.requestAnimationFrame(this._onDrawFrame)}addParticle(t,e,i,n){this._Inited||this._initCanvas();const s=It++;let r;return r=0===e.indexOf("rgba")||0===e.indexOf("#")?Et.getTexture(bt.COLOR,this._GL,null,e):Et.getTexture(bt.IMAGE,this._GL,null,e),this._ParticleViewMap[s]=new Lt(s,t,r,i,n),this._LoopStarted||(this._LoopStarted=!0,window.requestAnimationFrame(this._onDrawFrame)),s}recycleView(t){this._ParticleViewMap[t]&&(this._ParticleViewMap[t].recycle(),delete this._ParticleViewMap[t])}};let At,Ct=t=>{if(t.indexOf(" ")>=0){return t.split(" ").map((t=>parseInt(t.substr(0,t.length-2),10)))}return parseInt(t.substr(0,t.length-2),10)};i.ReactUtils={StyleClassMap:{}};{let t=0;class e{constructor(e,i){this._ID=i||e+t++,this.Describe={},this._RefCount=0,this._Recycled=!1}ManualSetId(t){this._ID=t}GetId(){return this._ID}DoRef(){this._RefCount++}UnRef(){this._RefCount>0?this._RefCount--:console.warn("Already 0...")}}class n extends e{constructor(t){super(null,t)}}const s=new n("DISABLE"),r={alignment:"left",vertical_align:"top",vertical_area_align:"top",text_overflow:"clip",word_wrap:"normal",direction:"ltr",text_inner_direction:"unset"},a=["alignment","vertical_align","vertical_area_align","text_overflow","word_wrap","direction","text_inner_direction"];class o extends e{constructor(t,e,i,n,s,r,a){super("DS",null),this.Describe.alignment=t,this.Describe.vertical_align=e,this.Describe.vertical_area_align=i,this.Describe.text_overflow=n,this.Describe.word_wrap=s,this.Describe.direction=r,this.Describe.text_inner_direction=a}GetSyncData(){return{T:0,ID:this._ID,A:this.Describe.alignment,VA:this.Describe.vertical_align,VAA:this.Describe.vertical_area_align,TO:this.Describe.text_overflow,WW:this.Describe.word_wrap,DIR:this.Describe.direction,TID:this.Describe.text_inner_direction}}}const l={font:"黑体",italic:!1,bold:!1},h=["font","italic","bold"];class u extends e{constructor(t,e,i){super("FS",null),this.Describe.font=t,this.Describe.italic=e,this.Describe.bold=i}GetSyncData(){return{T:1,ID:this._ID,F:this.Describe.font,I:this.Describe.italic,B:this.Describe.bold}}}const c={text_color:"#000000",bg_color:"#00FFFFFF"},d=["text_color","bg_color"];class _ extends e{constructor(t,e){super("CS",null),this.Describe.text_color=t,this.Describe.bg_color=e}GetSyncData(){return{T:2,ID:this._ID,TC:this.Describe.text_color,BC:this.Describe.bg_color}}}const f=["shadow_offset_x","shadow_offset_y","shadow_blur","shadow_color","stroke_width","stroke_color"];class g extends e{constructor(t,e,i,n,s,r){super("SS",null),this.Describe.shadow_offset_x=t,this.Describe.shadow_offset_y=e,this.Describe.shadow_blur=i,this.Describe.shadow_color=n,this.Describe.stroke_width=s,this.Describe.stroke_color=r}GetSyncData(){return{T:3,ID:this._ID,OX:this.Describe.shadow_offset_x,OY:this.Describe.shadow_offset_y,B:this.Describe.shadow_blur,C:this.Describe.shadow_color,SW:this.Describe.stroke_width,SC:this.Describe.stroke_color}}}class m{constructor(t){this.DS=i.sTextStyleCache.GetDisplayStyle(t),this.FS=i.sTextStyleCache.GetFontStyle(t),this.CS=i.sTextStyleCache.GetColorStyle(t),this.SS=i.sTextStyleCache.GetSpecialStyle(t),this._IdsCache=null}DoRef(){this.DS.DoRef(),this.FS.DoRef(),this.CS.DoRef(),this.SS.DoRef()}UnRef(){this.DS.UnRef(),this.FS.UnRef(),this.CS.UnRef(),this.SS.UnRef()}GetIdsPack(){return this._IdsCache||(this._IdsCache={DS:this.DS.GetId(),FS:this.FS.GetId(),CS:this.CS.GetId(),SS:this.SS.GetId()}),this._IdsCache}}class p{constructor(){this._DisplayStyleMap=new Map,this._DisplayStyleIds=new Map,this._FontStyleMap=new Map,this._FontStyleIds=new Map,this._ColorStyleMap=new Map,this._ColorStyleIds=new Map,this._SpecialStyleMap=new Map,this._SpecialStyleIds=new Map,this._NewStyleList=[]}StyleToPack(t){let e={alignment:void 0!==t.hAlign?t.hAlign:r.alignment,vertical_align:void 0!==t.vAlign?t.vAlign:r.vertical_align,vertical_area_align:void 0!==t.vAreaAlign?t.vAreaAlign:r.vertical_area_align,text_overflow:void 0!==t.textOverflow?t.textOverflow:r.text_overflow,word_wrap:void 0!==t.wordWrap?t.wordWrap:r.word_wrap,font:void 0!==t.font?t.font:l.font,italic:void 0!==t.italic?t.italic:l.italic,bold:void 0!==t.bold?t.bold:l.bold,text_color:void 0!==t.textColor?t.textColor:c.text_color,bg_color:void 0!==t.backgroundColor?t.backgroundColor:c.bg_color,direction:void 0!==t.direction?t.direction:"ltr",text_inner_direction:void 0!==t.textInnerDirection?t.textInnerDirection:"unset",shadow_offset_x:0,shadow_offset_y:0,shadow_blur:0,shadow_color:null,stroke_width:0,stroke_color:null};if(t.shadow){const i=t.shadow;e.shadow_offset_x=i.shadowOffsetX,e.shadow_offset_y=i.shadowOffsetY,e.shadow_blur=i.shadowBlur,e.shadow_color=i.shadowColor}if(t.stroke){const i=t.stroke;e.stroke_width=i.strokeWidth,e.stroke_color=i.strokeColor}return new m(e)}PrepareSyncNewStyles(){if(this._NewStyleList.length>0){let t=[];for(let e of this._NewStyleList)t.push(e.GetSyncData());i.sRenderTextureDelegateManager.CreateTextureHeadStatus().SetResourceInfo({STA:{Nam:"TST",Sta:t}}),this._NewStyleList=[]}}GetDisplayStyle(t){return this._GetStyle(t,a,o,this._DisplayStyleMap,this._DisplayStyleIds)}GetFontStyle(t){return this._GetStyle(t,h,u,this._FontStyleMap,this._FontStyleIds)}GetColorStyle(t){return this._GetStyle(t,d,_,this._ColorStyleMap,this._ColorStyleIds)}GetSpecialStyle(t){return 0===t.shadow_blur&&0===t.stroke_width?s:this._GetStyle(t,f,g,this._SpecialStyleMap,this._SpecialStyleIds)}GetDsFromId(t){return this._DisplayStyleIds.get(t)}GetFsFromId(t){return this._FontStyleIds.get(t)}GetCsFromId(t){return this._ColorStyleIds.get(t)}GetSsFromId(t){return this._SpecialStyleIds.get(t)}_GetStyle(t,e,i,n,s){let r=[];for(let i of e)r.push(t[i]);let a=r.join(":"),o=null;return n.has(a)?o=n.get(a):(o=new i(...r),n.set(a,o),s.set(o.GetId(),o),window.JsView&&this._NewStyleList.push(o)),o}}i.TextStyleObjectBase=e,i.TextStylePack=m,i.sTextStyleCache=new p}At="undefined"!=typeof ForgeExtension?i:{LogM:console.log.bind(console),LogF:console.error.bind(console),LogE:console.error.bind(console),LogW:console.warn.bind(console),LogI:console.log.bind(console),LogD:console.debug.bind(console),ThrowError:t=>{throw new Error(t)},Assert:t=>{if(!t)throw new Error("ASSERT!!!!!")},BaseActivity:class{}};class Pt{constructor(t,e,i){this.PageName=t,this._FocusChild=null,this._LatestFocusChild=null,this.SubPages=[],this._ParentPage=null,this._ConsumeKeycodeUntilUp=-1,this.TouchDispatcher=null,this._Acc=.001,this._KeyLock=!1,this._CVSet=null,this._AutoShow=!1,this._IsShowing=!1,this._HostActivity=i,e&&this.SetContentView(e)}OnRenderFrame(){At.LogE("OnRenderFrame() MUST override")}OnKeyDown(t){return!1}OnKeyUp(t){return!1}DispatchKeyDown(t){if(this._KeyLock)return!0;let e=!1;return Pt.LastFocusPage=this,this._FocusChild&&(e=this._FocusChild.DispatchKeyDown(t)),e||(e=this.OnKeyDown(t)),e}DispatchKeyUp(t){if(this._KeyLock)return!0;let e=!1;return this._FocusChild&&(e=this._FocusChild.DispatchKeyUp(t)),e||(e=this.OnKeyUp(t)),e}OnCustomerEvent(t){return!1}BubbleCustomerEvent(t){this.OnCustomerEvent(t)||this._ParentPage&&this._ParentPage.BubbleCustomerEvent(t)}PrintLastFocusPage(){let t="------"+this.PageName+"\n",e=this._ParentPage;return e&&(t+=e.PrintLastFocusPage()),t}OnMouseDown(t){return!1}EnableTouchDispatcher(){this.TouchDispatcher=new i.TouchDispatcher(this)}DisableTouchDispatcher(){this.TouchDispatcher=null}GetTouchView(){return null}GetSwipeParams(t,e,i){let n=void 0===i||0===i?this._Acc:i,s=t*t/2/n;t<0&&(s=-s);let r=e*e/2/n;return e<0&&(r=-r),{durationX:Math.floor(Math.abs(t/n)),durationY:Math.floor(Math.abs(e/n)),distanceX:s,distanceY:r}}OnTouch(t){return!1}DispatchTouch(t){let e=!1;return this.TouchDispatcher&&(e=this.TouchDispatcher.OnTouch(t)),e}LostTouchFocus(t){}OnJavaKey(t,e){return!0}OnPlatformKey(t,e){return!0}PassPlatformKey(t,e){if(this._KeyLock)return!1;let i=this.OnPlatformKey(t,e);return i&&(i=this.OnJavaKey(t,e)),i}DispatchJavaKey(t,e){if(t===this._ConsumeKeycodeUntilUp)return 1===e&&(this._ConsumeKeycodeUntilUp=-1),i.LogM("Consume Javakey until up keycode="+t+" keyaction="+e),!1;if(this._KeyLock)return!1;-1!==this._ConsumeKeycodeUntilUp&&(i.LogE("ERROR: Other key pressed before locked key release"),this._ConsumeKeycodeUntilUp=-1);let n=this._FocusChild,s=!0;return n&&(s=n.DispatchJavaKey(t,e)),s&&(s=this.PassPlatformKey(t,e)),n!==this._FocusChild&&0===e&&this.CosumeAllKeyUnitlUpForFocusChange(t),s}CosumeAllKeyUnitlUpForFocusChange(t){this._ParentPage?this._ParentPage.CosumeAllKeyUnitlUpForFocusChange(t):this._ConsumeKeycodeUntilUp=t}OnHostActivityGetFocus(){this._ConsumeKeycodeUntilUp=-1}IsFocus(){return!this._ParentPage||this._ParentPage._FocusChild===this}_IsLeafInChain(){return this.IsFocus()&&!this._FocusChild}SetParent(t,e){null!==t?(null!==e&&this.SetContentView(e),t instanceof At.BaseActivity&&(t=t.GetRootPageBase()),this._ParentPage=t,t.SubPages.push(this),this._HostActivity=t._HostActivity,t._IsShowing&&this._AutoShow&&this._OnShowInternal()):At.ThrowError("ERROR: parent is null")}SetParentPage(t){this.SetParent(t)}RemoveSubPage(t){t===this._FocusChild&&(this._FocusChild=null),t===this._LatestFocusChild&&(this._LatestFocusChild=null);for(let e=0;e<this.SubPages.length;e++)if(t===this.SubPages[e]){t._OnHideInternal(),this.SubPages.splice(e,1);break}}ClearSubPages(){this.SubPages=[],this._FocusChild=null,this._LatestFocusChild=null}GetParentPage(){return this._ParentPage}Focus(t){if(this.IsFocus()){if(!t)return void At.LogI("Already focused page_name="+this.PageName);if(this._IsLeafInChain())return void At.LogI("Already focused page_name="+this.PageName)}if(Pt.sChangingFocusLock)return void Pt.sDelayedFocusChanges.push(this);if(Pt.sChangingFocusLock=!0,this._ParentPage){let e,i=[],n=this;for(;n._ParentPage&&!n.IsFocus();)i.push(n),n=n._ParentPage;e=t&&0===i.length?this._FocusChild:i[i.length-1]._ParentPage._FocusChild;let s=[];for(;e;)s.push(e),e=e._FocusChild;for(let t=s.length-1;t>=0;t--)s[t]._BlurInternal();for(let t=i.length-1;t>=0;t--)i[t]._FocusInternal();if(!t){let t=i[0];for(;t._LatestFocusChild&&null===t._FocusChild;)t._LatestFocusChild._FocusInternal(),t=t._FocusChild,t||At.ThrowError("ERROR: focus chain is broken")}}Pt.sChangingFocusLock=!1;let e=Pt.sDelayedFocusChanges.length;if(e>0){let t=Pt.sDelayedFocusChanges;Pt.sDelayedFocusChanges=[];for(let i=0;i<e;i++)t[i].Focus()}}ReturnFocusToParent(){this._ParentPage&&(this.IsFocus()&&this._ParentPage.Focus(!0),this._ParentPage._FocusChild==this&&(this._ParentPage._FocusChild=null),this._ParentPage._LatestFocusChild==this&&(this._ParentPage._LatestFocusChild=null))}_FocusInternal(){this._ParentPage?(this._ParentPage._FocusChild=this,this._ParentPage._LatestFocusChild=this,this.OnFocus()):i.LogE("No dispatcher")}_BlurInternal(){this._ParentPage||i.LogE("No dispacher"),this._ParentPage._FocusChild===this?(this._ParentPage._FocusChild=null,this.OnBlur()):At.LogW("Not focus yet, page name="+this.PageName)}GetFocusChild(){return this._FocusChild}Hide(){this._AutoShow=!1,this._OnHideInternal()}Show(t){this._OnShowInternal(),t&&this.Focus()}OnFocus(){At.LogW("No overrided Page OnFocus event, page name="+this.PageName)}OnBlur(){At.LogW("No overrided Page OnBlur event, page name="+this.PageName)}OnShow(){At.LogW("No overrided Page OnShow event, page name="+this.PageName)}OnHide(){At.LogW("No overrided Page OnHide event, page name="+this.PageName)}_OnShowInternal(){let t;for(let e=0;e<this.SubPages.length;e++)t=this.SubPages[e],t._AutoShow&&t._OnShowInternal();this._IsShowing||(this._IsShowing=!0,this.OnShow())}_OnHideInternal(){let t;for(let e=0;e<this.SubPages.length;e++)t=this.SubPages[e],t._IsShowing&&t._OnHideInternal();this._IsShowing&&(this._IsShowing=!1,this.OnHide())}GetMainView(){return null===this._CVSet&&(this._CVSet=new i.MainViewSetting(null,null)),this._CVSet}GetContentView(){return null===this._CVSet?null:this._CVSet.View}SetContentView(t){null!==t&&(null!==this._CVSet&&this._CVSet.View.BindedPageBase(null),this._CVSet=new i.MainViewSetting(t,null),t.BindedPageBase(this))}OnContentViewLostInternal(){this.OnContentViewLost()}OnContentViewLost(){}GetHostActivity(){return this._HostActivity}SetHostActivity(t){this._HostActivity=t}GetTextureManager(){return null!==this._HostActivity?this._HostActivity.GetTextureManager():null}SetAutoShow(t){this._AutoShow=t}KeyLock(){this._KeyLock=!0}UnKeyLock(){this._KeyLock=!1}}Pt.LastFocusPage=null,Pt.sChangingFocusLock=!1,Pt.sDelayedFocusChanges=[],i.PageBase=Pt;{let t=1,e=2,n=3;class s{constructor(n,s){this.IdToken=i.sViewSensorManager.IdTokenGenerator++,this.Type=n,this.Manager=null,this._OnAnyViewLostList=null,this._AnyViewLostMark=null,this._OnWholeViewLostList=null,this._WholeViewLostMark=null,this._HtmlStatusInfo={target:null==s?t:e}}OnManaged(t){return this._HtmlStatusInfo.target!=n&&(this.Manager?(console.error("manage duplicated"),!1):(this._RegisterViewLostCallbacks(),this.Manager=t,!0))}ResetAutoRecycleViewsRef(t,e){t instanceof Array&&e instanceof Array?this._HtmlStatusInfo.target!=n&&(this._UnregisterViewCallbacks(),this._OnAnyViewLostList=t,this._OnWholdViewLostList=e,this.Manager&&this._RegisterViewLostCallbacks()):console.error("need array ",t,e)}Expired(){return this._HtmlStatusInfo.target==n}Recycle(){this._HtmlStatusInfo.target!=n&&this.Manager&&(this._HtmlStatusInfo.target=n,this.OnSelfRecycle(),this.Manager.RecycleSensor(this),this.Manager=null,this._UnregisterViewCallbacks()),this._OnAnyViewLostList=null,this._OnWholdViewLostList=null}HtmlDoWorkOnFrame(){console.log("Need be override")}HtmlNeedWorkOnFrame(){return!0}OnCallback(t){console.log("Need be override")}OnSelfRecycle(){}_RegisterViewLostCallbacks(){let t=this;if(this._OnAnyViewLostList?.length>0){let e=this._OnAnyViewLostList.length;this._AnyViewLostMark={callbacks:new Array(e).fill(null)};for(let i=0;i<e;i++){let e=this._OnAnyViewLostList[i];if(e.Expired)this._OnAnyViewLostList[i]=null;else{let n=()=>{t.Recycle()};this._AnyViewLostMark.callbacks[i]=n,e.RegisterDetachCallback(n)}}}else this._AnyViewLostMark=null;if(this._OnWholeViewLostList?.length>0){let e=this._OnWholeViewLostList.length;this._WholeViewLostMark={list:new Array(e).fill({callback:null,lost:!1}),lostCount:0};for(let i=0;i<e;i++){let e=this._OnWholeViewLostList[i];if(e.Expired)this._OnWholeViewLostList[i]=null,this._WholeViewLostMark.list[i].lost=!0,this._WholeViewLostMark.lostCount++;else{let n=()=>{t._OnViewOfWholeListLost(i)};this._WholeViewLostMark.list[i].callback=n,e.RegisterDetachCallback(n)}}}else this._WholeViewLostMark=null}_UnregisterViewCallbacks(){if(this._AnyViewLostMark){let t=this._OnAnyViewLostList.length;for(let e=0;e<t;e++){this._OnAnyViewLostList[e]&&this._OnAnyViewLostList[e].UnregisterDetachCallback(this._AnyViewLostMark.callbacks[e])}this._AnyViewLostMark=null}if(this._WholeViewLostMark){let t=this._OnWholdViewLostList.length;for(let e=0;e<t;e++){this._OnWholdViewLostList[e]&&this._OnWholdViewLostList[e].UnregisterDetachCallback(this._WholeViewLostMark.list[e].callback)}this._WholeViewLostMark=null}}_OnViewOfWholeListLost(t){this._WholeViewLostMark.list[t].lost||(this._WholeViewLostMark.lostCount++,this._WholeViewLostMark.list[t].lost=!0,this._WholeViewLostMark.list[view_idx].callback=null,this._OnWholdViewLostList[t]=null),this._WholeViewLostMark.lostCount==this._OnWholeViewLostList.length&&this.Recycle()}}s.TypeDefines={TYPE_IMPACT:1,TYPE_FROZE_SET:2,TYPE_ON_SCREEN:3,TYPE_DRAG_IMPACT:101},i.ViewSensor=s}{class t{constructor(){this._SensorMaps={},this.IdTokenGenerator=77}HtmlDoWorkOnFrame(){for(let t in this._SensorMaps){let e=this._SensorMaps[t];e.Expired()?delete this._SensorMaps[t]:e.HtmlDoWorkOnFrame()}}HtmlHasActiveSensor(){for(let t in this._SensorMaps)if(this._SensorMaps[t].HtmlNeedWorkOnFrame())return!0;return!1}AddSensor(t){if(t){t.OnManaged(this)&&(this._SensorMaps[t.IdToken]=t),this.RequestSwap()}}AddToSyncList(t){this._SensorMaps.hasOwnProperty(t.IdToken)||console.error("Error: (Add)No in map",this._SensorMaps,t)}RecycleSensor(t){this._SensorMaps.hasOwnProperty(t.IdToken)?(delete this._SensorMaps[t.IdToken],this.RequestSwap()):console.error("Error: (del)No in map",this._SensorMaps,t)}RequestSwap(){i.sRenderBridge.BeginHtmlFrameLoop()}}i.sViewSensorManager=new t}class Rt{constructor(t,e,i){this.element=i,this.row=t,this.column=e}toString(){return`[${this.element[0]},${this.element[1]},${this.element[2]},${this.element[3]},${this.element[4]},${this.element[5]},${this.element[6]},${this.element[7]},${this.element[8]},${this.element[9]},${this.element[10]},${this.element[11]},${this.element[12]},${this.element[13]},${this.element[14]},${this.element[15]}]`}multiply(t){if(this.column!==t.row)throw new Error("matrix multiply error");const e=[];for(let i=0;i<this.row;i++)for(let n=0;n<t.column;n++){e[i+n*t.column]=0;for(let s=0;s<this.column;s++)e[i+n*t.column]+=this.element[i+s*this.column]*t.element[s+n*t.column]}return new Rt(this.row,t.column,e)}static identity(){return new Rt(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static translate(t,e,i){return new Rt(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1])}static scale(t,e,i){return new Rt(4,4,[t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1])}static rotate(t,e,i,n){const s=Math.cos(n/180*Math.PI),r=Math.sin(n/180*Math.PI),a=Math.sqrt(t*t+e*e+i*i);if(1!==a){const n=1/a;t*=n,e*=n,i*=n}const o=1-s,l=t*e,h=e*i,u=i*t,c=t*r,d=e*r,_=i*r,f=[];return f[0]=t*t*o+s,f[1]=l*o+_,f[2]=u*o-d,f[3]=0,f[4]=l*o-_,f[5]=e*e*o+s,f[6]=h*o+c,f[7]=0,f[8]=u*o+d,f[9]=h*o-c,f[10]=i*i*o+s,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,new Rt(4,4,f)}static skew(t,e){const i=new Array(16).fill(0),n=2*Math.PI*(e/360),s=-2*Math.PI*(t/360);return i[0]=1-s*n,i[1]=-Math.tan(n),i[4]=Math.tan(s),i[5]=1,i[10]=1,i[15]=1,new Rt(4,4,i)}static transform2d(t,e,i,n,s,r){return new Rt(4,4,[t,e,0,0,i,n,0,0,0,0,1,0,s,r,0,1])}}const Dt=t=>t>=65&&t<=90||t>=97&&t<=122,Ot=t=>t>=48&&t<=57,kt=(t,e)=>{switch(t){case"translate3d":return Rt.translate(e[0],e[1],e[2]);case"scale3d":return Rt.scale(e[0],e[1],e[2]);case"rotate3d":return Rt.rotate(e[0],e[1],e[2],e[3]);case"skew":return Rt.skew(e[0],e[1]);case"matrix":return Rt.transform2d(e[0],e[1],e[2],e[3],e[4],e[5]);case"matrix3d":return new Rt(4,4,e);default:throw new Error(`no support type ${t}`)}},Ft=t=>{let e=Rt.identity();if(!t)return e;let i="",n="",s=[],r=0;for(let a=0;a<t.length;a++){const o=t.charCodeAt(a);0===r?(Dt(o)||Ot(o))&&(i+=t[a]):(Ot(o)||46===o||45===o||101===o)&&(n+=t[a]),40===o?(r=1,n="",s=[]):41===o?(s.push(parseFloat(n)),e=e.multiply(kt(i,s)),i="",r=0):44===o&&(s.push(parseFloat(n)),n="")}return e},Vt=t=>{if(t.indexOf(" ")>=0){return t.split(" ").map((t=>parseInt(t.substr(0,t.length-2),10)))}return parseInt(t.substr(0,t.length-2),10)},Mt=t=>{let e=t;const i=Vt(e.style.width),n=Vt(e.style.height);let s=Rt.identity();for(;e.parentElement;){const t=getComputedStyle(e),i=t.transform?t.transform:t.webkitTransform;if(i){const n=t.transformOrigin?t.transformOrigin:t.webkitTransformOrigin,r=Ft(i);if(n){const t=Vt(n),i=Rt.translate(-t[0],-t[1],0),a=Rt.translate(t[0],t[1],0);s=Rt.translate(e.offsetLeft,e.offsetTop,0).multiply(a.multiply(r.multiply(i.multiply(s))))}else s=r.multiply(s)}e=e.parentElement}const r=new Rt(4,4,[0,0,0,1,i,0,0,1,0,n,0,1,i,n,0,1]);s=s.multiply(r);const a=s.element;return[a[0],a[1],a[4],a[5],a[8],a[9],a[12],a[13]]};function Gt(t){let e=Mt(t),i=Math.min(e[0],e[2],e[4],e[6]),n=Math.max(e[0],e[2],e[4],e[6]);return[Math.min(e[1],e[3],e[5],e[7]),Math.max(e[1],e[3],e[5],e[7]),i,n]}class Nt{constructor(t,e){this.set(t,e)}add(t,e){return t instanceof Nt?(this.x+=t.x,this.y+=t.y):(this.x+=t||0,this.y+=e||0),this}angle(t){if(void 0!==t)return this.set(this.length(),0).rotate(t);let e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e}angleDeg(t){return void 0!==t?this.angle(t/180*Math.PI):180*this.angle()/Math.PI}clone(){return new Nt(this.x,this.y)}cross(t,e){return t instanceof Nt?this.x*t.y-this.y*t.x:this.x*e-this.y*t}distance(t,e){const i=this.distanceSq(t,e);if(void 0!==i)return Math.sqrt(i)}distanceSq(t,e){let i,n;if(t instanceof Nt)i=t.x-this.x,n=t.y-this.y;else{if(void 0===e)return;i=t-this.x,n=e-this.y}return i*i+n*n}dot(t,e){return t instanceof Nt?this.x*t.x+this.y*t.y:this.x*t+this.y*e}equals(t,e,i){return t instanceof Nt?(e=e||0,Math.abs(this.x-t.x)<=e&&Math.abs(this.y-t.y)<=e):void 0!==e&&(i=i||0,Math.abs(this.x-t)<=i&&Math.abs(this.y-e)<=i)}length(){return Math.sqrt(this.lengthSq())}lengthSq(){return this.x*this.x+this.y*this.y}negate(){return this.scale(-1)}normalize(){return this.scale(1/this.length())}rotate(t){const e=Math.cos(t),i=Math.sin(t);return this.set(this.x*e-this.y*i,this.x*i+this.y*e)}rotateDeg(t){return this.rotate(t/180*Math.PI)}scale(t,e){return this.x*=t,this.y*=e||t,this}set(t,e){return t instanceof Nt?(this.x=t.x,this.y=t.y):(this.x=t||0,this.y=e||0),this}setPolar(t,e){return this.set(e,0).rotate(t)}setPolarDeg(t,e){return this.setPolar(t/180*Math.PI,e)}sub(t,e){return void 0!==e?(this.x-=t,this.y-=e):(this.x-=t.x,this.y-=t.y),this}toString(){return`(${this.x}, ${this.y})`}}function Bt(t,e,i){return i=i||0,Math.abs(t-e)<Math.abs(i)}const Wt={isEqual:Bt,isZero:(t,e)=>Bt(t,0,e),clamp:(t,e,i)=>t>e?t<i?t:i:e},$t=Wt.isZero,Ht=Wt.clamp,Ut=1/3,Xt=new Nt(0,0),Yt=1e-4,zt=30;function Kt(t){return"[object Array]"===Object.prototype.toString.call(t)}function jt(t){if(!Kt(t))throw new Error("Polygon must be an array of points");switch(typeof t[0]){case"number":{if(t.length%2!=0)throw new Error("Polygon that contains array of numbers must has even length ([x0, y0, x1, y1, ...., xn, yn])");const e=[];for(let i=0;i<t.length;i+=2)e.push(new Nt(t[i],t[i+1]));return e}case"object":return t.map(Kt(t[0])?t=>new Nt(t[0],t[1]):t=>new Nt(t.x,t.y));default:throw new Error("Passed polygon is not an array of 2D coordinates")}}function qt(t){if(1===t.length)return new Nt(t[0]);const e=new Nt(0,0);t.forEach((t=>e.add(t))),e.scale(1/t.length);const i=new Nt;let n=0;return t.forEach(((s,r)=>{const a=new Nt(s),o=new Nt(r+1===t.length?t[0]:t[r+1]);a.add(-e.x,-e.y),o.add(-e.x,-e.y);const l=.5*a.cross(o);n+=l,i.add(a.add(o).scale(Ut).scale(l))})),$t(n,Yt)?i.set(t[0]):i.scale(1/n).add(e)}function Jt(t,e){let i=t[0],n=e.dot(t[0]),s=0;for(let r=1;r<t.length;r++)s=e.dot(t[r]),s>n&&(n=s,i=t[r]);return new Nt(i)}function Zt(t,e,i){const n=Jt(t,i),s=Jt(e,i.negate());return new Nt(n.sub(s))}function Qt(t,e){const i=new Nt(0,0),n=new Nt(t).negate(),s=new Nt(e).sub(t),r=s.dot(s);if($t(r,Yt))return i.set(t);let a=n.dot(s)/r;return a=Ht(a,0,1),i.set(s.scale(a).add(t))}function te(t,e){t=jt(t),e=jt(e);const i=qt(t),n=qt(e).add(i.negate());let s,r,a;s=Zt(t,e,n),r=Zt(t,e,n.negate());for(let i=0;i<zt;i++){const i=Qt(s,r);if($t(i.length(),Yt))return 0;n.set(i.negate().normalize()),a=Zt(t,e,n);const o=a.dot(n),l=s.dot(n);if($t(o-l,Yt))return o;s.distanceSq(Xt)<r.distanceSq(Xt)?r=a:s=a}return 0}const ee={intersect:(t,e)=>$t(te(t,e),Yt),distance:te};{class t extends i.ViewSensor{constructor(t,e,n,s){super(i.ViewSensor.TypeDefines.TYPE_IMPACT),this._HtmlConfig={view1:t,view2:e,frozeSetId:s?s.IdToken:0,status:{contacted:!1}},this._Callback=n,this._FrozeViewsSet=s,s&&s.DoRef(),this.ResetAutoRecycleViewsRef([t,e],[]),i.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.view1&&this._HtmlConfig.view2){(t=this._HtmlConfig.view1.Element,e=this._HtmlConfig.view2.Element,ee.intersect(Mt(t),Mt(e)))?this._HtmlConfig.status.contacted||(this._HtmlConfig.status.contacted=!0,this.OnCallback(1)):this._HtmlConfig.status.contacted&&(this.OnCallback(2),this._HtmlConfig.status.contacted=!1)}var t,e}OnCallback(t){this._Callback&&(1==t&&this._Callback.OnBeginContact?this._Callback.OnBeginContact():2==t&&this._Callback.OnEndContact&&this._Callback.OnEndContact())}OnSelfRecycle(){this._FrozeViewsSet&&(this._FrozeViewsSet.UnRef(),this._FrozeViewsSet=null),this._HtmlConfig=null}}i.ImpactSensor=t}{class t{constructor(){}StartTrace(t,e,n,s){return new i.ImpactSensor(t,e,n,s)}}i.sImpactSensorManager=new t}{class t extends i.ViewSensor{constructor(t,e){super(i.ViewSensor.TypeDefines.TYPE_FROZE_SET),this._PreImpactViewList=null,this._OnImpactViewList=null,this._UpdateAutoRecycleRef(t,!0,e,!0),i.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){}HtmlNeedWorkOnFrame(){return!1}UpdatePreImpactList(t){this._UpdateAutoRecycleRef(t,!0,null,!1)}UpdateOnImpactList(t){this._UpdateAutoRecycleRef(null,!1,t,!0)}DoRef(){this.Expired()?console.error("Error: froze set is expired for all bind views lost"):this._RefCount++}UnRef(){this._RefCount>0&&this._RefCount--,0==this._RefCount&&this.Recycle()}OnSelfRecycle(){this._PreImpactViewList=null,this._OnImpactViewList=null}_UpdateAutoRecycleRef(t,e,i,n){e&&(this._PreImpactViewList=t instanceof Array?t:[]),n&&(this._OnImpactViewList=i instanceof Array?i:[]),this.ResetAutoRecycleViewsRef([],[...this._PreImpactViewList,...this._OnImpactViewList])}}i.sImpactSensorManager.AutoFroze=t}i.sImpactSensorManager.Callback=class{constructor(t,e){this.OnBeginContact=t,this.OnEndContact=e}UpdateImpactCallback(t){this.OnBeginContact=t}UpdateLeaveCallback(t){this.OnEndContact=t}};class ie{constructor(t,e){this.Start=t,this.End=e}Merge(t){return this.IsInterAct(t)?(this.Start>t.Start&&(this.Start=t.Start),this.End<t.End&&(this.End=t.End),!0):this.End+1==t.Start?(this.End=t.End,!0):this.Start==t.End+1&&(this.Start=t.Start,!0)}IsInterAct(t){return t.Start<this.Start?!(t.End<this.Start):t.Start<=this.End}IsInclude(t){return this.Start<=t.Start&&this.End>=t.End}Exclude(t){var e={success:!1,newSplitedRange:null};return this.IsInterAct(t)?(t.Start<=this.Start?t.End<this.End?this.Start=t.End+1:this.Clear():(t.End<this.End&&(e.newSplitedRange=new ie(t.End+1,this.End),e.newSplitedRange=e.newSplitedRange),this.End=t.Start-1),e.success=!0,e.success=e.success,e):e}IsEmpty(){return this.Start>this.End}Clear(){this.End=this.Start-1}Clone(){return new ie(this.Start,this.End)}}{const t="OV",e="NV",n="OH",s="NH";class r extends i.ViewSensor{constructor(t,e){super(i.ViewSensor.TypeDefines.TYPE_ON_SCREEN),this._HtmlConfig={view:t,container:null,enable:!1,testRange:null,status:{horizonVisible:!1,verticalVisible:!1}},this._Callback=e,this.ResetAutoRecycleViewsRef([t],[]),i.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.enable&&this._HtmlConfig.testRange&&this._HtmlConfig.view){let r=i.sRenderBridge.GetScreenInfo().designedWidth,a=Math.floor(9*r/16),o={top:0,bottom:0,left:0,right:0},l=Gt(this._HtmlConfig.view.Element);[o.top,o.bottom,o.left,o.right]=l;let h,u,c={top:0,bottom:a,left:0,right:r},d=!0;if(this._HtmlConfig.container){let t=Gt(this._HtmlConfig.container.Element);[c.top,c.bottom,c.left,c.right]=t,h=new ie(c.left,c.right),u=new ie(c.top,c.bottom);let e=new ie(0,r),i=new ie(0,a);d=e.IsInterAct(h)&&i.IsInterAct(u)}else h=new ie(c.left,c.right),u=new ie(c.top,c.bottom);let _,f,g,m,p=new ie(o.left,o.right),w=new ie(o.top,o.bottom),b=this._HtmlConfig.testRange;{let t=Math.floor((o.right-o.left)*b.horizon);_=new ie(o.left,o.left+t),f=new ie(o.right-t,o.right)}{let t=Math.floor((o.bottom-o.top)*b.vertical);g=new ie(o.top,o.top+t),m=new ie(o.bottom-t,o.bottom)}let T=(h.IsInclude(_)||h.IsInclude(f))&&u.IsInterAct(w)&&d,S=(u.IsInclude(g)||u.IsInclude(m))&&h.IsInterAct(p)&&d;if(T!=this._HtmlConfig.status.horizonVisible||S!=this._HtmlConfig.status.verticalVisible){let i={};i[n]=this._HtmlConfig.status.horizonVisible,i[s]=T,i[t]=this._HtmlConfig.status.verticalVisible,i[e]=S,this._HtmlConfig.status.horizonVisible=T,this._HtmlConfig.status.verticalVisible=S,this.OnCallback(i)}}}HtmlNeedWorkOnFrame(){return this._HtmlConfig.enable}HtmlRequestSync(){i.sRenderBridge.BeginHtmlFrameLoop()}ResetArea(t){"number"!=typeof t.horizon&&(console.log("horizon not set, default to 1.0"),t.horizon=1),"number"!=typeof t.vertical&&(console.log("vertical not set, default to 1.0"),t.vertical=1),this._HtmlConfig.testRange=t,this.HtmlRequestSync()}Enable(t){this._HtmlConfig.enable=t,this.HtmlRequestSync()}ResetContainer(t){this._HtmlConfig.container=t,this.HtmlRequestSync()}OnCallback(i){this._Callback&&this._Callback(i[n],i[s],i[t],i[e])}OnSelfRecycle(){this._HtmlConfig=null}}i.VisibleSensor=r}function ne(t){if(!t)throw Error("assert :P")}function se(t,e,i){for(var n=0;4>n;n++)if(t[e+n]!=i.charCodeAt(n))return!0;return!1}function re(t,e,i,n,s){for(var r=0;r<s;r++)t[e+r]=i[n+r]}function ae(t,e,i,n){for(var s=0;s<n;s++)t[e+s]=i}function oe(t){return new Int32Array(t)}function le(t,e){for(var i=[],n=0;n<t;n++)i.push(new e);return i}function he(t,e){var i=[];return function t(i,n,s){for(var r=s[n],a=0;a<r&&(i.push(s.length>n+1?[]:new e),!(s.length<n+1));a++)t(i[a],n+1,s)}(i,0,t),i}function ue(t,e){for(var i="",n=0;n<4;n++)i+=String.fromCharCode(t[e++]);return i}function ce(t,e){return(t[e+0]<<0|t[e+1]<<8|t[e+2]<<16)>>>0}function de(t,e){return(t[e+0]<<0|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}window.WebPDecoder=function(){function t(t,e){for(var i=1<<e-1>>>0;t&i;)i>>>=1;return i?(t&i-1)+i:t}function e(t,e,i,n,s){ne(!(n%i));do{t[e+(n-=i)]=s}while(0<n)}function i(i,s,r,a,o){if(ne(2328>=o),512>=o)var l=oe(512);else if(null==(l=oe(o)))return 0;return function(i,s,r,a,o,l){var h,u,c=s,d=1<<r,_=oe(16),f=oe(16);for(ne(0!=o),ne(null!=a),ne(null!=i),ne(0<r),u=0;u<o;++u){if(15<a[u])return 0;++_[a[u]]}if(_[0]==o)return 0;for(f[1]=0,h=1;15>h;++h){if(_[h]>1<<h)return 0;f[h+1]=f[h]+_[h]}for(u=0;u<o;++u)h=a[u],0<a[u]&&(l[f[h]++]=u);if(1==f[15])return(a=new n).g=0,a.value=l[0],e(i,c,1,d,a),d;var g,m=-1,p=d-1,w=0,b=1,T=1,S=1<<r;for(u=0,h=1,o=2;h<=r;++h,o<<=1){if(b+=T<<=1,0>(T-=_[h]))return 0;for(;0<_[h];--_[h])(a=new n).g=h,a.value=l[u++],e(i,c+w,o,S,a),w=t(w,h)}for(h=r+1,o=2;15>=h;++h,o<<=1){if(b+=T<<=1,0>(T-=_[h]))return 0;for(;0<_[h];--_[h]){if(a=new n,(w&p)!=m){for(c+=S,g=1<<(m=h)-r;15>m&&!(0>=(g-=_[m]));)++m,g<<=1;d+=S=1<<(g=m-r),i[s+(m=w&p)].g=g+r,i[s+m].value=c-s-m}a.g=h-r,a.value=l[u++],e(i,c+(w>>r),o,S,a),w=t(w,h)}}return b!=2*f[15]-1?0:d}(i,s,r,a,o,l)}function n(){this.value=this.g=0}function s(){this.value=this.g=0}function r(){this.G=le(5,n),this.H=oe(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=le(Mi,s)}function a(t,e,i,n){ne(null!=t),ne(null!=e),ne(2147483648>n),t.Ca=254,t.I=0,t.b=-8,t.Ka=0,t.oa=e,t.pa=i,t.Jd=e,t.Yc=i+n,t.Zc=4<=n?i+n-4+1:i,w(t)}function o(t,e){for(var i=0;0<e--;)i|=T(t,128)<<e;return i}function l(t,e){var i=o(t,e);return b(t)?-i:i}function h(t,e,i,n){var s,r=0;for(ne(null!=t),ne(null!=e),ne(4294967288>n),t.Sb=n,t.Ra=0,t.u=0,t.h=0,4<n&&(n=4),s=0;s<n;++s)r+=e[i+s]<<8*s;t.Ra=r,t.bb=n,t.oa=e,t.pa=i}function u(t){for(;8<=t.u&&t.bb<t.Sb;)t.Ra>>>=8,t.Ra+=t.oa[t.pa+t.bb]<<Bi-8>>>0,++t.bb,t.u-=8;g(t)&&(t.h=1,t.u=0)}function c(t,e){if(ne(0<=e),!t.h&&e<=Ni){var i=f(t)&Gi[e];return t.u+=e,u(t),i}return t.h=1,t.u=0}function d(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function _(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function f(t){return t.Ra>>>(t.u&Bi-1)>>>0}function g(t){return ne(t.bb<=t.Sb),t.h||t.bb==t.Sb&&t.u>Bi}function m(t,e){t.u=e,t.h=g(t)}function p(t){t.u>=Wi&&(ne(t.u>=Wi),u(t))}function w(t){ne(null!=t&&null!=t.oa),t.pa<t.Zc?(t.I=(t.oa[t.pa++]|t.I<<8)>>>0,t.b+=8):(ne(null!=t&&null!=t.oa),t.pa<t.Yc?(t.b+=8,t.I=t.oa[t.pa++]|t.I<<8):t.Ka?t.b=0:(t.I<<=8,t.b+=8,t.Ka=1))}function b(t){return o(t,1)}function T(t,e){var i=t.Ca;0>t.b&&w(t);var n=t.b,s=i*e>>>8,r=(t.I>>>n>s)+0;for(r?(i-=s,t.I-=s+1<<n>>>0):i=s+1,n=i,s=0;256<=n;)s+=8,n>>=8;return n=7^s+$i[n],t.b-=n,t.Ca=(i<<n)-1,r}function S(t,e,i){t[e+0]=i>>24&255,t[e+1]=i>>16&255,t[e+2]=i>>8&255,t[e+3]=i>>0&255}function y(t,e){return t[e+0]<<0|t[e+1]<<8}function x(t,e){return y(t,e)|t[e+2]<<16}function E(t,e){return y(t,e)|y(t,e+2)<<16}function v(t,e){var i=1<<e;return ne(null!=t),ne(0<e),t.X=oe(i),null==t.X?0:(t.Mb=32-e,t.Xa=e,1)}function L(t,e){ne(null!=t),ne(null!=e),ne(t.Xa==e.Xa),re(e.X,0,t.X,0,1<<e.Xa)}function I(){this.X=[],this.Xa=this.Mb=0}function A(t,e,i,n){ne(null!=i),ne(null!=n);var s=i[0],r=n[0];return 0==s&&(s=(t*r+e/2)/e),0==r&&(r=(e*s+t/2)/t),0>=s||0>=r?0:(i[0]=s,n[0]=r,1)}function C(t,e){return t+(1<<e)-1>>>e}function P(t,e){return((4278255360&t)+(4278255360&e)>>>0&4278255360)+((16711935&t)+(16711935&e)>>>0&16711935)>>>0}function R(t,e){self[e]=function(e,i,n,s,r,a,o){var l;for(l=0;l<r;++l){var h=self[t](a[o+l-1],n,s+l);a[o+l]=P(e[i+l],h)}}}function D(){this.ud=this.hd=this.jd=0}function O(t,e){return((4278124286&(t^e))>>>1)+(t&e)>>>0}function k(t){return 0<=t&&256>t?t:0>t?0:255<t?255:void 0}function F(t,e){return k(t+(t-e+.5>>1))}function V(t,e,i){return Math.abs(e-i)-Math.abs(t-i)}function M(t,e,i,n,s,r,a){for(n=r[a-1],i=0;i<s;++i)r[a+i]=n=P(t[e+i],n)}function G(t,e,i,n,s){var r;for(r=0;r<i;++r){var a=t[e+r],o=a>>8&255,l=16711935&(l=(l=16711935&a)+((o<<16)+o));n[s+r]=(4278255360&a)+l>>>0}}function N(t,e){e.jd=t>>0&255,e.hd=t>>8&255,e.ud=t>>16&255}function B(t,e,i,n,s,r){var a;for(a=0;a<n;++a){var o=e[i+a],l=o>>>8,h=o,u=255&(u=(u=o>>>16)+((t.jd<<24>>24)*(l<<24>>24)>>>5));h=255&(h=(h=h+((t.hd<<24>>24)*(l<<24>>24)>>>5))+((t.ud<<24>>24)*(u<<24>>24)>>>5));s[r+a]=(4278255360&o)+(u<<16)+h}}function W(t,e,i,n,s){self[e]=function(t,e,i,r,a,o,l,h,u){for(r=l;r<h;++r)for(l=0;l<u;++l)a[o++]=s(i[n(t[e++])])},self[t]=function(t,e,r,a,o,l,h){var u=8>>t.b,c=t.Ea,d=t.K[0],_=t.w;if(8>u)for(t=(1<<t.b)-1,_=(1<<u)-1;e<r;++e){var f,g=0;for(f=0;f<c;++f)f&t||(g=n(a[o++])),l[h++]=s(d[g&_]),g>>=u}else self["VP8LMapColor"+i](a,o,d,_,l,h,e,r,c)}}function $(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>16&255,n[s++]=r>>8&255,n[s++]=r>>0&255}}function H(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>16&255,n[s++]=r>>8&255,n[s++]=r>>0&255,n[s++]=r>>24&255}}function U(t,e,i,n,s){for(i=e+i;e<i;){var r=(a=t[e++])>>16&240|a>>12&15,a=a>>0&240|a>>28&15;n[s++]=r,n[s++]=a}}function X(t,e,i,n,s){for(i=e+i;e<i;){var r=(a=t[e++])>>16&248|a>>13&7,a=a>>5&224|a>>3&31;n[s++]=r,n[s++]=a}}function Y(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>0&255,n[s++]=r>>8&255,n[s++]=r>>16&255}}function z(t,e,i,n,s,r){if(0==r)for(i=e+i;e<i;)S(n,((r=t[e++])[0]>>24|r[1]>>8&65280|r[2]<<8&16711680|r[3]<<24)>>>0),s+=32;else re(n,s,t,e,i)}function K(t,e){self[e][0]=self[t+"0"],self[e][1]=self[t+"1"],self[e][2]=self[t+"2"],self[e][3]=self[t+"3"],self[e][4]=self[t+"4"],self[e][5]=self[t+"5"],self[e][6]=self[t+"6"],self[e][7]=self[t+"7"],self[e][8]=self[t+"8"],self[e][9]=self[t+"9"],self[e][10]=self[t+"10"],self[e][11]=self[t+"11"],self[e][12]=self[t+"12"],self[e][13]=self[t+"13"],self[e][14]=self[t+"0"],self[e][15]=self[t+"0"]}function j(t){return t==$n||t==Hn||t==Un||t==Xn}function q(){this.eb=[],this.size=this.A=this.fb=0}function J(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function Z(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new q,this.f.kb=new J,this.sd=null}function Q(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function tt(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function et(t){return alert("todo:WebPSamplerProcessPlane"),t.T}function it(t,e){var i=t.T,n=e.ba.f.RGBA,s=n.eb,r=n.fb+t.ka*n.A,a=ms[e.ba.S],o=t.y,l=t.O,h=t.f,u=t.N,c=t.ea,d=t.W,_=e.cc,f=e.dc,g=e.Mc,m=e.Nc,p=t.ka,w=t.ka+t.T,b=t.U,T=b+1>>1;for(0==p?a(o,l,null,null,h,u,c,d,h,u,c,d,s,r,null,null,b):(a(e.ec,e.fc,o,l,_,f,g,m,h,u,c,d,s,r-n.A,s,r,b),++i);p+2<w;p+=2)_=h,f=u,g=c,m=d,u+=t.Rc,d+=t.Rc,r+=2*n.A,a(o,(l+=2*t.fa)-t.fa,o,l,_,f,g,m,h,u,c,d,s,r-n.A,s,r,b);return l+=t.fa,t.j+w<t.o?(re(e.ec,e.fc,o,l,b),re(e.cc,e.dc,h,u,T),re(e.Mc,e.Nc,c,d,T),i--):1&w||a(o,l,null,null,h,u,c,d,h,u,c,d,s,r+n.A,null,null,b),i}function nt(t,e,i){var n=t.F,s=[t.J];if(null!=n){var r=t.U,a=e.ba.S,o=a==Nn||a==Un;e=e.ba.f.RGBA;var l=[0],h=t.ka;l[0]=t.T,t.Kb&&(0==h?--l[0]:(--h,s[0]-=t.width),t.j+t.ka+t.T==t.o&&(l[0]=t.o-t.j-h));var u=e.eb;h=e.fb+h*e.A;t=En(n,s[0],t.width,r,l,u,h+(o?0:3),e.A),ne(i==l),t&&j(a)&&yn(u,h,o,r,l,e.A)}return 0}function st(t){var e=t.ma,i=e.ba.S,n=11>i,s=i==Vn||i==Gn||i==Nn||i==Bn||12==i||j(i);if(e.memory=null,e.Ib=null,e.Jb=null,e.Nd=null,!ki(e.Oa,t,s?11:12))return 0;if(s&&j(i)&&pi(),t.da)alert("todo:use_scaling");else{if(n){if(e.Ib=et,t.Kb){if(i=t.U+1>>1,e.memory=oe(t.U+2*i),null==e.memory)return 0;e.ec=e.memory,e.fc=0,e.cc=e.ec,e.dc=e.fc+t.U,e.Mc=e.cc,e.Nc=e.dc+i,e.Ib=it,pi()}}else alert("todo:EmitYUV");s&&(e.Jb=nt,n&&gi())}if(n&&!Ps){for(t=0;256>t;++t)Rs[t]=89858*(t-128)+vs>>Es,ks[t]=-22014*(t-128)+vs,Os[t]=-45773*(t-128),Ds[t]=113618*(t-128)+vs>>Es;for(t=Ls;t<Is;++t)e=76283*(t-16)+vs>>Es,Fs[t-Ls]=Mt(e,255),Vs[t-Ls]=Mt(e+8>>4,15);Ps=1}return 1}function rt(t){var e=t.ma,i=t.U,n=t.T;return ne(!(1&t.ka)),0>=i||0>=n?0:(i=e.Ib(t,e),null!=e.Jb&&e.Jb(t,e,i),e.Dc+=i,1)}function at(t){t.ma.memory=null}function ot(t,e,i,n){return 47!=c(t,8)?0:(e[0]=c(t,14)+1,i[0]=c(t,14)+1,n[0]=c(t,1),0!=c(t,3)?0:!t.h)}function lt(t,e){if(4>t)return t+1;var i=t-2>>1;return(2+(1&t)<<i)+c(e,i)+1}function ht(t,e){return 120<e?e-120:1<=(i=((i=Jn[e-1])>>4)*t+(8-(15&i)))?i:1;var i}function ut(t,e,i){var n=f(i),s=t[e+=255&n].g-8;return 0<s&&(m(i,i.u+8),n=f(i),e+=t[e].value,e+=n&(1<<s)-1),m(i,i.u+t[e].g),t[e].value}function ct(t,e,i){return i.g+=t.g,i.value+=t.value<<e>>>0,ne(8>=i.g),t.g}function dt(t,e,i){var n=t.xc;return ne((e=0==n?0:t.vc[t.md*(i>>n)+(e>>n)])<t.Wb),t.Ya[e]}function _t(t,e,i,n){var s=t.ab,r=t.c*e,a=t.C;e=a+e;var o=i,l=n;for(n=t.Ta,i=t.Ua;0<s--;){var h=t.gc[s],u=a,c=e,d=o,_=l,f=(l=n,o=i,h.Ea);switch(ne(u<c),ne(c<=h.nc),h.hc){case 2:Xi(d,_,(c-u)*f,l,o);break;case 0:var g=u,m=c,p=l,w=o,b=(E=h).Ea;0==g&&(Hi(d,_,null,null,1,p,w),M(d,_+1,0,0,b-1,p,w+1),_+=b,w+=b,++g);for(var T=1<<E.b,S=T-1,y=C(b,E.b),x=E.K,E=E.w+(g>>E.b)*y;g<m;){var v=x,L=E,I=1;for(Ui(d,_,p,w-b,1,p,w);I<b;){var A=(I&~S)+T;A>b&&(A=b),(0,qi[v[L++]>>8&15])(d,_+ +I,p,w+I-b,A-I,p,w+I),I=A}_+=b,w+=b,++g&S||(E+=y)}c!=h.nc&&re(l,o-f,l,o+(c-u-1)*f,f);break;case 1:for(f=d,m=_,b=(d=h.Ea)-(w=d&~(p=(_=1<<h.b)-1)),g=C(d,h.b),T=h.K,h=h.w+(u>>h.b)*g;u<c;){for(S=T,y=h,x=new D,E=m+w,v=m+d;m<E;)N(S[y++],x),Ji(x,f,m,_,l,o),m+=_,o+=_;m<v&&(N(S[y++],x),Ji(x,f,m,b,l,o),m+=b,o+=b),++u&p||(h+=g)}break;case 3:if(d==l&&_==o&&0<h.b){for(m=l,d=f=o+(c-u)*f-(w=(c-u)*C(h.Ea,h.b)),_=l,p=o,g=[],w=(b=w)-1;0<=w;--w)g[w]=_[p+w];for(w=b-1;0<=w;--w)m[d+w]=g[w];Yi(h,u,c,l,f,l,o)}else Yi(h,u,c,d,_,l,o)}o=n,l=i}l!=i&&re(n,i,o,l,r)}function ft(t,e){var i=t.V,n=t.Ba+t.c*t.C,s=e-t.C;if(ne(e<=t.l.o),ne(16>=s),0<s){var r=t.l,a=t.Ta,o=t.Ua,l=r.width;if(_t(t,s,i,n),s=o=[o],ne((i=t.C)<(n=e)),ne(r.v<r.va),n>r.o&&(n=r.o),i<r.j){var h=r.j-i;i=r.j;s[0]+=h*l}if(i>=n?i=0:(s[0]+=4*r.v,r.ka=i-r.j,r.U=r.va-r.v,r.T=n-i,i=1),i){if(o=o[0],11>(i=t.ca).S){var u=i.f.RGBA,c=(n=i.S,s=r.U,r=r.T,h=u.eb,u.A),d=r;for(u=u.fb+t.Ma*u.A;0<d--;){var _=a,f=o,g=s,m=h,p=u;switch(n){case Fn:Zi(_,f,g,m,p);break;case Vn:Qi(_,f,g,m,p);break;case $n:Qi(_,f,g,m,p),yn(m,p,0,g,1,0);break;case Mn:nn(_,f,g,m,p);break;case Gn:z(_,f,g,m,p,1);break;case Hn:z(_,f,g,m,p,1),yn(m,p,0,g,1,0);break;case Nn:z(_,f,g,m,p,0);break;case Un:z(_,f,g,m,p,0),yn(m,p,1,g,1,0);break;case Bn:tn(_,f,g,m,p);break;case Xn:tn(_,f,g,m,p),xn(m,p,g,1,0);break;case Wn:en(_,f,g,m,p);break;default:ne(0)}o+=l,u+=c}t.Ma+=r}else alert("todo:EmitRescaledRowsYUVA");ne(t.Ma<=i.height)}}t.C=e,ne(t.C<=t.i)}function gt(t){var e;if(0<t.ua)return 0;for(e=0;e<t.Wb;++e){var i=t.Ya[e].G,n=t.Ya[e].H;if(0<i[1][n[1]+0].g||0<i[2][n[2]+0].g||0<i[3][n[3]+0].g)return 0}return 1}function mt(t,e,i,n,s,r){if(0!=t.Z){var a=t.qd,o=t.rd;for(ne(null!=gs[t.Z]);e<i;++e)gs[t.Z](a,o,n,s,n,s,r),a=n,o=s,s+=r;t.qd=a,t.rd=o}}function pt(t,e){var i=t.l.ma,n=0==i.Z||1==i.Z?t.l.j:t.C;n=t.C<n?n:t.C;if(ne(e<=t.l.o),e>n){var s=t.l.width,r=i.ca,a=i.tb+s*n,o=t.V,l=t.Ba+t.c*n,h=t.gc;ne(1==t.ab),ne(3==h[0].hc),Ki(h[0],n,e,o,l,r,a),mt(i,n,e,r,a,s)}t.C=t.Ma=e}function wt(t,e,i,n,s,r,a){var o=t.$/n,l=t.$%n,h=t.m,u=t.s,c=i+t.$,d=c;s=i+n*s;var _=i+n*r,w=280+u.ua,b=t.Pb?o:16777216,T=0<u.ua?u.Wa:null,S=u.wc,y=c<_?dt(u,l,o):null;ne(t.C<r),ne(_<=s);var x=!1;t:for(;;){for(;x||c<_;){var E=0;if(o>=b){var v=c-i;ne((b=t).Pb),b.wd=b.m,b.xd=v,0<b.s.ua&&L(b.s.Wa,b.s.vb),b=o+Qn}if(l&S||(y=dt(u,l,o)),ne(null!=y),y.Qb&&(e[c]=y.qb,x=!0),!x)if(p(h),y.jc){E=h,v=e;var I=c,A=y.pd[f(E)&Mi-1];ne(y.jc),256>A.g?(m(E,E.u+A.g),v[I]=A.value,E=0):(m(E,E.u+A.g-256),ne(256<=A.value),E=A.value),0==E&&(x=!0)}else E=ut(y.G[0],y.H[0],h);if(h.h)break;if(x||256>E){if(!x)if(y.nd)e[c]=(y.qb|E<<8)>>>0;else{if(p(h),x=ut(y.G[1],y.H[1],h),p(h),v=ut(y.G[2],y.H[2],h),I=ut(y.G[3],y.H[3],h),h.h)break;e[c]=(I<<24|x<<16|E<<8|v)>>>0}if(x=!1,++c,++l>=n&&(l=0,++o,null!=a&&o<=r&&!(o%16)&&a(t,o),null!=T))for(;d<c;)E=e[d++],T.X[(506832829*E&4294967295)>>>T.Mb]=E}else if(280>E){if(E=lt(E-256,h),v=ut(y.G[4],y.H[4],h),p(h),v=ht(n,v=lt(v,h)),h.h)break;if(c-i<v||s-c<E)break t;for(I=0;I<E;++I)e[c+I]=e[c+I-v];for(c+=E,l+=E;l>=n;)l-=n,++o,null!=a&&o<=r&&!(o%16)&&a(t,o);if(ne(c<=s),l&S&&(y=dt(u,l,o)),null!=T)for(;d<c;)E=e[d++],T.X[(506832829*E&4294967295)>>>T.Mb]=E}else{if(!(E<w))break t;for(x=E-280,ne(null!=T);d<c;)E=e[d++],T.X[(506832829*E&4294967295)>>>T.Mb]=E;E=c,ne(!(x>>>(v=T).Xa)),e[E]=v.X[x],x=!0}x||ne(h.h==g(h))}if(t.Pb&&h.h&&c<s)ne(t.m.h),t.a=5,t.m=t.wd,t.$=t.xd,0<t.s.ua&&L(t.s.vb,t.s.Wa);else{if(h.h)break t;null!=a&&a(t,o>r?r:o),t.a=0,t.$=c-i}return 1}return t.a=3,0}function bt(t){ne(null!=t),t.vc=null,t.yc=null,t.Ya=null;var e=t.Wa;null!=e&&(e.X=null),t.vb=null,ne(null!=t)}function Tt(){var t=new ri;return null==t?null:(t.a=0,t.xb=fs,K("Predictor","VP8LPredictors"),K("Predictor","VP8LPredictors_C"),K("PredictorAdd","VP8LPredictorsAdd"),K("PredictorAdd","VP8LPredictorsAdd_C"),Xi=G,Ji=B,Zi=$,Qi=H,tn=U,en=X,nn=Y,self.VP8LMapColor32b=zi,self.VP8LMapColor8b=ji,t)}function St(t,e,s,a,o){var l=1,h=[t],u=[e],d=a.m,_=a.s,g=null,w=0;t:for(;;){if(s)for(;l&&c(d,1);){var b=h,T=u,S=a,y=1,x=S.m,E=S.gc[S.ab],L=c(x,2);if(S.Oc&1<<L)l=0;else{switch(S.Oc|=1<<L,E.hc=L,E.Ea=b[0],E.nc=T[0],E.K=[null],++S.ab,ne(4>=S.ab),L){case 0:case 1:E.b=c(x,3)+2,y=St(C(E.Ea,E.b),C(E.nc,E.b),0,S,E.K),E.K=E.K[0];break;case 3:var I,A=c(x,8)+1,R=16<A?0:4<A?1:2<A?2:3;if(b[0]=C(E.Ea,R),E.b=R,I=y=St(A,1,0,S,E.K)){var D,O=A,k=E,F=1<<(8>>k.b),V=oe(F);if(null==V)I=0;else{var M=k.K[0],G=k.w;for(V[0]=k.K[0][0],D=1;D<1*O;++D)V[D]=P(M[G+D],V[D-1]);for(;D<4*F;++D)V[D]=0;k.K[0]=null,k.K[0]=V,I=1}}y=I;break;case 2:break;default:ne(0)}l=y}}if(h=h[0],u=u[0],l&&c(d,1)&&!(l=1<=(w=c(d,4))&&11>=w)){a.a=3;break t}var N;if(N=l)e:{var B,W,$,H=a,U=h,X=u,Y=w,z=s,K=H.m,j=H.s,q=[null],J=1,Z=0,Q=Zn[Y];i:for(;;){if(z&&c(K,1)){var tt=c(K,3)+2,et=C(U,tt),it=C(X,tt),nt=et*it;if(!St(et,it,0,H,q))break i;for(q=q[0],j.xc=tt,B=0;B<nt;++B){var st=q[B]>>8&65535;q[B]=st,st>=J&&(J=st+1)}}if(K.h)break i;for(W=0;5>W;++W){var rt=Kn[W];!W&&0<Y&&(rt+=1<<Y),Z<rt&&(Z=rt)}var at=le(J*Q,n),ot=J,lt=le(ot,r);if(null==lt)var ht=null;else ne(65536>=ot),ht=lt;var ut=oe(Z);if(null==ht||null==ut||null==at){H.a=1;break i}var dt=at;for(B=$=0;B<J;++B){var _t=ht[B],ft=_t.G,gt=_t.H,mt=0,pt=1,Tt=0;for(W=0;5>W;++W){rt=Kn[W],ft[W]=dt,gt[W]=$,!W&&0<Y&&(rt+=1<<Y);n:{var yt,xt=rt,Et=H,vt=ut,Lt=dt,It=$,At=0,Ct=Et.m,Pt=c(Ct,1);if(ae(vt,0,0,xt),Pt){var Rt=c(Ct,1)+1,Dt=c(Ct,1),Ot=c(Ct,0==Dt?1:8);vt[Ot]=1,2==Rt&&(vt[Ot=c(Ct,8)]=1);var kt=1}else{var Ft=oe(19),Vt=c(Ct,4)+4;if(19<Vt){Et.a=3;var Mt=0;break n}for(yt=0;yt<Vt;++yt)Ft[qn[yt]]=c(Ct,3);var Gt=void 0,Nt=void 0,Bt=Et,Wt=Ft,$t=xt,Ht=vt,Ut=0,Xt=Bt.m,Yt=8,zt=le(128,n);s:for(;i(zt,0,7,Wt,19);){if(c(Xt,1)){var Kt=2+2*c(Xt,3);if((Gt=2+c(Xt,Kt))>$t)break s}else Gt=$t;for(Nt=0;Nt<$t&&Gt--;){p(Xt);var jt=zt[0+(127&f(Xt))];m(Xt,Xt.u+jt.g);var qt=jt.value;if(16>qt)Ht[Nt++]=qt,0!=qt&&(Yt=qt);else{var Jt=16==qt,Zt=qt-16,Qt=zn[Zt],te=c(Xt,Yn[Zt])+Qt;if(Nt+te>$t)break s;for(var ee=Jt?Yt:0;0<te--;)Ht[Nt++]=ee}}Ut=1;break s}Ut||(Bt.a=3),kt=Ut}(kt=kt&&!Ct.h)&&(At=i(Lt,It,8,vt,xt)),kt&&0!=At?Mt=At:(Et.a=3,Mt=0)}if(0==Mt)break i;if(pt&&1==jn[W]&&(pt=0==dt[$].g),mt+=dt[$].g,$+=Mt,3>=W){var ie,se=ut[0];for(ie=1;ie<rt;++ie)ut[ie]>se&&(se=ut[ie]);Tt+=se}}if(_t.nd=pt,_t.Qb=0,pt&&(_t.qb=(ft[3][gt[3]+0].value<<24|ft[1][gt[1]+0].value<<16|ft[2][gt[2]+0].value)>>>0,0==mt&&256>ft[0][gt[0]+0].value&&(_t.Qb=1,_t.qb+=ft[0][gt[0]+0].value<<8)),_t.jc=!_t.Qb&&6>Tt,_t.jc){var re,he=_t;for(re=0;re<Mi;++re){var ue=re,ce=he.pd[ue],de=he.G[0][he.H[0]+ue];256<=de.value?(ce.g=de.g+256,ce.value=de.value):(ce.g=0,ce.value=0,ue>>=ct(de,8,ce),ue>>=ct(he.G[1][he.H[1]+ue],16,ce),ue>>=ct(he.G[2][he.H[2]+ue],0,ce),ct(he.G[3][he.H[3]+ue],24,ce))}}}j.vc=q,j.Wb=J,j.Ya=ht,j.yc=at,N=1;break e}N=0}if(!(l=N)){a.a=3;break t}if(0<w){if(_.ua=1<<w,!v(_.Wa,w)){a.a=1,l=0;break t}}else _.ua=0;var _e=a,fe=h,ge=u,me=_e.s,pe=me.xc;if(_e.c=fe,_e.i=ge,me.md=C(fe,pe),me.wc=0==pe?-1:(1<<pe)-1,s){a.xb=_s;break t}if(null==(g=oe(h*u))){a.a=1,l=0;break t}l=(l=wt(a,g,0,h,u,u,null))&&!d.h;break t}return l?(null!=o?o[0]=g:(ne(null==g),ne(s)),a.$=0,s||bt(_)):bt(_),l}function yt(t,e){var i=t.c*t.i,n=i+e+16*e;return ne(t.c<=e),t.V=oe(n),null==t.V?(t.Ta=null,t.Ua=0,t.a=1,0):(t.Ta=t.V,t.Ua=t.Ba+i+e,1)}function xt(t,e){var i=t.C,n=e-i,s=t.V,r=t.Ba+t.c*i;for(ne(e<=t.l.o);0<n;){var a=16<n?16:n,o=t.l.ma,l=t.l.width,h=l*a,u=o.ca,c=o.tb+l*i,d=t.Ta,_=t.Ua;_t(t,a,s,r),vn(d,_,u,c,h),mt(o,i,i+a,u,c,l),n-=a,s+=a*t.c,i+=a}ne(i==e),t.C=t.Ma=e}function Et(){this.ub=this.yd=this.td=this.Rb=0}function vt(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Lt(){this.Fb=this.Bb=this.Cb=0,this.Zb=oe(4),this.Lb=oe(4)}function It(){this.Yb=function(){var t=[];return function t(e,i,n){for(var s=n[i],r=0;r<s&&(e.push(n.length>i+1?[]:0),!(n.length<i+1));r++)t(e[r],i+1,n)}(t,0,[3,11]),t}()}function At(){this.jb=oe(3),this.Wc=he([4,8],It),this.Xc=he([4,17],It)}function Ct(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new oe(4),this.od=new oe(4)}function Pt(){this.ld=this.La=this.dd=this.tc=0}function Rt(){this.Na=this.la=0}function Dt(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Ot(){this.ad=oe(384),this.Za=0,this.Ob=oe(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function kt(){this.uc=this.M=this.Nb=0,this.wa=Array(new Pt),this.Y=0,this.ya=Array(new Ot),this.aa=0,this.l=new Gt}function Ft(){this.y=oe(16),this.f=oe(8),this.ea=oe(8)}function Vt(){this.cb=this.a=0,this.sc="",this.m=new d,this.Od=new Et,this.Kc=new vt,this.ed=new Ct,this.Qa=new Lt,this.Ic=this.$c=this.Aa=0,this.D=new kt,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=le(8,d),this.ia=0,this.pb=le(4,Dt),this.Pa=new At,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Ft),this.Hd=0,this.rb=Array(new Rt),this.sb=0,this.wa=Array(new Pt),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new Ot),this.L=this.aa=0,this.gd=he([4,2],Pt),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function Mt(t,e){return 0>t?0:t>e?e:t}function Gt(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function Nt(){var t=new Vt;return null!=t&&(t.a=0,t.sc="OK",t.cb=0,t.Xb=0,is||(is=Ht)),t}function Bt(t,e,i){return 0==t.a&&(t.a=e,t.sc=i,t.cb=0),0}function Wt(t,e,i){return 3<=i&&157==t[e+0]&&1==t[e+1]&&42==t[e+2]}function $t(t,e){if(null==t)return 0;if(t.a=0,t.sc="OK",null==e)return Bt(t,2,"null VP8Io passed to VP8GetHeaders()");var i=e.data,n=e.w,s=e.ha;if(4>s)return Bt(t,7,"Truncated header.");var r=i[n+0]|i[n+1]<<8|i[n+2]<<16,h=t.Od;if(h.Rb=!(1&r),h.td=r>>1&7,h.yd=r>>4&1,h.ub=r>>5,3<h.td)return Bt(t,3,"Incorrect keyframe parameters.");if(!h.yd)return Bt(t,4,"Frame not displayable.");n+=3,s-=3;var u=t.Kc;if(h.Rb){if(7>s)return Bt(t,7,"cannot parse picture header");if(!Wt(i,n,s))return Bt(t,3,"Bad code word");u.c=16383&(i[n+4]<<8|i[n+3]),u.Td=i[n+4]>>6,u.i=16383&(i[n+6]<<8|i[n+5]),u.Ud=i[n+6]>>6,n+=7,s-=7,t.za=u.c+15>>4,t.Ub=u.i+15>>4,e.width=u.c,e.height=u.i,e.Da=0,e.j=0,e.v=0,e.va=e.width,e.o=e.height,e.da=0,e.ib=e.width,e.hb=e.height,e.U=e.width,e.T=e.height,ae((r=t.Pa).jb,0,255,r.jb.length),ne(null!=(r=t.Qa)),r.Cb=0,r.Bb=0,r.Fb=1,ae(r.Zb,0,0,r.Zb.length),ae(r.Lb,0,0,r.Lb)}if(h.ub>s)return Bt(t,7,"bad partition length");a(r=t.m,i,n,h.ub),n+=h.ub,s-=h.ub,h.Rb&&(u.Ld=b(r),u.Kd=b(r)),u=t.Qa;var c,d=t.Pa;if(ne(null!=r),ne(null!=u),u.Cb=b(r),u.Cb){if(u.Bb=b(r),b(r)){for(u.Fb=b(r),c=0;4>c;++c)u.Zb[c]=b(r)?l(r,7):0;for(c=0;4>c;++c)u.Lb[c]=b(r)?l(r,6):0}if(u.Bb)for(c=0;3>c;++c)d.jb[c]=b(r)?o(r,8):255}else u.Bb=0;if(r.Ka)return Bt(t,3,"cannot parse segment header");if((u=t.ed).zd=b(r),u.Tb=o(r,6),u.wb=o(r,3),u.Pc=b(r),u.Pc&&b(r)){for(d=0;4>d;++d)b(r)&&(u.vd[d]=l(r,6));for(d=0;4>d;++d)b(r)&&(u.od[d]=l(r,6))}if(t.L=0==u.Tb?0:u.zd?1:2,r.Ka)return Bt(t,3,"cannot parse filter header");var _=s;if(s=c=n,n=c+_,u=_,t.Xb=(1<<o(t.m,2))-1,_<3*(d=t.Xb))i=7;else{for(c+=3*d,u-=3*d,_=0;_<d;++_){var f=i[s+0]|i[s+1]<<8|i[s+2]<<16;f>u&&(f=u),a(t.Jc[+_],i,c,f),c+=f,u-=f,s+=3}a(t.Jc[+d],i,c,u),i=c<n?0:5}if(0!=i)return Bt(t,i,"cannot parse partitions");for(i=o(c=t.m,7),s=b(c)?l(c,4):0,n=b(c)?l(c,4):0,u=b(c)?l(c,4):0,d=b(c)?l(c,4):0,c=b(c)?l(c,4):0,_=t.Qa,f=0;4>f;++f){if(_.Cb){var g=_.Zb[f];_.Fb||(g+=i)}else{if(0<f){t.pb[f]=t.pb[0];continue}g=i}var m=t.pb[f];m.Sc[0]=ts[Mt(g+s,127)],m.Sc[1]=es[Mt(g+0,127)],m.Eb[0]=2*ts[Mt(g+n,127)],m.Eb[1]=101581*es[Mt(g+u,127)]>>16,8>m.Eb[1]&&(m.Eb[1]=8),m.Qc[0]=ts[Mt(g+d,117)],m.Qc[1]=es[Mt(g+c,127)],m.lc=g+c}if(!h.Rb)return Bt(t,4,"Not a key frame.");for(b(r),h=t.Pa,i=0;4>i;++i){for(s=0;8>s;++s)for(n=0;3>n;++n)for(u=0;11>u;++u)d=T(r,ls[i][s][n][u])?o(r,8):as[i][s][n][u],h.Wc[i][s].Yb[n][u]=d;for(s=0;17>s;++s)h.Xc[i][s]=h.Wc[i][hs[s]]}return t.kc=b(r),t.kc&&(t.Bd=o(r,8)),t.cb=1}function Ht(t,e,i,n,s,r,a){var o=e[s].Yb[i];for(i=0;16>s;++s){if(!T(t,o[i+0]))return s;for(;!T(t,o[i+1]);)if(o=e[++s].Yb[0],i=0,16==s)return 16;var l=e[s+1].Yb;if(T(t,o[i+2])){var h=t,u=0;if(T(h,(d=o)[(c=i)+3]))if(T(h,d[c+6])){for(o=0,c=2*(u=T(h,d[c+8]))+(d=T(h,d[c+9+u])),u=0,d=ns[c];d[o];++o)u+=u+T(h,d[o]);u+=3+(8<<c)}else T(h,d[c+7])?(u=7+2*T(h,165),u+=T(h,145)):u=5+T(h,159);else u=T(h,d[c+4])?3+T(h,d[c+5]):2;o=l[2]}else u=1,o=l[1];l=a+ss[s],0>(h=t).b&&w(h);var c,d=h.b,_=(c=h.Ca>>1)-(h.I>>d)>>31;--h.b,h.Ca+=_,h.Ca|=1,h.I-=(c+1&_)<<d,r[l]=((u^_)-_)*n[(0<s)+0]}return 16}function Ut(t){var e=t.rb[t.sb-1];e.la=0,e.Na=0,ae(t.zc,0,0,t.zc.length),t.ja=0}function Xt(t,e){if(null==t)return 0;if(null==e)return Bt(t,2,"NULL VP8Io parameter in VP8Decode().");if(!t.cb&&!$t(t,e))return 0;if(ne(t.cb),null==e.ac||e.ac(e)){e.ob&&(t.L=0);var i=Gs[t.L];if(2==t.L?(t.yb=0,t.zb=0):(t.yb=e.v-i>>4,t.zb=e.j-i>>4,0>t.yb&&(t.yb=0),0>t.zb&&(t.zb=0)),t.Va=e.o+15+i>>4,t.Hb=e.va+15+i>>4,t.Hb>t.za&&(t.Hb=t.za),t.Va>t.Ub&&(t.Va=t.Ub),0<t.L){var n=t.ed;for(i=0;4>i;++i){var s;if(t.Qa.Cb){var r=t.Qa.Lb[i];t.Qa.Fb||(r+=n.Tb)}else r=n.Tb;for(s=0;1>=s;++s){var a=t.gd[i][s],o=r;if(n.Pc&&(o+=n.vd[0],s&&(o+=n.od[0])),0<(o=0>o?0:63<o?63:o)){var l=o;0<n.wb&&((l=4<n.wb?l>>2:l>>1)>9-n.wb&&(l=9-n.wb)),1>l&&(l=1),a.dd=l,a.tc=2*o+l,a.ld=40<=o?2:15<=o?1:0}else a.tc=0;a.La=s}}}i=0}else Bt(t,6,"Frame setup failed"),i=t.a;if(i=0==i){if(i){t.$c=0,0<t.Aa||(t.Ic=Bs);t:{i=t.Ic;n=4*(l=t.za);var h=32*l,u=l+1,c=0<t.L?l*(0<t.Aa?2:1):0,d=(2==t.Aa?2:1)*l;if((a=n+832+(s=3*(16*i+Gs[t.L])/2*h)+(r=null!=t.Fa&&0<t.Fa.length?t.Kc.c*t.Kc.i:0))!=a)i=0;else{if(a>t.Vb){if(t.Vb=0,t.Ec=oe(a),t.Fc=0,null==t.Ec){i=Bt(t,1,"no memory during frame initialization.");break t}t.Vb=a}a=t.Ec,o=t.Fc,t.Ac=a,t.Bc=o,o+=n,t.Gd=le(h,Ft),t.Hd=0,t.rb=le(u+1,Rt),t.sb=1,t.wa=c?le(c,Pt):null,t.Y=0,t.D.Nb=0,t.D.wa=t.wa,t.D.Y=t.Y,0<t.Aa&&(t.D.Y+=l),ne(!0),t.oc=a,t.pc=o,o+=832,t.ya=le(d,Ot),t.aa=0,t.D.ya=t.ya,t.D.aa=t.aa,2==t.Aa&&(t.D.aa+=l),t.R=16*l,t.B=8*l,l=(h=Gs[t.L])*t.R,h=h/2*t.B,t.sa=a,t.ta=o+l,t.qa=t.sa,t.ra=t.ta+16*i*t.R+h,t.Ha=t.qa,t.Ia=t.ra+8*i*t.B+h,t.$c=0,o+=s,t.mb=r?a:null,t.nb=r?o:null,ne(o+r<=t.Fc+t.Vb),Ut(t),ae(t.Ac,t.Bc,0,n),i=1}}if(i){if(e.ka=0,e.y=t.sa,e.O=t.ta,e.f=t.qa,e.N=t.ra,e.ea=t.Ha,e.Vd=t.Ia,e.fa=t.R,e.Rc=t.B,e.F=null,e.J=0,!Pn){for(i=-255;255>=i;++i)Ln[255+i]=0>i?-i:i;for(i=-1020;1020>=i;++i)In[1020+i]=-128>i?-128:127<i?127:i;for(i=-112;112>=i;++i)An[112+i]=-16>i?-16:15<i?15:i;for(i=-255;510>=i;++i)Cn[255+i]=0>i?0:255<i?255:i;Pn=1}sn=ee,rn=Jt,on=Zt,ln=Qt,hn=te,an=qt,un=ze,cn=Ke,dn=Je,_n=Ze,fn=je,gn=qe,mn=Qe,pn=ti,wn=We,bn=$e,Tn=He,Sn=Ue,cs[0]=xe,cs[1]=ue,cs[2]=Se,cs[3]=ye,cs[4]=Ee,cs[5]=Le,cs[6]=ve,cs[7]=Ie,cs[8]=Ce,cs[9]=Ae,us[0]=me,us[1]=de,us[2]=_e,us[3]=fe,us[4]=pe,us[5]=we,us[6]=be,ds[0]=Oe,ds[1]=ce,ds[2]=Pe,ds[3]=Re,ds[4]=Fe,ds[5]=ke,ds[6]=Ve,i=1}else i=0}i&&(i=function(t,e){for(t.M=0;t.M<t.Va;++t.M){var i,n=t.Jc[t.M&t.Xb],s=t.m,r=t;for(i=0;i<r.za;++i){var a=s,o=r,l=o.Ac,h=o.Bc+4*i,u=o.zc,c=o.ya[o.aa+i];if(o.Qa.Bb?c.$b=T(a,o.Pa.jb[0])?2+T(a,o.Pa.jb[2]):T(a,o.Pa.jb[1]):c.$b=0,o.kc&&(c.Ad=T(a,o.Bd)),c.Za=!T(a,145)+0,c.Za){var d=c.Ob,_=0;for(o=0;4>o;++o){var f,g=u[0+o];for(f=0;4>f;++f){g=os[l[h+f]][g];for(var m=rs[T(a,g[0])];0<m;)m=rs[2*m+T(a,g[m])];g=-m,l[h+f]=g}re(d,_,l,h,4),_+=4,u[0+o]=g}}else g=T(a,156)?T(a,128)?1:3:T(a,163)?2:0,c.Ob[0]=g,ae(l,h,g,4),ae(u,0,g,4);c.Dd=T(a,142)?T(a,114)?T(a,183)?1:3:2:0}if(r.m.Ka)return Bt(t,7,"Premature end-of-partition0 encountered.");for(;t.ja<t.za;++t.ja){if(r=n,a=(s=t).rb[s.sb-1],l=s.rb[s.sb+s.ja],i=s.ya[s.aa+s.ja],h=s.kc?i.Ad:0)a.la=l.la=0,i.Za||(a.Na=l.Na=0),i.Hc=0,i.Gc=0,i.ia=0;else{var p,w;if(a=l,l=r,h=s.Pa.Xc,u=s.ya[s.aa+s.ja],c=s.pb[u.$b],o=u.ad,d=0,_=s.rb[s.sb-1],g=f=0,ae(o,d,0,384),u.Za)var b=0,S=h[3];else{m=oe(16);var y=a.Na+_.Na;if(y=is(l,h[1],y,c.Eb,0,m,0),a.Na=_.Na=(0<y)+0,1<y)sn(m,0,o,d);else{var x=m[0]+3>>3;for(m=0;256>m;m+=16)o[d+m]=x}b=1,S=h[0]}var E=15&a.la,v=15&_.la;for(m=0;4>m;++m){var L=1&v;for(x=w=0;4>x;++x)E=E>>1|(L=(y=is(l,S,y=L+(1&E),c.Sc,b,o,d))>b)<<7,w=w<<2|(3<y?3:1<y?2:0!=o[d+0]),d+=16;E>>=4,v=v>>1|L<<7,f=(f<<8|w)>>>0}for(S=E,b=v>>4,p=0;4>p;p+=2){for(w=0,E=a.la>>4+p,v=_.la>>4+p,m=0;2>m;++m){for(L=1&v,x=0;2>x;++x)y=L+(1&E),E=E>>1|(L=0<(y=is(l,h[2],y,c.Qc,0,o,d)))<<3,w=w<<2|(3<y?3:1<y?2:0!=o[d+0]),d+=16;E>>=2,v=v>>1|L<<5}g|=w<<4*p,S|=E<<4<<p,b|=(240&v)<<p}a.la=S,_.la=b,u.Hc=f,u.Gc=g,u.ia=43690&g?0:c.ia,h=!(f|g)}if(0<s.L&&(s.wa[s.Y+s.ja]=s.gd[i.$b][i.Za],s.wa[s.Y+s.ja].La|=!h),r.Ka)return Bt(t,7,"Premature end-of-file encountered.")}if(Ut(t),s=e,r=1,i=(n=t).D,a=0<n.L&&n.M>=n.zb&&n.M<=n.Va,0==n.Aa)t:{if(i.M=n.M,i.uc=a,Di(n,i),r=1,i=(w=n.D).Nb,a=(g=Gs[n.L])*n.R,l=g/2*n.B,m=16*i*n.R,x=8*i*n.B,h=n.sa,u=n.ta-a+m,c=n.qa,o=n.ra-l+x,d=n.Ha,_=n.Ia-l+x,v=0==(E=w.M),f=E>=n.Va-1,2==n.Aa&&Di(n,w),w.uc)for(L=(y=n).D.M,ne(y.D.uc),w=y.yb;w<y.Hb;++w){b=w,S=L;var I=(A=(M=y).D).Nb;p=M.R;var A=A.wa[A.Y+b],C=M.sa,P=M.ta+16*I*p+16*b,R=A.dd,D=A.tc;if(0!=D)if(ne(3<=D),1==M.L)0<b&&bn(C,P,p,D+4),A.La&&Sn(C,P,p,D),0<S&&wn(C,P,p,D+4),A.La&&Tn(C,P,p,D);else{var O=M.B,k=M.qa,F=M.ra+8*I*O+8*b,V=M.Ha,M=M.Ia+8*I*O+8*b;I=A.ld,0<b&&(cn(C,P,p,D+4,R,I),_n(k,F,V,M,O,D+4,R,I)),A.La&&(gn(C,P,p,D,R,I),pn(k,F,V,M,O,D,R,I)),0<S&&(un(C,P,p,D+4,R,I),dn(k,F,V,M,O,D+4,R,I)),A.La&&(fn(C,P,p,D,R,I),mn(k,F,V,M,O,D,R,I))}}if(n.ia&&alert("todo:DitherRow"),null!=s.put){if(w=16*E,E=16*(E+1),v?(s.y=n.sa,s.O=n.ta+m,s.f=n.qa,s.N=n.ra+x,s.ea=n.Ha,s.W=n.Ia+x):(w-=g,s.y=h,s.O=u,s.f=c,s.N=o,s.ea=d,s.W=_),f||(E-=g),E>s.o&&(E=s.o),s.F=null,s.J=null,null!=n.Fa&&0<n.Fa.length&&w<E&&(s.J=ui(n,s,w,E-w),s.F=n.mb,null==s.F&&0==s.F.length)){r=Bt(n,3,"Could not decode alpha data.");break t}w<s.j&&(g=s.j-w,w=s.j,ne(!(1&g)),s.O+=n.R*g,s.N+=n.B*(g>>1),s.W+=n.B*(g>>1),null!=s.F&&(s.J+=s.width*g)),w<E&&(s.O+=s.v,s.N+=s.v>>1,s.W+=s.v>>1,null!=s.F&&(s.J+=s.v),s.ka=w-s.j,s.U=s.va-s.v,s.T=E-w,r=s.put(s))}i+1!=n.Ic||f||(re(n.sa,n.ta-a,h,u+16*n.R,a),re(n.qa,n.ra-l,c,o+8*n.B,l),re(n.Ha,n.Ia-l,d,_+8*n.B,l))}if(!r)return Bt(t,6,"Output aborted.")}return 1}(t,e)),null!=e.bc&&e.bc(e),i&=1}return i?(t.cb=0,i):0}function Yt(t,e,i,n,s){s=t[e+i+32*n]+(s>>3),t[e+i+32*n]=-256&s?0>s?0:255:s}function zt(t,e,i,n,s,r){Yt(t,e,0,i,n+s),Yt(t,e,1,i,n+r),Yt(t,e,2,i,n-r),Yt(t,e,3,i,n-s)}function Kt(t){return(20091*t>>16)+t}function jt(t,e,i,n){var s,r=0,a=oe(16);for(s=0;4>s;++s){var o=t[e+0]+t[e+8],l=t[e+0]-t[e+8],h=(35468*t[e+4]>>16)-Kt(t[e+12]),u=Kt(t[e+4])+(35468*t[e+12]>>16);a[r+0]=o+u,a[r+1]=l+h,a[r+2]=l-h,a[r+3]=o-u,r+=4,e++}for(s=r=0;4>s;++s)o=(t=a[r+0]+4)+a[r+8],l=t-a[r+8],h=(35468*a[r+4]>>16)-Kt(a[r+12]),Yt(i,n,0,0,o+(u=Kt(a[r+4])+(35468*a[r+12]>>16))),Yt(i,n,1,0,l+h),Yt(i,n,2,0,l-h),Yt(i,n,3,0,o-u),r++,n+=32}function qt(t,e,i,n){var s=t[e+0]+4,r=35468*t[e+4]>>16,a=Kt(t[e+4]),o=35468*t[e+1]>>16;zt(i,n,0,s+a,t=Kt(t[e+1]),o),zt(i,n,1,s+r,t,o),zt(i,n,2,s-r,t,o),zt(i,n,3,s-a,t,o)}function Jt(t,e,i,n,s){jt(t,e,i,n),s&&jt(t,e+16,i,n+4)}function Zt(t,e,i,n){rn(t,e+0,i,n,1),rn(t,e+32,i,n+128,1)}function Qt(t,e,i,n){var s;for(t=t[e+0]+4,s=0;4>s;++s)for(e=0;4>e;++e)Yt(i,n,e,s,t)}function te(t,e,i,n){t[e+0]&&ln(t,e+0,i,n),t[e+16]&&ln(t,e+16,i,n+4),t[e+32]&&ln(t,e+32,i,n+128),t[e+48]&&ln(t,e+48,i,n+128+4)}function ee(t,e,i,n){var s,r=oe(16);for(s=0;4>s;++s){var a=t[e+0+s]+t[e+12+s],o=t[e+4+s]+t[e+8+s],l=t[e+4+s]-t[e+8+s],h=t[e+0+s]-t[e+12+s];r[0+s]=a+o,r[8+s]=a-o,r[4+s]=h+l,r[12+s]=h-l}for(s=0;4>s;++s)a=(t=r[0+4*s]+3)+r[3+4*s],o=r[1+4*s]+r[2+4*s],l=r[1+4*s]-r[2+4*s],h=t-r[3+4*s],i[n+0]=a+o>>3,i[n+16]=h+l>>3,i[n+32]=a-o>>3,i[n+48]=h-l>>3,n+=64}function ie(t,e,i){var n,s=e-32,r=On,a=255-t[s-1];for(n=0;n<i;++n){var o,l=r,h=a+t[e-1];for(o=0;o<i;++o)t[e+o]=l[h+t[s+o]];e+=32}}function ue(t,e){ie(t,e,4)}function ce(t,e){ie(t,e,8)}function de(t,e){ie(t,e,16)}function _e(t,e){var i;for(i=0;16>i;++i)re(t,e+32*i,t,e-32,16)}function fe(t,e){var i;for(i=16;0<i;--i)ae(t,e,t[e-1],16),e+=32}function ge(t,e,i){var n;for(n=0;16>n;++n)ae(e,i+32*n,t,16)}function me(t,e){var i,n=16;for(i=0;16>i;++i)n+=t[e-1+32*i]+t[e+i-32];ge(n>>5,t,e)}function pe(t,e){var i,n=8;for(i=0;16>i;++i)n+=t[e-1+32*i];ge(n>>4,t,e)}function we(t,e){var i,n=8;for(i=0;16>i;++i)n+=t[e+i-32];ge(n>>4,t,e)}function be(t,e){ge(128,t,e)}function Te(t,e,i){return t+2*e+i+2>>2}function Se(t,e){var i,n=e-32;n=new Uint8Array([Te(t[n-1],t[n+0],t[n+1]),Te(t[n+0],t[n+1],t[n+2]),Te(t[n+1],t[n+2],t[n+3]),Te(t[n+2],t[n+3],t[n+4])]);for(i=0;4>i;++i)re(t,e+32*i,n,0,n.length)}function ye(t,e){var i=t[e-1],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96];S(t,e+0,16843009*Te(t[e-1-32],i,n)),S(t,e+32,16843009*Te(i,n,s)),S(t,e+64,16843009*Te(n,s,r)),S(t,e+96,16843009*Te(s,r,r))}function xe(t,e){var i,n=4;for(i=0;4>i;++i)n+=t[e+i-32]+t[e-1+32*i];for(n>>=3,i=0;4>i;++i)ae(t,e+32*i,n,4)}function Ee(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1-32],a=t[e+0-32],o=t[e+1-32],l=t[e+2-32],h=t[e+3-32];t[e+0+96]=Te(n,s,t[e-1+96]),t[e+1+96]=t[e+0+64]=Te(i,n,s),t[e+2+96]=t[e+1+64]=t[e+0+32]=Te(r,i,n),t[e+3+96]=t[e+2+64]=t[e+1+32]=t[e+0+0]=Te(a,r,i),t[e+3+64]=t[e+2+32]=t[e+1+0]=Te(o,a,r),t[e+3+32]=t[e+2+0]=Te(l,o,a),t[e+3+0]=Te(h,l,o)}function ve(t,e){var i=t[e+1-32],n=t[e+2-32],s=t[e+3-32],r=t[e+4-32],a=t[e+5-32],o=t[e+6-32],l=t[e+7-32];t[e+0+0]=Te(t[e+0-32],i,n),t[e+1+0]=t[e+0+32]=Te(i,n,s),t[e+2+0]=t[e+1+32]=t[e+0+64]=Te(n,s,r),t[e+3+0]=t[e+2+32]=t[e+1+64]=t[e+0+96]=Te(s,r,a),t[e+3+32]=t[e+2+64]=t[e+1+96]=Te(r,a,o),t[e+3+64]=t[e+2+96]=Te(a,o,l),t[e+3+96]=Te(o,l,l)}function Le(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1-32],a=t[e+0-32],o=t[e+1-32],l=t[e+2-32],h=t[e+3-32];t[e+0+0]=t[e+1+64]=r+a+1>>1,t[e+1+0]=t[e+2+64]=a+o+1>>1,t[e+2+0]=t[e+3+64]=o+l+1>>1,t[e+3+0]=l+h+1>>1,t[e+0+96]=Te(s,n,i),t[e+0+64]=Te(n,i,r),t[e+0+32]=t[e+1+96]=Te(i,r,a),t[e+1+32]=t[e+2+96]=Te(r,a,o),t[e+2+32]=t[e+3+96]=Te(a,o,l),t[e+3+32]=Te(o,l,h)}function Ie(t,e){var i=t[e+0-32],n=t[e+1-32],s=t[e+2-32],r=t[e+3-32],a=t[e+4-32],o=t[e+5-32],l=t[e+6-32],h=t[e+7-32];t[e+0+0]=i+n+1>>1,t[e+1+0]=t[e+0+64]=n+s+1>>1,t[e+2+0]=t[e+1+64]=s+r+1>>1,t[e+3+0]=t[e+2+64]=r+a+1>>1,t[e+0+32]=Te(i,n,s),t[e+1+32]=t[e+0+96]=Te(n,s,r),t[e+2+32]=t[e+1+96]=Te(s,r,a),t[e+3+32]=t[e+2+96]=Te(r,a,o),t[e+3+64]=Te(a,o,l),t[e+3+96]=Te(o,l,h)}function Ae(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96];t[e+0+0]=i+n+1>>1,t[e+2+0]=t[e+0+32]=n+s+1>>1,t[e+2+32]=t[e+0+64]=s+r+1>>1,t[e+1+0]=Te(i,n,s),t[e+3+0]=t[e+1+32]=Te(n,s,r),t[e+3+32]=t[e+1+64]=Te(s,r,r),t[e+3+64]=t[e+2+64]=t[e+0+96]=t[e+1+96]=t[e+2+96]=t[e+3+96]=r}function Ce(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96],a=t[e-1-32],o=t[e+0-32],l=t[e+1-32],h=t[e+2-32];t[e+0+0]=t[e+2+32]=i+a+1>>1,t[e+0+32]=t[e+2+64]=n+i+1>>1,t[e+0+64]=t[e+2+96]=s+n+1>>1,t[e+0+96]=r+s+1>>1,t[e+3+0]=Te(o,l,h),t[e+2+0]=Te(a,o,l),t[e+1+0]=t[e+3+32]=Te(i,a,o),t[e+1+32]=t[e+3+64]=Te(n,i,a),t[e+1+64]=t[e+3+96]=Te(s,n,i),t[e+1+96]=Te(r,s,n)}function Pe(t,e){var i;for(i=0;8>i;++i)re(t,e+32*i,t,e-32,8)}function Re(t,e){var i;for(i=0;8>i;++i)ae(t,e,t[e-1],8),e+=32}function De(t,e,i){var n;for(n=0;8>n;++n)ae(e,i+32*n,t,8)}function Oe(t,e){var i,n=8;for(i=0;8>i;++i)n+=t[e+i-32]+t[e-1+32*i];De(n>>4,t,e)}function ke(t,e){var i,n=4;for(i=0;8>i;++i)n+=t[e+i-32];De(n>>3,t,e)}function Fe(t,e){var i,n=4;for(i=0;8>i;++i)n+=t[e-1+32*i];De(n>>3,t,e)}function Ve(t,e){De(128,t,e)}function Me(t,e,i){var n=t[e-i],s=t[e+0],r=3*(s-n)+Rn[1020+t[e-2*i]-t[e+i]],a=Dn[112+(r+4>>3)];t[e-i]=On[255+n+Dn[112+(r+3>>3)]],t[e+0]=On[255+s-a]}function Ge(t,e,i,n){var s=t[e+0],r=t[e+i];return kn[255+t[e-2*i]-t[e-i]]>n||kn[255+r-s]>n}function Ne(t,e,i,n){return 4*kn[255+t[e-i]-t[e+0]]+kn[255+t[e-2*i]-t[e+i]]<=n}function Be(t,e,i,n,s){var r=t[e-3*i],a=t[e-2*i],o=t[e-i],l=t[e+0],h=t[e+i],u=t[e+2*i],c=t[e+3*i];return 4*kn[255+o-l]+kn[255+a-h]>n?0:kn[255+t[e-4*i]-r]<=s&&kn[255+r-a]<=s&&kn[255+a-o]<=s&&kn[255+c-u]<=s&&kn[255+u-h]<=s&&kn[255+h-l]<=s}function We(t,e,i,n){var s=2*n+1;for(n=0;16>n;++n)Ne(t,e+n,i,s)&&Me(t,e+n,i)}function $e(t,e,i,n){var s=2*n+1;for(n=0;16>n;++n)Ne(t,e+n*i,1,s)&&Me(t,e+n*i,1)}function He(t,e,i,n){var s;for(s=3;0<s;--s)We(t,e+=4*i,i,n)}function Ue(t,e,i,n){var s;for(s=3;0<s;--s)$e(t,e+=4,i,n)}function Xe(t,e,i,n,s,r,a,o){for(r=2*r+1;0<s--;){if(Be(t,e,i,r,a))if(Ge(t,e,i,o))Me(t,e,i);else{var l=t,h=e,u=i,c=l[h-2*u],d=l[h-u],_=l[h+0],f=l[h+u],g=l[h+2*u],m=27*(w=Rn[1020+3*(_-d)+Rn[1020+c-f]])+63>>7,p=18*w+63>>7,w=9*w+63>>7;l[h-3*u]=On[255+l[h-3*u]+w],l[h-2*u]=On[255+c+p],l[h-u]=On[255+d+m],l[h+0]=On[255+_-m],l[h+u]=On[255+f-p],l[h+2*u]=On[255+g-w]}e+=n}}function Ye(t,e,i,n,s,r,a,o){for(r=2*r+1;0<s--;){if(Be(t,e,i,r,a))if(Ge(t,e,i,o))Me(t,e,i);else{var l=t,h=e,u=i,c=l[h-u],d=l[h+0],_=l[h+u],f=Dn[112+((g=3*(d-c))+4>>3)],g=Dn[112+(g+3>>3)],m=f+1>>1;l[h-2*u]=On[255+l[h-2*u]+m],l[h-u]=On[255+c+g],l[h+0]=On[255+d-f],l[h+u]=On[255+_-m]}e+=n}}function ze(t,e,i,n,s,r){Xe(t,e,i,1,16,n,s,r)}function Ke(t,e,i,n,s,r){Xe(t,e,1,i,16,n,s,r)}function je(t,e,i,n,s,r){var a;for(a=3;0<a;--a)Ye(t,e+=4*i,i,1,16,n,s,r)}function qe(t,e,i,n,s,r){var a;for(a=3;0<a;--a)Ye(t,e+=4,1,i,16,n,s,r)}function Je(t,e,i,n,s,r,a,o){Xe(t,e,s,1,8,r,a,o),Xe(i,n,s,1,8,r,a,o)}function Ze(t,e,i,n,s,r,a,o){Xe(t,e,1,s,8,r,a,o),Xe(i,n,1,s,8,r,a,o)}function Qe(t,e,i,n,s,r,a,o){Ye(t,e+4*s,s,1,8,r,a,o),Ye(i,n+4*s,s,1,8,r,a,o)}function ti(t,e,i,n,s,r,a,o){Ye(t,e+4,1,s,8,r,a,o),Ye(i,n+4,1,s,8,r,a,o)}function ei(){this.ba=new Z,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new tt,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function ii(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function ni(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function si(){this.ua=0,this.Wa=new I,this.vb=new I,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new r,this.yc=new n}function ri(){this.xb=this.a=0,this.l=new Gt,this.ca=new Z,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new _,this.Pb=0,this.wd=new _,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new si,this.ab=0,this.gc=le(4,ni),this.Oc=0}function ai(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Gt,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function oi(t,e,i,n,s,r,a){for(t=null==t?0:t[e+0],e=0;e<a;++e)s[r+e]=t+i[n+e]&255,t=s[r+e]}function li(t,e,i,n,s,r,a){var o;if(null==t)oi(null,null,i,n,s,r,a);else for(o=0;o<a;++o)s[r+o]=t[e+o]+i[n+o]&255}function hi(t,e,i,n,s,r,a){if(null==t)oi(null,null,i,n,s,r,a);else{var o,l=t[e+0],h=l,u=l;for(o=0;o<a;++o)h=u+(l=t[e+o])-h,u=i[n+o]+(-256&h?0>h?0:255:h)&255,h=l,s[r+o]=u}}function ui(t,e,i,n){var s=e.width,r=e.o;if(ne(null!=t&&null!=e),0>i||0>=n||i+n>r)return null;if(!t.Cc){if(null==t.ga){var a;if(t.ga=new ai,(a=null==t.ga)||(a=e.width*e.o,ne(0==t.Gb.length),t.Gb=oe(a),t.Uc=0,null==t.Gb?a=0:(t.mb=t.Gb,t.nb=t.Uc,t.rc=null,a=1),a=!a),!a){a=t.ga;var o=t.Fa,l=t.P,u=t.qc,c=t.mb,d=t.nb,_=l+1,f=u-1,m=a.l;if(ne(null!=o&&null!=c&&null!=e),gs[0]=null,gs[1]=oi,gs[2]=li,gs[3]=hi,a.ca=c,a.tb=d,a.c=e.width,a.i=e.height,ne(0<a.c&&0<a.i),1>=u)e=0;else if(a.$a=o[l+0]>>0&3,a.Z=o[l+0]>>2&3,a.Lc=o[l+0]>>4&3,l=o[l+0]>>6&3,0>a.$a||1<a.$a||4<=a.Z||1<a.Lc||l)e=0;else if(m.put=rt,m.ac=st,m.bc=at,m.ma=a,m.width=e.width,m.height=e.height,m.Da=e.Da,m.v=e.v,m.va=e.va,m.j=e.j,m.o=e.o,a.$a)t:{ne(1==a.$a),e=Tt();e:for(;;){if(null==e){e=0;break t}if(ne(null!=a),a.mc=e,e.c=a.c,e.i=a.i,e.l=a.l,e.l.ma=a,e.l.width=a.c,e.l.height=a.i,e.a=0,h(e.m,o,_,f),!St(a.c,a.i,1,e,null))break e;if(1==e.ab&&3==e.gc[0].hc&>(e.s)?(a.ic=1,o=e.c*e.i,e.Ta=null,e.Ua=0,e.V=oe(o),e.Ba=0,null==e.V?(e.a=1,e=0):e=1):(a.ic=0,e=yt(e,a.c)),!e)break e;e=1;break t}a.mc=null,e=0}else e=f>=a.c*a.i;a=!e}if(a)return null;1!=t.ga.Lc?t.Ga=0:n=r-i}ne(null!=t.ga),ne(i+n<=r);t:{if(e=(o=t.ga).c,r=o.l.o,0==o.$a){if(_=t.rc,f=t.Vc,m=t.Fa,l=t.P+1+i*e,u=t.mb,c=t.nb+i*e,ne(l<=t.P+t.qc),0!=o.Z)for(ne(null!=gs[o.Z]),a=0;a<n;++a)gs[o.Z](_,f,m,l,u,c,e),_=u,f=c,c+=e,l+=e;else for(a=0;a<n;++a)re(u,c,m,l,e),_=u,f=c,c+=e,l+=e;t.rc=_,t.Vc=f}else{if(ne(null!=o.mc),e=i+n,ne(null!=(a=o.mc)),ne(e<=a.i),a.C>=e)e=1;else if(o.ic||gi(),o.ic){o=a.V,_=a.Ba,f=a.c;var w=a.i,b=(m=1,l=a.$/f,u=a.$%f,c=a.m,d=a.s,a.$),T=f*w,S=f*e,y=d.wc,x=b<S?dt(d,u,l):null;ne(b<=T),ne(e<=w),ne(gt(d));e:for(;;){for(;!c.h&&b<S;){if(u&y||(x=dt(d,u,l)),ne(null!=x),p(c),256>(w=ut(x.G[0],x.H[0],c)))o[_+b]=w,++b,++u>=f&&(u=0,++l<=e&&!(l%16)&&pt(a,l));else{if(!(280>w)){m=0;break e}w=lt(w-256,c);var E,v=ut(x.G[4],x.H[4],c);if(p(c),!(b>=(v=ht(f,v=lt(v,c)))&&T-b>=w)){m=0;break e}for(E=0;E<w;++E)o[_+b+E]=o[_+b+E-v];for(b+=w,u+=w;u>=f;)u-=f,++l<=e&&!(l%16)&&pt(a,l);b<S&&u&y&&(x=dt(d,u,l))}ne(c.h==g(c))}pt(a,l>e?e:l);break e}!m||c.h&&b<T?(m=0,a.a=c.h?5:3):a.$=b,e=m}else e=wt(a,a.V,a.Ba,a.c,a.i,e,xt);if(!e){n=0;break t}}i+n>=r&&(t.Cc=1),n=1}if(!n)return null;if(t.Cc&&(null!=(n=t.ga)&&(n.mc=null),t.ga=null,0<t.Ga))return alert("todo:WebPDequantizeLevels"),null}return t.nb+i*s}function ci(t,e,i,n,s,r){for(;0<s--;){var a,o=t,l=e+(i?1:0),h=t,u=e+(i?0:3);for(a=0;a<n;++a){var c=h[u+4*a];255!=c&&(c*=32897,o[l+4*a+0]=o[l+4*a+0]*c>>23,o[l+4*a+1]=o[l+4*a+1]*c>>23,o[l+4*a+2]=o[l+4*a+2]*c>>23)}e+=r}}function di(t,e,i,n,s){for(;0<n--;){var r;for(r=0;r<i;++r){var a=t[e+2*r+0],o=15&(h=t[e+2*r+1]),l=4369*o,h=(240&h|h>>4)*l>>16;t[e+2*r+0]=(240&a|a>>4)*l>>16&240|(15&a|a<<4)*l>>16>>4&15,t[e+2*r+1]=240&h|o}e+=s}}function _i(t,e,i,n,s,r,a,o){var l,h,u=255;for(h=0;h<s;++h){for(l=0;l<n;++l){var c=t[e+l];r[a+4*l]=c,u&=c}e+=i,a+=o}return 255!=u}function fi(t,e,i,n,s){var r;for(r=0;r<s;++r)i[n+r]=t[e+r]>>8}function gi(){yn=ci,xn=di,En=_i,vn=fi}function mi(t,e,i){self[t]=function(t,n,s,r,a,o,l,h,u,c,d,_,f,g,m,p,w){var b,T=w-1>>1,S=a[o+0]|l[h+0]<<16,y=u[c+0]|d[_+0]<<16;ne(null!=t);var x=3*S+y+131074>>2;for(e(t[n+0],255&x,x>>16,f,g),null!=s&&(x=3*y+S+131074>>2,e(s[r+0],255&x,x>>16,m,p)),b=1;b<=T;++b){var E=a[o+b]|l[h+b]<<16,v=u[c+b]|d[_+b]<<16,L=S+E+y+v+524296,I=L+2*(E+y)>>3;x=I+S>>1,S=(L=L+2*(S+v)>>3)+E>>1,e(t[n+2*b-1],255&x,x>>16,f,g+(2*b-1)*i),e(t[n+2*b-0],255&S,S>>16,f,g+(2*b-0)*i),null!=s&&(x=L+y>>1,S=I+v>>1,e(s[r+2*b-1],255&x,x>>16,m,p+(2*b-1)*i),e(s[r+2*b+0],255&S,S>>16,m,p+(2*b+0)*i)),S=E,y=v}1&w||(x=3*S+y+131074>>2,e(t[n+w-1],255&x,x>>16,f,g+(w-1)*i),null!=s&&(x=3*y+S+131074>>2,e(s[r+w-1],255&x,x>>16,m,p+(w-1)*i)))}}function pi(){ms[Fn]=ps,ms[Vn]=bs,ms[Mn]=ws,ms[Gn]=Ts,ms[Nn]=Ss,ms[Bn]=ys,ms[Wn]=xs,ms[$n]=bs,ms[Hn]=Ts,ms[Un]=Ss,ms[Xn]=ys}function wi(t){return t&~Cs?0>t?0:255:t>>As}function bi(t,e){return wi((19077*t>>8)+(26149*e>>8)-14234)}function Ti(t,e,i){return wi((19077*t>>8)-(6419*e>>8)-(13320*i>>8)+8708)}function Si(t,e){return wi((19077*t>>8)+(33050*e>>8)-17685)}function yi(t,e,i,n,s){n[s+0]=bi(t,i),n[s+1]=Ti(t,e,i),n[s+2]=Si(t,e)}function xi(t,e,i,n,s){n[s+0]=Si(t,e),n[s+1]=Ti(t,e,i),n[s+2]=bi(t,i)}function Ei(t,e,i,n,s){var r=Ti(t,e,i);e=r<<3&224|Si(t,e)>>3,n[s+0]=248&bi(t,i)|r>>5,n[s+1]=e}function vi(t,e,i,n,s){var r=240&Si(t,e)|15;n[s+0]=240&bi(t,i)|Ti(t,e,i)>>4,n[s+1]=r}function Li(t,e,i,n,s){n[s+0]=255,yi(t,e,i,n,s+1)}function Ii(t,e,i,n,s){xi(t,e,i,n,s),n[s+3]=255}function Ai(t,e,i,n,s){yi(t,e,i,n,s),n[s+3]=255}function Mt(t,e){return 0>t?0:t>e?e:t}function Ci(t,e,i){self[t]=function(t,n,s,r,a,o,l,h,u){for(var c=h+(-2&u)*i;h!=c;)e(t[n+0],s[r+0],a[o+0],l,h),e(t[n+1],s[r+0],a[o+0],l,h+i),n+=2,++r,++o,h+=2*i;1&u&&e(t[n+0],s[r+0],a[o+0],l,h)}}function Pi(t,e,i){return 0==i?0==t?0==e?6:5:0==e?4:0:i}function Ri(t,e,i,n,s){switch(t>>>30){case 3:rn(e,i,n,s,0);break;case 2:an(e,i,n,s);break;case 1:ln(e,i,n,s)}}function Di(t,e){var i,n,s=e.M,r=e.Nb,a=t.oc,o=t.pc+40,l=t.oc,h=t.pc+584,u=t.oc,c=t.pc+600;for(i=0;16>i;++i)a[o+32*i-1]=129;for(i=0;8>i;++i)l[h+32*i-1]=129,u[c+32*i-1]=129;for(0<s?a[o-1-32]=l[h-1-32]=u[c-1-32]=129:(ae(a,o-32-1,127,21),ae(l,h-32-1,127,9),ae(u,c-32-1,127,9)),n=0;n<t.za;++n){var d=e.ya[e.aa+n];if(0<n){for(i=-1;16>i;++i)re(a,o+32*i-4,a,o+32*i+12,4);for(i=-1;8>i;++i)re(l,h+32*i-4,l,h+32*i+4,4),re(u,c+32*i-4,u,c+32*i+4,4)}var _=t.Gd,f=t.Hd+n,g=d.ad,m=d.Hc;if(0<s&&(re(a,o-32,_[f].y,0,16),re(l,h-32,_[f].f,0,8),re(u,c-32,_[f].ea,0,8)),d.Za){var p=a,w=o-32+16;for(0<s&&(n>=t.za-1?ae(p,w,_[f].y[15],4):re(p,w,_[f+1].y,0,4)),i=0;4>i;i++)p[w+128+i]=p[w+256+i]=p[w+384+i]=p[w+0+i];for(i=0;16>i;++i,m<<=2)p=a,w=o+Ms[i],cs[d.Ob[i]](p,w),Ri(m,g,16*+i,p,w)}else if(p=Pi(n,s,d.Ob[0]),us[p](a,o),0!=m)for(i=0;16>i;++i,m<<=2)Ri(m,g,16*+i,a,o+Ms[i]);for(i=d.Gc,p=Pi(n,s,d.Dd),ds[p](l,h),ds[p](u,c),m=g,p=l,w=h,255&(d=i>>0)&&(170&d?on(m,256,p,w):hn(m,256,p,w)),d=u,m=c,255&(i>>=8)&&(170&i?on(g,320,d,m):hn(g,320,d,m)),s<t.Ub-1&&(re(_[f].y,0,a,o+480,16),re(_[f].f,0,l,h+224,8),re(_[f].ea,0,u,c+224,8)),i=8*r*t.B,_=t.sa,f=t.ta+16*n+16*r*t.R,g=t.qa,d=t.ra+8*n+i,m=t.Ha,p=t.Ia+8*n+i,i=0;16>i;++i)re(_,f+i*t.R,a,o+32*i,16);for(i=0;8>i;++i)re(g,d+i*t.B,l,h+32*i,8),re(m,p+i*t.B,u,c+32*i,8)}}function Oi(t,e,i,n,s,r,a,o,l){var u=[0],c=[0],d=0,f=null!=l?l.kd:0,g=null!=l?l:new ii;if(null==t||12>i)return 7;g.data=t,g.w=e,g.ha=i,e=[e],i=[i],g.gb=[g.gb];t:{var m=e,p=i,w=g.gb;if(ne(null!=t),ne(null!=p),ne(null!=w),w[0]=0,12<=p[0]&&!se(t,m[0],"RIFF")){if(se(t,m[0]+8,"WEBP")){w=3;break t}var b=E(t,m[0]+4);if(12>b||4294967286<b){w=3;break t}if(f&&b>p[0]-8){w=7;break t}w[0]=b,m[0]+=12,p[0]-=12}w=0}if(0!=w)return w;for(b=0<g.gb[0],i=i[0];;){t:{var T=t;p=e,w=i;var S=u,y=c,v=m=[0];if((A=d=[d])[0]=0,8>w[0])w=7;else{if(!se(T,p[0],"VP8X")){if(10!=E(T,p[0]+4)){w=3;break t}if(18>w[0]){w=7;break t}var L=E(T,p[0]+8),I=1+x(T,p[0]+12);if(2147483648<=I*(T=1+x(T,p[0]+15))){w=3;break t}null!=v&&(v[0]=L),null!=S&&(S[0]=I),null!=y&&(y[0]=T),p[0]+=18,w[0]-=18,A[0]=1}w=0}}if(d=d[0],m=m[0],0!=w)return w;if(p=!!(2&m),!b&&d)return 3;if(null!=r&&(r[0]=!!(16&m)),null!=a&&(a[0]=p),null!=o&&(o[0]=0),a=u[0],m=c[0],d&&p&&null==l){w=0;break}if(4>i){w=7;break}if(b&&d||!b&&!d&&!se(t,e[0],"ALPH")){i=[i],g.na=[g.na],g.P=[g.P],g.Sa=[g.Sa];t:{L=t,w=e,b=i;var A=g.gb;S=g.na,y=g.P,v=g.Sa;I=22,ne(null!=L),ne(null!=b),T=w[0];var C=b[0];for(ne(null!=S),ne(null!=v),S[0]=null,y[0]=null,v[0]=0;;){if(w[0]=T,b[0]=C,8>C){w=7;break t}var P=E(L,T+4);if(4294967286<P){w=3;break t}var R=8+P+1&-2;if(I+=R,0<A&&I>A){w=3;break t}if(!se(L,T,"VP8 ")||!se(L,T,"VP8L")){w=0;break t}if(C[0]<R){w=7;break t}se(L,T,"ALPH")||(S[0]=L,y[0]=T+8,v[0]=P),T+=R,C-=R}}if(i=i[0],g.na=g.na[0],g.P=g.P[0],g.Sa=g.Sa[0],0!=w)break}i=[i],g.Ja=[g.Ja],g.xa=[g.xa];t:if(A=t,w=e,b=i,S=g.gb[0],y=g.Ja,v=g.xa,L=w[0],T=!se(A,L,"VP8 "),I=!se(A,L,"VP8L"),ne(null!=A),ne(null!=b),ne(null!=y),ne(null!=v),8>b[0])w=7;else{if(T||I){if(A=E(A,L+4),12<=S&&A>S-12){w=3;break t}if(f&&A>b[0]-8){w=7;break t}y[0]=A,w[0]+=8,b[0]-=8,v[0]=I}else v[0]=5<=b[0]&&47==A[L+0]&&!(A[L+4]>>5),y[0]=b[0];w=0}if(i=i[0],g.Ja=g.Ja[0],g.xa=g.xa[0],e=e[0],0!=w)break;if(4294967286<g.Ja)return 3;if(null==o||p||(o[0]=g.xa?2:1),a=[a],m=[m],g.xa){if(5>i){w=7;break}o=a,f=m,p=r,null==t||5>i?t=0:5<=i&&47==t[e+0]&&!(t[e+4]>>5)?(b=[0],A=[0],S=[0],h(y=new _,t,e,i),ot(y,b,A,S)?(null!=o&&(o[0]=b[0]),null!=f&&(f[0]=A[0]),null!=p&&(p[0]=S[0]),t=1):t=0):t=0}else{if(10>i){w=7;break}o=m,null==t||10>i||!Wt(t,e+3,i-3)?t=0:(f=t[e+0]|t[e+1]<<8|t[e+2]<<16,p=16383&(t[e+7]<<8|t[e+6]),t=16383&(t[e+9]<<8|t[e+8]),1&f||3<(f>>1&7)||!(f>>4&1)||f>>5>=g.Ja||!p||!t?t=0:(a&&(a[0]=p),o&&(o[0]=t),t=1))}if(!t)return 3;if(a=a[0],m=m[0],d&&(u[0]!=a||c[0]!=m))return 3;null!=l&&(l[0]=g,l.offset=e-l.w,ne(4294967286>e-l.w),ne(l.offset==l.ha-i));break}return 0==w||7==w&&d&&null==l?(null!=r&&(r[0]|=null!=g.na&&0<g.na.length),null!=n&&(n[0]=a),null!=s&&(s[0]=m),0):w}function ki(t,e,i){var n=e.width,s=e.height,r=0,a=0,o=n,l=s;if(e.Da=null!=t&&0<t.Da,e.Da&&(o=t.cd,l=t.bd,r=t.v,a=t.j,11>i||(r&=-2,a&=-2),0>r||0>a||0>=o||0>=l||r+o>n||a+l>s))return 0;if(e.v=r,e.j=a,e.va=r+o,e.o=a+l,e.U=o,e.T=l,e.da=null!=t&&0<t.da,e.da){if(!A(o,l,i=[t.ib],r=[t.hb]))return 0;e.ib=i[0],e.hb=r[0]}return e.ob=null!=t&&t.ob,e.Kb=null==t||!t.Sd,e.da&&(e.ob=e.ib<3*n/4&&e.hb<3*s/4,e.Kb=0),1}function Fi(t){if(null==t)return 2;if(11>t.S){var e=t.f.RGBA;e.fb+=(t.height-1)*e.A,e.A=-e.A}else e=t.f.kb,t=t.height,e.O+=(t-1)*e.fa,e.fa=-e.fa,e.N+=(t-1>>1)*e.Ab,e.Ab=-e.Ab,e.W+=(t-1>>1)*e.Db,e.Db=-e.Db,null!=e.F&&(e.J+=(t-1)*e.lb,e.lb=-e.lb);return 0}function Vi(t,e,i,n){if(null==n||0>=t||0>=e)return 2;if(null!=i){if(i.Da){var s=i.cd,r=i.bd,a=-2&i.v,o=-2&i.j;if(0>a||0>o||0>=s||0>=r||a+s>t||o+r>e)return 2;t=s,e=r}if(i.da){if(!A(t,e,s=[i.ib],r=[i.hb]))return 2;t=s[0],e=r[0]}}n.width=t,n.height=e;t:{var l=n.width,h=n.height;if(t=n.S,0>=l||0>=h||!(t>=Fn&&13>t))t=2;else{if(0>=n.Rd&&null==n.sd){a=r=s=e=0;var u=(o=l*Ws[t])*h;if(11>t||(r=(h+1)/2*(e=(l+1)/2),12==t&&(a=(s=l)*h)),null==(h=oe(u+2*r+a))){t=1;break t}n.sd=h,11>t?((l=n.f.RGBA).eb=h,l.fb=0,l.A=o,l.size=u):((l=n.f.kb).y=h,l.O=0,l.fa=o,l.Fd=u,l.f=h,l.N=0+u,l.Ab=e,l.Cd=r,l.ea=h,l.W=0+u+r,l.Db=e,l.Ed=r,12==t&&(l.F=h,l.J=0+u+2*r),l.Tc=a,l.lb=s)}if(e=1,s=n.S,r=n.width,a=n.height,s>=Fn&&13>s)if(11>s)t=n.f.RGBA,e&=(o=Math.abs(t.A))*(a-1)+r<=t.size,e&=o>=r*Ws[s],e&=null!=t.eb;else{t=n.f.kb,o=(r+1)/2,u=(a+1)/2,l=Math.abs(t.fa);h=Math.abs(t.Ab);var c=Math.abs(t.Db),d=Math.abs(t.lb),_=d*(a-1)+r;e&=l*(a-1)+r<=t.Fd,e&=h*(u-1)+o<=t.Cd,e=(e&=c*(u-1)+o<=t.Ed)&l>=r&h>=o&c>=o,e&=null!=t.y,e&=null!=t.f,e&=null!=t.ea,12==s&&(e&=d>=r,e&=_<=t.Tc,e&=null!=t.F)}else e=0;t=e?0:2}}return 0!=t||null!=i&&i.fd&&(t=Fi(n)),t}var Mi=64,Gi=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],Ni=24,Bi=32,Wi=8,$i=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];R("Predictor0","PredictorAdd0"),self.Predictor0=function(){return 4278190080},self.Predictor1=function(t){return t},self.Predictor2=function(t,e,i){return e[i+0]},self.Predictor3=function(t,e,i){return e[i+1]},self.Predictor4=function(t,e,i){return e[i-1]},self.Predictor5=function(t,e,i){return O(O(t,e[i+1]),e[i+0])},self.Predictor6=function(t,e,i){return O(t,e[i-1])},self.Predictor7=function(t,e,i){return O(t,e[i+0])},self.Predictor8=function(t,e,i){return O(e[i-1],e[i+0])},self.Predictor9=function(t,e,i){return O(e[i+0],e[i+1])},self.Predictor10=function(t,e,i){return O(O(t,e[i-1]),O(e[i+0],e[i+1]))},self.Predictor11=function(t,e,i){var n=e[i+0];return 0>=V(n>>24&255,t>>24&255,(e=e[i-1])>>24&255)+V(n>>16&255,t>>16&255,e>>16&255)+V(n>>8&255,t>>8&255,e>>8&255)+V(255&n,255&t,255&e)?n:t},self.Predictor12=function(t,e,i){var n=e[i+0];return(k((t>>24&255)+(n>>24&255)-((e=e[i-1])>>24&255))<<24|k((t>>16&255)+(n>>16&255)-(e>>16&255))<<16|k((t>>8&255)+(n>>8&255)-(e>>8&255))<<8|k((255&t)+(255&n)-(255&e)))>>>0},self.Predictor13=function(t,e,i){var n=e[i-1];return(F((t=O(t,e[i+0]))>>24&255,n>>24&255)<<24|F(t>>16&255,n>>16&255)<<16|F(t>>8&255,n>>8&255)<<8|F(t>>0&255,n>>0&255))>>>0};var Hi=self.PredictorAdd0;self.PredictorAdd1=M,R("Predictor2","PredictorAdd2"),R("Predictor3","PredictorAdd3"),R("Predictor4","PredictorAdd4"),R("Predictor5","PredictorAdd5"),R("Predictor6","PredictorAdd6"),R("Predictor7","PredictorAdd7"),R("Predictor8","PredictorAdd8"),R("Predictor9","PredictorAdd9"),R("Predictor10","PredictorAdd10"),R("Predictor11","PredictorAdd11"),R("Predictor12","PredictorAdd12"),R("Predictor13","PredictorAdd13");var Ui=self.PredictorAdd2;W("ColorIndexInverseTransform","MapARGB","32b",(function(t){return t>>8&255}),(function(t){return t})),W("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",(function(t){return t}),(function(t){return t>>8&255}));var Xi,Yi=self.ColorIndexInverseTransform,zi=self.MapARGB,Ki=self.VP8LColorIndexInverseTransformAlpha,ji=self.MapAlpha,qi=self.VP8LPredictorsAdd=[];qi.length=16,(self.VP8LPredictors=[]).length=16,(self.VP8LPredictorsAdd_C=[]).length=16,(self.VP8LPredictors_C=[]).length=16;var Ji,Zi,Qi,tn,en,nn,sn,rn,an,on,ln,hn,un,cn,dn,_n,fn,gn,mn,pn,wn,bn,Tn,Sn,yn,xn,En,vn,Ln=oe(511),In=oe(2041),An=oe(225),Cn=oe(767),Pn=0,Rn=In,Dn=An,On=Cn,kn=Ln,Fn=0,Vn=1,Mn=2,Gn=3,Nn=4,Bn=5,Wn=6,$n=7,Hn=8,Un=9,Xn=10,Yn=[2,3,7],zn=[3,3,11],Kn=[280,256,256,256,40],jn=[0,1,1,1,0],qn=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],Jn=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],Zn=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],Qn=8,ts=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],es=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],is=null,ns=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],ss=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],rs=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],as=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],os=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],ls=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],hs=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],us=[],cs=[],ds=[],_s=1,fs=2,gs=[],ms=[];mi("UpsampleRgbLinePair",yi,3),mi("UpsampleBgrLinePair",xi,3),mi("UpsampleRgbaLinePair",Ai,4),mi("UpsampleBgraLinePair",Ii,4),mi("UpsampleArgbLinePair",Li,4),mi("UpsampleRgba4444LinePair",vi,2),mi("UpsampleRgb565LinePair",Ei,2);var ps=window.UpsampleRgbLinePair,ws=window.UpsampleBgrLinePair,bs=window.UpsampleRgbaLinePair,Ts=window.UpsampleBgraLinePair,Ss=window.UpsampleArgbLinePair,ys=window.UpsampleRgba4444LinePair,xs=window.UpsampleRgb565LinePair,Es=16,vs=1<<Es-1,Ls=-227,Is=482,As=6,Cs=(256<<As)-1,Ps=0,Rs=oe(256),Ds=oe(256),Os=oe(256),ks=oe(256),Fs=oe(Is-Ls),Vs=oe(Is-Ls);Ci("YuvToRgbRow",yi,3),Ci("YuvToBgrRow",xi,3),Ci("YuvToRgbaRow",Ai,4),Ci("YuvToBgraRow",Ii,4),Ci("YuvToArgbRow",Li,4),Ci("YuvToRgba4444Row",vi,2),Ci("YuvToRgb565Row",Ei,2);var Ms=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Gs=[0,2,8],Ns=[8,7,6,4,4,2,2,2,1,1,1,1],Bs=1;this.WebPDecodeRGBA=function(t,e,i,n,s){var r=Vn,a=new ei,o=new Z;a.ba=o,o.S=r,o.width=[o.width],o.height=[o.height];var l=o.width,u=o.height,c=new Q;if(null==c||null==t)var d=2;else ne(null!=c),d=Oi(t,e,i,c.width,c.height,c.Pd,c.Qd,c.format,null);if(0!=d?l=0:(null!=l&&(l[0]=c.width[0]),null!=u&&(u[0]=c.height[0]),l=1),l){o.width=o.width[0],o.height=o.height[0],null!=n&&(n[0]=o.width),null!=s&&(s[0]=o.height);t:{if(n=new Gt,(s=new ii).data=t,s.w=e,s.ha=i,s.kd=1,e=[0],ne(null!=s),(0==(t=Oi(s.data,s.w,s.ha,null,null,null,e,null,s))||7==t)&&e[0]&&(t=4),0==(e=t)){if(ne(null!=a),n.data=s.data,n.w=s.w+s.offset,n.ha=s.ha-s.offset,n.put=rt,n.ac=st,n.bc=at,n.ma=a,s.xa){if(null==(t=Tt())){a=1;break t}if(function(t,e){var i=[0],n=[0],s=[0];e:for(;;){if(null==t)return 0;if(null==e)return t.a=2,0;if(t.l=e,t.a=0,h(t.m,e.data,e.w,e.ha),!ot(t.m,i,n,s)){t.a=3;break e}if(t.xb=fs,e.width=i[0],e.height=n[0],!St(i[0],n[0],1,t,null))break e;return 1}return ne(0!=t.a),0}(t,n)){if(n=0==(e=Vi(n.width,n.height,a.Oa,a.ba))){e:{n=t;i:for(;;){if(null==n){n=0;break e}if(ne(null!=n.s.yc),ne(null!=n.s.Ya),ne(0<n.s.Wb),ne(null!=(i=n.l)),ne(null!=(s=i.ma)),0!=n.xb){if(n.ca=s.ba,n.tb=s.tb,ne(null!=n.ca),!ki(s.Oa,i,Gn)){n.a=2;break i}if(!yt(n,i.width))break i;if(i.da)break i;if((i.da||j(n.ca.S))&&gi(),11>n.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),null!=n.ca.f.kb.F&&gi()),n.Pb&&0<n.s.ua&&null==n.s.vb.X&&!v(n.s.vb,n.s.Wa.Xa)){n.a=1;break i}n.xb=0}if(!wt(n,n.V,n.Ba,n.c,n.i,i.o,ft))break i;s.Dc=n.Ma,n=1;break e}ne(0!=n.a),n=0}n=!n}n&&(e=t.a)}else e=t.a}else{if(null==(t=new Nt)){a=1;break t}if(t.Fa=s.na,t.P=s.P,t.qc=s.Sa,$t(t,n)){if(0==(e=Vi(n.width,n.height,a.Oa,a.ba))){if(t.Aa=0,i=a.Oa,ne(null!=(s=t)),null!=i){if(0<(l=0>(l=i.Md)?0:100<l?255:255*l/100)){for(u=c=0;4>u;++u)12>(d=s.pb[u]).lc&&(d.ia=l*Ns[0>d.lc?0:d.lc]>>3),c|=d.ia;c&&(alert("todo:VP8InitRandom"),s.ia=1)}s.Ga=i.Id,100<s.Ga?s.Ga=100:0>s.Ga&&(s.Ga=0)}Xt(t,n)||(e=t.a)}}else e=t.a}0==e&&null!=a.Oa&&a.Oa.fd&&(e=Fi(a.ba))}a=e}r=0!=a?null:11>r?o.f.RGBA.eb:o.f.kb.y}else r=null;return r};var Ws=[3,4,3,4,4,2,2,4,4,4,2,1,1]},new window.WebPDecoder,window.WebPRiffParser=function(t,e){var i={},n=0,s=!1,r=0,a=0;if(i.frames=[],!function(t,e,i,n){for(var s=0;s<n;s++)if(t[e+s]!=i.charCodeAt(s))return!0;return!1}(t,e,"RIFF",4)){for(de(t,e+=4),e+=8;e<t.length;){var o=ue(t,e),l=de(t,e+=4);e+=4;var h=l+(1&l);switch(o){case"VP8 ":case"VP8L":void 0===i.frames[n]&&(i.frames[n]={}),(d=i.frames[n]).src_off=s?a:e-8,d.src_size=r+l+8,n++,s&&(s=!1,r=0,a=0);break;case"VP8X":(d=i.header={}).feature_flags=t[e];var u=e+4;d.canvas_width=1+ce(t,u),u+=3,d.canvas_height=1+ce(t,u),u+=3;break;case"ALPH":s=!0,r=h+8,a=e-8;break;case"ANIM":(d=i.header).bgcolor=de(t,e),u=e+4,d.loop_count=(_=t)[(f=u)+0]<<0|_[f+1]<<8,u+=2;break;case"ANMF":var c,d;(d=i.frames[n]={}).offset_x=2*ce(t,e),e+=3,d.offset_y=2*ce(t,e),e+=3,d.width=1+ce(t,e),e+=3,d.height=1+ce(t,e),e+=3,d.duration=ce(t,e),e+=3,c=t[e++],d.dispose=1&c,d.blend=c>>1&1}"ANMF"!=o&&(e+=h)}var _,f;return i}},window.ApicTools={parseGIF:t,decompressFrames:e},console.log("Using JsView HTML Forge");export default{};
|