@shijiu/jsview-vue 0.9.490 → 0.9.500
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dom/bin/jsview-browser-debug-dom.min.js +1 -1
- package/dom/bin/jsview-dom.min.js +1 -1
- package/dom/target_core_revision.js +3 -3
- package/package.json +1 -1
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +4 -1
- package/samples/NinePatchDemo/assets/border.png +0 -0
- package/scripts/jsview-post-build.js +6 -1
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +2 -0
- package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +2 -0
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +23 -6
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +25 -12
- package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +19 -8
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +1 -1
- package/utils/JsViewVueWidget/JsvGrid.vue +1 -1
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +12 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
/* eslint-disable */ import{parseGIF as e,decompressFrames as t}from"gifuct-js";void 0===window.Forge&&(window.Forge={});var i=window.Forge;class s{static getTextPixelWith(e,t){null===s.sCanvas&&(s.sCanvas=window.originDocument.createElement("canvas"));const i=s.sCanvas.getContext("2d");i.font=t;const n=i.measureText(e);return Math.ceil(n.width)}static GetTextWidth(e){let t="";e.bold&&(t="bold");let i="";return e.italic&&(i="italic"),this.getTextPixelWith(e.str,`${t} ${i} ${e.size}px ${e.font}`)}static GetTextRect(e,t,i,s,n){let r=Math.ceil(i.size*e.length/t.width)*n;r>t.height&&(r=t.height);return{width:t.width,height:r}}static GetCursorOffset(e,t,i,s,n,r,a){let o="";i.bold&&(o="bold");let l="";i.italic&&(l="italic");let h=0;if("right"===i.alignment){const s=this.getTextPixelWith(e,`${o} ${l} ${i.size}px ${i.font}`);(r-=t.width-s)<0&&(r=0)}let c=0;for(;r>=c&&h!==e.length;)c=this.getTextPixelWith(e.substr(0,h+1),`${o} ${l} ${i.size}px ${i.font}`),r>=c&&h++;return h}static GetCursorPosition(e,t,i,s,n,r){let a="";i.bold&&(a="bold");let o="";i.italic&&(o="italic");let l=0,h=e;if(r<e.length&&(h=h.substr(0,r)),l=this.getTextPixelWith(h,`${a} ${o} ${i.size}px ${i.font}`),"right"===i.alignment){const s=this.getTextPixelWith(e,`${a} ${o} ${i.size}px ${i.font}`);l=t.width-s+l}return{x:l,y:0}}}s.sCanvas=null,window.PlatformUtils=s;class n{constructor(e){this.state={},this.type=e,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(e){void 0!==e&&(this._AutoPlay=!0,this.Ele.paused&&setTimeout((()=>{this.play()}),0))}get currentTime(){return this.Ele.currentTime}set currentTime(e){this.Ele.currentTime=e,this.setState("seek",e,"number")}get duration(){return this.Ele.duration}set loop(e){this.Ele.loop="boolean"==typeof e||void 0!==e}get muted(){return this.getState("muted")}set muted(e){this.setState("muted",e,"boolean")}get paused(){return this.Ele.paused}get playbackRate(){return this.getState("playbackRate")}set playbackRate(e){this.setState("playbackRate",e,"number")}set src(e){this.setState("src",e,"string"),e&&this._AutoPlay&&setTimeout((()=>{this.play()}),0)}get style(){const e=this;return{set bottom(t){e.setState("style",`{"bottom":"${t}"}`,"string")},set left(t){e.setState("style",`{"left":"${t}"}`,"string")},set right(t){e.setState("style",`{"right":"${t}"}`,"string")},set top(t){e.setState("style",`{"top":"${t}"}`,"string")},set height(t){e.setState("style",`{"height":"${t}"}`,"string")},set width(t){e.setState("style",`{"width":"${t}"}`,"string")}}}get volume(){return this.getState("volume")}set volume(e){this.setState("volume",e,"number")}get playableDuration(){return this.Ele.playableDuration}addEventListener(e,t){this[`on${e}`]=t,this.Ele.addEventListener(e,(t=>{this[`on${e}`](t)}))}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(e,t,i){typeof t===i?("playbackRate"==e?this.Ele.playbackRate=t:this.Ele.setAttribute(e,t),this.state[e]=t,console.log(`set ${e} = ${t}`)):console.warn(`invalid paramter type to set ${e}. value is not ${i}`)}getState(e){let t=this.state[e];return console.log(`get ${e} = ${t}`),void 0===t&&(t=this.Ele.getAttribute(e),this.state[e]=t),t}onEnd(e){this.setState("paused",!0,"boolean"),this.hasOwnProperty("onended")&&this.onended()}onError(e){this.hasOwnProperty("onerror")&&this.onerror(e.currentTarget.error.code)}mediaHandler(){return this.Ele}static setDesignMapWidth(e){"number"==typeof e?n.prototype.designMapWidth=e:console.warn(`Invalid paramter type to set ${e}. It is not number.`)}}n.prototype.designMapWidth=0;class r extends n{constructor(e){super(e),super.buildPlatformInstance(e)}}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(e){this.style.height=e,this.state.height=e}get poster(){return console.log("Video.poster() TODO"),null}set poster(e){console.log("Video.poster() TODO")}get videoAspectRatio(){return this.getState("aspectRatio")}set videoAspectRatio(e){this.setState("aspectRatio",e,"string")}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}get width(){return this.getState("width")}set width(e){this.style.width=e,this.state.width=e}onLoad(e){super.onLoad(e)}setRotation(e,t,i,s){let n=function(){let n=`rotate3d(0, 0, 1, ${e}deg)`;if(90==e||-90==e){let e,r;if(s?(e=i/t,r=t/i):(e=this.videoHeight/this.videoWidth,r=this.videoWidth/this.videoHeight),isNaN(e)||isNaN(r))return!1;n+=` scale3d(${e}, ${r}, 1)`}return this.Ele.style.transform=n,this.Ele.parentNode&&(this.Ele.parentNode.style.overflow="hidden"),!0};n=n.bind(this);n()||this.Ele.addEventListener("loadedmetadata",(()=>{n()}))}}window._ExtVideo=o;class l extends n{constructor(){super("video"),this._ReleaseCallbacks=[],this._ResourceTerminater=null,super.buildPlatformInstance()}setResourceTerminator(e){this._ResourceTerminater=e}hasTerminator(){return null!==this._ResourceTerminater}listenToRelease(e){this._ReleaseCallbacks.push(e)}unload(){super.unload(),null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}releaseResource(){for(let e=0;e<this._ReleaseCallbacks.length;e++)this._ReleaseCallbacks[e]();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(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){const t=e.indexOf("(")+1,i=e.lastIndexOf(")");e=e.substring(t,i).trim()}if(!0===e.startsWith("data:"))return void(this.href=e);if(!0===e.startsWith("/")&&(e=document.location.origin+e),!0===e.startsWith("./")){const t=document.location.pathname.lastIndexOf("/");let i="";t>0&&(i=document.location.pathname.substring(0,t)),e=document.location.origin+i+e.substring(1)}if(this.href=e,!t)return;let i=this.href.indexOf("?");const s=i>0?this.href.substring(0,i):this.href;this.search=i>1?this.href.substring(i):"",i=s.indexOf("://"),this.protocol=i>0?s.substring(0,i+1):"";const n=i>1?s.substring(i+3):"";i=n.indexOf("/"),this.host=i>0?n.substring(0,i):"",this.pathname=i>1?n.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(e){this.href=e}}const c=window.AudioContext||window.webkitAudioContext;if(c){const e=new c;let t=0,i=0;class s{constructor(e,t,i){this._Context=e,this._BufferSource=t,this._Gain=i,this._BufferSource.connect(this._Gain),this._Gain.connect(this._Context.destination)}start(e,t,i){this._BufferSource.start(e,t,i)}setVolume(e){this._Gain.gain.setValueAtTime(e,this._Context.currentTime)}stop(e){this._BufferSource.stop(e)}}class n{constructor(){this._SoundBufferMap={},this._StreamMap={}}load(i,s,n,r){const a=new h(i).href,o=t++;return this._requestBuffer(a,((t,i)=>{0===t?e.decodeAudioData(i,(e=>{this._SoundBufferMap[o]=e,r(o,0)})):r(-1,-1)})),o}unload(e){delete this._SoundBufferMap[e]}autoPause(){}autoResume(){}play(t,n,r,a,o,l){if(this._SoundBufferMap[t]){const r=i++,a=e.createBufferSource();a.buffer=this._SoundBufferMap[t],a.playbackRate.value=l,a.onended=e=>{this.stop(r)},o>0&&(a.loop=!0);const h=e.createGain();h.gain.setValueAtTime(n,e.currentTime);const c=new s(e,a,h);return this._StreamMap[r]=c,console.log("loop test",(o+1)*this._SoundBufferMap[t].duration),c.start(0,0,(o+1)*this._SoundBufferMap[t].duration),r}return-1}pause(e){}resume(e){}stop(e){this._StreamMap[e]&&(this._StreamMap[e].stop(),delete this._StreamMap[e])}release(){this._SoundBufferMap={},this._StreamMap={}}setVolume(e,t,i){this._StreamMap[e]&&this._StreamMap[e].setVolume(t)}setPriority(e,t){}setRate(e,t){}setLoop(e,t){}_requestBuffer(e,t){const i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200===i.status?(console.log("http request succeed"),t(0,i.response)):(console.error(`download audio ${e} failed.`,i.status),t(-1,null))},i.send()}}window.SoundPool=n}else window.SoundPool=null;i.LogF=function(e){},i.LogE=function(e){},i.LogW=function(e){},i.LogI=function(e){},i.LogD=function(e){},i.LogM=function(e){},i.ThrowError=function(e){throw new Error(e)},i.Assert=function(e){if(!e)throw new Error("ASSERT!!!!!")},i.EnableLog=function(e){i.LogM=console.log.bind(console),e>0&&(i.LogF=console.error.bind(console)),e>1&&(i.LogE=console.error.bind(console)),e>2&&(i.LogW=console.warn.bind(console)),e>3&&(i.LogI=console.log.bind(console)),e>4&&(i.LogD=console.debug.bind(console))};i.RectArea=class{constructor(e,t,i,s){this.x="number"==typeof e?e:0,this.y="number"==typeof t?t:0,("number"!=typeof i||i<0)&&(i=0),this.width=i,("number"!=typeof s||s<0)&&(s=0),this.height=s}Equals(e){return null!==e&&(e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height)}};i.Coordinate=class{constructor(e,t){this.x=e,this.y=t}};i.Size=class{constructor(e,t){this.width=e,this.height=t}};i.RectUtils=class{FormatRectArea(e){let t=null;if(e instanceof i.RectArea)t=e;else if("object"==typeof e&&null!==e){if(isNaN(e.width)||isNaN(e.height))throw new Error("ERROR: target_size format should be {width:XXXX, height:XXXX}");t=new i.RectArea(0,0,e.width,e.height)}return t}},i.sRectUitls=new i.RectUtils,i.TextShaderType={LinearGradient:0,Image:1};i.TextShader=class{constructor(e,t){this.Type=e,this.Params=t}};class u{constructor(){const e=(new i.LayoutView).GetRenderer();this._Renderer=e,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(e){return this.IsInstantLoad=e,this}SetStringWithFont(e){return this.StringWithFont=e,this}SetLatexMode(e){return this.LatexMode=e,this}SetFontStyle(e,t,s,n,r,a,o,l,h,c){return this.StringWithFont="object"==typeof e?i.sTextUtils.StringWithFont("",void 0!==e.size?e.size:10,void 0!==e.font?e.font:"宋体",void 0!==e.hAlign?e.hAlign:"center",void 0!==e.vAlign?e.vAlign:"middle",void 0!==e.textColor?e.textColor:"#000000",void 0!==e.italic&&e.italic,void 0!==e.bold&&e.bold,void 0!==e.shadow?e.shadow:null,void 0!==e.strokeWidth?e.strokeWidth:null,void 0!==e.vAreaAlign?e.vAreaAlign:"top"):i.sTextUtils.StringWithFont("",e,t,s,n,r,a,o,l,h,c),this}SetRectArea(e){return e instanceof i.RectArea?this.RectArea=e:this.RectArea=new i.RectArea(e.x,e.y,e.width,e.height),this}SetViewSize(e){return e instanceof i.RectArea||(e=new i.RectArea(e.x,e.y,e.width,e.height)),this.SetRectArea(e),0===this.LineHeight&&0!==e.height&&(this.LineHeight=e.height),this}SetTextAttr(e){let t,i;return t=e.hasOwnProperty("textOverflow")?e.textOverflow:e.hasOwnProperty("text_overflow")?e.text_overflow:"clip",i=e.hasOwnProperty("wordWrap")?e.wordWrap:e.hasOwnProperty("word_wrap")?e.word_wrap:"none",this.TextAttr={word_wrap:i,text_overflow:t},this}SetMarquee(e){return e&&(this.Marquee={repetition:"infinite",direction:"left",speed:"normal"},e.repetition&&(this.Marquee.repetition=e.repetition),e.direction&&(this.Marquee.direction=e.direction),e.speed&&(this.Marquee.speed=e.speed)),this}SetShader(e){return this.Shader=e,this}SetLineHeight(e){return this.LineHeight=e,this}EnableDuplicateBuilder(){this.BuildCopyBag=!0}Clone(){const e=new u(null);return e.StringWithFont=this.StringWithFont,e.RectArea=this.RectArea,e.TextAttr=this.TextAttr,e.LineHeight=this.LineHeight,e}}i.TextViewParams=u,window.TextViewParams=i.TextViewParams;class d{constructor(e,t,s,n,r){this._layoutView=null,this._textWidth=0,this._textViewReahHeight=0,this._marqueeRunning=!0,this._marqueePause=!1,this._marqueeCurrentNum=2,this._textView=null,this._TextViewParams=t,this._NeedQuick=void 0!==n&&n,this._marquee=t.Marquee,this._rectArea=t.RectArea,this._DrawCount=0,this._ShowInterval=0,this._TextureManager=e,this._LatexMode=t.LatexMode,this._Shader=t.Shader,this._IsInstantLoad=t.IsInstantLoad?1:0,this._AutoHeight=!1,this._EnableTextureOnloadCallback=!!r,this._DuplicateBag=t.BuildCopyBag?{Set:null,Swf:null,Siz:null}:null;const a=this;let o=null;const l=t.RectArea.width,h=t.RectArea.height;let c=null,u=null;null!==this._marquee?(u=new i.ClipView,u.Init(),u.SetClipRect(0,0,l,h,!0),u.SetId("matrixClipLayoutview"),u.OnDettachFromSystem=function(){a._marqueeRunning=!1,i.ClipView.prototype.OnDettachFromSystem.call(this)}):(u=new i.LayoutView,u.OnDettachFromSystem=function(){this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null)}),o=u.GetRenderer(),this._Renderer=o;let d=s;d||(d=t.StringWithFont.str),d=this._ConvertEscToString(d);let f=!1;t.StringWithFont.italic.length>0&&(f=!0);let g=!1;t.StringWithFont.bold.length>0&&(g=!0),c=i.sTextUtils.StringWithFont(d,t.StringWithFont.size,t.StringWithFont.font,t.StringWithFont.alignment,t.StringWithFont.vertical_align,t.StringWithFont.textColour,f,g,t.StringWithFont.shadow,t.StringWithFont.stroke_width,t.StringWithFont.vertical_area_align),void 0!==t.Marquee&&null!==t.Marquee?this._textWidth=i.sTextUtils.GetTextWidth(c):this._NeedQuick?this._textWidth=t.RectArea.width-2*t.RectArea.x:this._textWidth=i.sTextUtils.GetTextWidth(c),this.addTextView(u,c,t.TextAttr,t.RectArea,t.Marquee,t.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=u,this._TextTexture=null,this._MarqueeTimer=null}_ConvertEscToString(e){let t=`${e}`;return-1!==t.indexOf(""")&&(t=t.replace(/"/gi,'"')),-1!==t.indexOf("&")&&(t=t.replace(/&/gi,"&")),-1!==t.indexOf("<")&&(t=t.replace(/</gi,">")),-1!==t.indexOf(">")&&(t=t.replace(/>/gi,"<")),-1!==t.indexOf(" ")&&(t=t.replace(/ /gi," ")),t}EnableAutoHeight(){this._AutoHeight=!0,this._textView.EnableAutoHeight()}addTextView(e,t,s,n,r,a){const o=n.height;let l;const h=i.Clone(n);let c=null;0!==t.str.length?(l=this._TextureManager.GetTextTextureByMultiRows(t,s,h,a,this._NeedQuick,this._Shader,this._IsInstantLoad,this._LatexMode,this._DuplicateBag),this._TextTexture=l.texture,this._textViewReahHeight=l.real_height,c=new i.LayoutView,c.Init(new i.TextureSetting(l.texture,null,null,!0)),c.SetId(`Text-${t.str}`),"middle"!==t.vertical_area_align&&"bottom"!==t.vertical_area_align||(c.Element.style.display="table-cell",c.Element.style.position="static",e.Element.style.display="table",e.Element.style.position="static"),e.AddView(c,new i.LayoutParams({x:0,y:0,width:h.width,height:o})),this._textView=c):(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(e){e&&null!==this._textView&&this._textView.StartAnimation(e)}}i.TextViewEx=d,i.TextViewControl=d;i.CopiedTextViewEx=class{constructor(e,t,s,n,r){const a={x:0,y:0,width:s.width,height:s.height};this._ContainerView=new i.LayoutView,this._TextView=this._AddTextView(e,t,a,this._ContainerView,n,r)}_AddTextView(e,t,s,n,r,a){let o=null;if(t&&0!==t.length){const l=e.GetCopiedTextTexture(t,s,r,a);o=new i.LayoutView,o.Init(new i.TextureSetting(l,null,null,!0)),t.length<15?o.SetId(`Text-${t}`):o.SetId(`Text-Long${t.length}`),n.AddView(o,new i.LayoutParams({x:0,y:0,width:s.width,height:s.height})),a&&l.RegisterLoadImageCallback(null,a,null)}return o}EnableAutoHeight(){this._TextView&&this._TextView.EnableAutoHeight()}GetLayoutView(){return this._ContainerView}},i.Clone=function(e){return JSON.parse(JSON.stringify(e))},window.Clone=i.Clone;i.PersistTimer=new class{constructor(){this._AlreadyExited=!1,window.PersistTimer&&(this._AlreadyExited=!0)}setTimeout(e,t){return this._AlreadyExited&&window.PersistTimer.setTimeout?window.PersistTimer.setTimeout(e,t):window.setTimeout(e,t)}clearTimeout(e){this._AlreadyExited&&window.PersistTimer.clearTimeout?window.PersistTimer.clearTimeout(e):window.clearTimeout(e)}setInterval(e,t){if(!this._AlreadyExited||!window.PersistTimer.setInterval)return window.setInterval(e,t);window.PersistTimer.setInterval(e,t)}clearInterval(e){this._AlreadyExited&&window.PersistTimer.clearInterval?window.PersistTimer.clearInterval(e):window.clearInterval(e)}};i.ForegroundTimer=new class{setTimeout(e,t){return window.setTimeout(e,t)}clearTimeout(e){window.clearTimeout(e)}setInterval(e,t){return window.setInterval(e,t)}clearInterval(e){window.clearInterval(e)}},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(e){return{T:e,St:null}}};class f extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeIn)}}i.EasingIn=f;class g extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeOut)}}i.EasingOut=g;class m extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeInOut)}}i.EasingInOut=m;class _ extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeDeceleration)}}i.EasingDeceleration=_;class p extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeBlink)}}i.EasingBlink=p;class w extends i.EasingBase{constructor(e,t,i,s,n){super(),this._Inited=!1,this._X1=e,this._X2=i,this._Y1=t,this._Y2=s,this._Duration=n}Package(){const e=this._GetBasePackage(i.EasingTypeBezier);return e.St={X1:this._X1,X2:this._X2,Y1:this._Y1,Y2:this._Y2,Dur:this._Duration},e}}i.BezierEasing=w;class v extends i.EasingBase{constructor(e,t){super(),this._Steps=e,this._Type=t}Package(){const e=this._GetBasePackage(i.EasingTypeSteps);return e.St={S:this._Steps,T:this._Type},e}}i.StepsEasing=v,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 y{constructor(e,t,s){if(this._Manager=e,s){i.sRenderTextureDelegateManager.CreateTextureStatus().SetResourceInfo(s)}this.RenderTexture=i.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(t),this._CallbackIdToken=0,this._OnLoadCallback=[],i.ForgeDebug.EnableTextureTracer&&(e._ImageTextureTracer.push(this),this._TracerDescript="")}get Unloaded(){return null===this.RenderTexture||this.RenderTexture.Unloaded}set Unloaded(e){}get LoadTime(){return null!==this.RenderTexture?this.RenderTexture.LoadTime:0}set LoadTime(e){}get Width(){return null!==this.RenderTexture?this.RenderTexture.Width:0}set Width(e){}get Height(){return null!==this.RenderTexture?this.RenderTexture.Height:0}set Height(e){}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(e,t,s){if(this.IsLoaded()&&null!=t)return this.RenderTexture&&t({width:this.RenderTexture.Width,height:this.RenderTexture.Height},s),null;let n=null;return null!=t&&(n={callback:t,params:s},this._OnLoadCallback.push(n),0===this._CallbackIdToken&&(i.Assert(null!==this.RenderTexture),this._CallbackIdToken=this.RenderTexture.RegisterOnloadCallback(y.prototype._InvokeOnLoadCallbacks.bind(this)))),n}UnregisterLoadImageCallback(e){e&&this._OnLoadCallback.some(((t,i,s)=>{if(t===e)return s.splice(i,1),!0}))}EnableBackgroundLoad(e){}DisableBackgroundLoad(e){}_InvokeOnLoadCallbacks(){const e=this._OnLoadCallback;this._OnLoadCallback=[];for(let t=0;t<e.length;t++){const i=e[t];i.callback(i.params)}this.RenderTexture&&this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}SetTextureTracerDescript(e){this._TracerDescript=e}ReallocRenderTexture(){}}i.ImageTexture=y;class b extends i.ImageTexture{constructor(e,t,s,n,r,a){const o=i.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"IMG");o.Set={URL:t,Siz:n,Clr:r||"",IsF:s?1:0,NtS:a,ILd:0},super(e,o),this.Name="IMG",this.Source=t,this.IsForever=s?1:0,this.TargetSize=n,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=t,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(e){if(this._InstantLoad=e?1:0,this.RenderTexture){const e=this.RenderTexture.GetResourceInfo();null!==e&&(e.Set.ILd=this._InstantLoad,this.RenderTexture.SetResourceInfo(e))}return this}ReallocRenderTexture(){if(this.IsForever)return void i.LogE("ReallocRenderTexture(): NOT need for forever texture");const e=this.Source,t=this.TargetSize,s=this.ColorSpace,n=this.IsForever,r=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Manager.GetId(),this.Name);r.Set={URL:e,Siz:t,Clr:s,IsF:n,ILd:this._InstantLoad},this.RenderTexture=i.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(r),this._Manager.CachedTextureManager.CacheTheTexture(this)}}i.UrlImageTexture=b;class T extends i.ImageTexture{constructor(e,t,s,n,r,a,o,l,h,c,u){const d=i.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"TST");let f=null;u&&(f={x:0,y:0,w:0,h:0},Object.assign(f,u)),d.Set={ST:t,IDS:s.GetIdsPack(),W:Math.floor(r.width+.5),H:Math.floor(r.height+.5),FS:a,LA:h,EM:c,LH:Math.floor(o+.5),ILD:l?1:0,TLC:n?1:0,EA:f},super(e,d),this.Name="TST",this._TextStylePack=s,s.DoRef()}UnloadTex(){this._TextStylePack.UnRef(),super.UnloadTex()}}i.TextStyleTexture=T;i.CachedTextureManager=class{constructor(e){this._TextureManager=e,this._Renderer=e.GetRenderer(),this._CachedTextureStack=[],this._LockedTextureStack=[],this._MemoryLimited=10485760,this._VisibleMark=1}SetMemoryLimited(e){this._MemoryLimited=1024*e*1024}_FindTexture(e,t,i){for(let s=this._CachedTextureStack.length-1;s>=0;s--){const n=this._CachedTextureStack[s];if(n.Source===e&&(t===n.TargetSize||null!==t&&t.Equals(n.TargetSize))&&i===n.ColorSpace){if(null===n.RenderTexture)continue;return n}}return null}CacheTheTexture(e){for(let t=this._CachedTextureStack.length-1;t>=0;t--)if(e===this._CachedTextureStack[t])return;this._CachedTextureStack.push(e)}_MarkVisibleViewTextures(e,t){e.TextureSetting&&e.TextureSetting.Texture&&(e.TextureSetting.Texture.VisibleMark=t);const i=e.ChildViews.length;for(let s=0;s<i;s++){const i=e.ChildViews[s];i&&"VISIBLE"!==i.Visibility||this._MarkVisibleViewTextures(i,t)}}ReduceInvisibleTexture(e){this._MarkVisibleViewTextures(e,++this._VisibleMark);for(let e=0;e<this._CachedTextureStack.length;e++){const t=this._CachedTextureStack[e];t.VisibleMark!==this._VisibleMark&&(t.UnloadTex(),this._CachedTextureStack.splice(e,1),e--)}}GetCacheSize(){return this._CachedTextureStack.length}};const S=new Map;let C=0;const E=new Map;let x=0;class I{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=I.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(e,t,i){return this.GetImage(e,t,i)}GetImage(e,t,s){if(!e)return i.LogI("GetImage, url is null!"),null;return this._GetImageInternal(e,null,i.ColorSpace.RGBA_8888,t,!1,s)}GetImage2(e,t,s,n,r){if(!e)return i.LogI("GetImage2, url is null!"),null;const a=i.sRectUitls.FormatRectArea(s);"string"!=typeof n&&(n=e.indexOf(".pkm")>=0?e.indexOf(".pkma")>=0?i.ColorSpace.RGBA_ETC1:i.ColorSpace.RGB_ETC1:i.ColorSpace.RGB_565);return this._GetImageInternal(e,a,n,t,!1,r)}_GetImageInternal(e,t,s,n,r,a){if(n){const i=this._ForeverCachedTextureManager._FindTexture(e,t,s);if(i)return i}else{const i=this.CachedTextureManager._FindTexture(e,t,s);if(i)return i}const o=new i.UrlImageTexture(this,e,n,t,s,a);return o.IsForever?this._ForeverCachedTextureManager.CacheTheTexture(o):this.CachedTextureManager.CacheTheTexture(o),o}GetRoundCornerMask(e,t){return this.GetCustomCornerMask(e,t,t,t,t)}GetCustomCornerMask(e,t,s,n,r){const a=i.sRectUitls.FormatRectArea(e),o=Math.max(t,s,n,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:t,RT:s,LB:n,RB:r};const h=new i.ImageTexture(this,l);return i.ForgeDebug.EnableTextureTracer&&h.SetTextureTracerDescript("CornerMask"),h}GetOneCornerMask(e){const t=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"OCM");t.Set={Rad:e};const s=new i.ImageTexture(this,t);return i.ForgeDebug.EnableTextureTracer&&s.SetTextureTracerDescript("OneCornerMask"),s}GetTextTextureFromStylePack(e,t,s,n,r,a,o,l,h,c){return e&&0!==e.length?new i.TextStyleTexture(this,e,t,s,n,r,a,o,l,h,c):null}_getParamsId(e,t,i){const s=e.font,n=e.size,r=e.italic,a=e.bold,o=e.alignment,l=e.vertical_align,h=e.vertical_area_align,c=e.textColour,u=e.backgroundColour,d=e.shadow;let f="";e.stroke_width&&(f=e.stroke_width);const g=t.text_overflow,m=t.word_wrap,_=[s,r,a,d,f].join(":"),p=[n,o,l,h,g,m].join(":");let w="",v="";return S.has(_)?w=S.get(_):(w=`TS${C}`,S.set(_,w),C++),E.has(p)?v=E.get(p):(v=`DS${x}`,E.set(p,v),x++),[w,v,c,u]}GetTextTextureByMultiRows(e,t,s,n,r,a,o,l,h){const c=e.str;if(null===c||0===c.length)return null;const u=i.sRenderBridge.GetScreenInfo().scaleRatio,d=Object.assign(s);d.x*=u,d.y*=u,d.width*=u,d.height*=u;const f=Object.assign(e);f.size=Math.ceil(f.size*u),n*=u;const g={ST:e.str,AT:JSON.stringify({TO:t.text_overflow,WW:t.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(n+.5,10),ILD:void 0!==o?o:1};if(a&&(g.SH=JSON.stringify({T:a.Type,P:a.Params})),void 0!==window.JsView&&void 0!==window.JsView.ForgeNativeRevision&&window.JsView.ForgeNativeRevision>0){const e=this._getParamsId(f,t,a);g.PI={FS:e[0],DS:e[1],TC:e[2],BC:e[3]}}const m=this._BuildTextTextureAndSerialStatus(g,f);if(null!==h){const e=Object.assign({},g);e.ST=null,e.TLC=0,h.Set=e,h.Swf=Object.assign({},f)}let _=d.height;if(void 0!==window.PlatformUtils&&!1===r){_=window.PlatformUtils.GetTextRect(c,d,f,t,n).height}if(_=Math.floor(_/u+.5),i.ForgeDebug.EnableTextureTracer){let t=e.str;t.length>8&&(t=`${e.str.substr(0,8)}...`),m.SetTextureTracerDescript(`[${t}]`)}return{texture:m,real_height:_}}GetCopiedTextTexture(e,t,s,n){const r=Object.assign({},s.Set);r.ST=e,r.TLC=void 0!==n&&n?1:0;const a=s.Swf,o=i.sRenderBridge.GetScreenInfo().scaleRatio;r.RA=JSON.stringify({X:parseInt(t.x*o+.5,10),Y:parseInt(t.y*o+.5,10),W:parseInt(t.width*o+.5,10),H:parseInt(t.height*o+.5,10)});const l=this._BuildTextTextureAndSerialStatus(r,a);if(i.ForgeDebug.EnableTextureTracer&&e){let t=e;t.length>8&&(t=`${e.substr(0,8)}...`),l.SetTextureTracerDescript(`[${t}]`)}return l}_BuildTextTextureAndSerialStatus(e,t){i.sRenderTextureDelegateManager.AppendFontStatusIfNeed(e,t);let s=null;e.FO&&(s={STA:{Nam:"T",Sta:e.FO}});const n=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"T");return n.Set=e,new i.ImageTexture(this,n,s)}GetColorTexture(e){const t=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CT");t.Set={Clr:e};const s=new i.ImageTexture(this,t);return i.ForgeDebug.EnableTextureTracer&&s.SetTextureTracerDescript(`Color[${e}]`),s}ScavengerCached(){this.CachedTextureManager.GetCacheSize()>=this._CacheMaxSize&&this.CachedTextureManager.ReduceInvisibleTexture(i.sRootView)}GetOffScreenMediaTexture(e){if(void 0===window.OffscreenVideoPlayer||!(e instanceof window.OffscreenVideoPlayer))return null;if(!e.hasTerminator()){const t=this._BuildVideoTexture(e);e.setResourceTerminator((()=>{t.UnloadTex()}))}return this._BuildVideoTexture(e)}_BuildVideoTexture(e){const t=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"VPLY");t.Set={Hdl:e.mediaHandler()};const s=new i.ImageTexture(this,t);return i.ForgeDebug.EnableTextureTracer&&s.SetTextureTracerDescript(`Video[${e.mediaHandler()}]`),s}}I.sTextureManagerToken=100,i.TextureManager=I,window.TextureManager=i.TextureManager;i.LayoutViewDebugClass=class{SetTextureTracer(e){}GetTextureTracer(){return null}},i.ForgeDebug=new i.LayoutViewDebugClass,window.ForgeDebug=i.ForgeDebug;class A{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(e,t,i){this.MarginTop=t,this.MarginLeft=e,i&&(this.Z=i)}SetSize(e,t){this.Width=e,this.Height=t}Clone(){const e=new A(null);return e.Width=this.Width,e.Height=this.Height,e.MarginTop=this.MarginTop,e.MarginLeft=this.MarginLeft,e.MarginRight=this.MarginRight,e.MarginBottom=this.MarginBottom,e.Z=this.Z,e.SizeAdjust=this.SizeAdjust,e}Equals(e){return e.Width===this.Width&&e.Height===this.Height&&e.MarginTop===this.MarginTop&&e.MarginLeft===this.MarginLeft&&e.MarginRight===this.MarginRight&&e.MarginBottom===this.MarginBottom&&e.Z===this.Z}}i.LayoutParamsBase=A;class R extends i.LayoutParamsBase{constructor(e){super(),e instanceof i.RectArea&&(e={x:e.x,y:e.y,width:e.width,height:e.height}),e&&(e.x?this.MarginLeft=e.x:e.marginLeft&&(this.MarginLeft=e.marginLeft),e.y?this.MarginTop=e.y:e.marginTop&&(this.MarginTop=e.marginTop),e.z&&(this.Z=e.z),e.width&&(this.Width=e.width),e.height&&(this.Height=e.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=R,window.LayoutParams=i.LayoutParams;i.RenderTextureDelegateManager=class{constructor(){this._IdTokenGenerator=66,i.sRenderTextureDelegateManager=this,this._CheckExpiredTime=0}CreateTextureHeadStatus(){const e=new i.RenderTextureDelegate(this,0);return e.DoRef(),e}CreateTextureStatus(){const e=new i.RenderTextureDelegate(this,0);return e.DoRef(),e}CreateTexture(){const e=new i.RenderTextureDelegate(this,this._IdTokenGenerator++);return e.DoRef(),e}RecycleTexture(e){}CreateResourceInfo(e,t){return{Id:0,Nam:t,Set:null,TmId:e,NdLd:0}}AppendFontStatusIfNeed(e,t){const i={};i.Fo=t.font,i.Si=t.size,i.It=t.italic,i.Bo=t.bold,i.Al=t.alignment,i.Ve=t.vertical_align,i.Vaa=t.vertical_area_align,i.Tx=t.textColour,i.Ba=t.backgroundColour,i.En=t.enableBlend,i.Sh=t.shadow,t.stroke_width?i.Stk=t.stroke_width:i.Stk=-1,e.FO=JSON.stringify(i)}},i.sRenderTextureDelegateManager=new i.RenderTextureDelegateManager;i.RenderTextureDelegate=class{constructor(e,t){this.IdToken=t,this._Manager=e,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 e=new Error;this.Stack=e.stack}}DoRef(){this._Reference++}UndoRef(){this._Reference--,0===this._Reference&&(this._OnloadCallbacksSize>0&&(this._OnloadCallbacks={}),this._Manager.RecycleTexture(this))}SetResourceInfo(e){e.Id=this.IdToken,this._SyncingResourceInfo=e}GetResourceInfo(){return this._SyncingResourceInfo}ReadSyncInfo(){const e=this._SyncingResourceInfo;return this._SyncingResourceInfo=null,e}RegisterOnloadCallback(e){const t=this._OnloadCallbackIdGenerator++;return this._OnloadCallbacks[`${t}`]=e,this._OnloadCallbacksSize++,null!==this._SyncingResourceInfo&&(this._SyncingResourceInfo.NdLd=1),t}UnregisterOnloadCallback(e){delete this._OnloadCallbacks[`${e}`],this._OnloadCallbacksSize--}InvokeOnloadCallbacks(){if(this._OnloadCallbacksSize>0)for(const e in this._OnloadCallbacks)this._OnloadCallbacks.hasOwnProperty(e)&&this._OnloadCallbacks[e]()}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}};i.DeprecatedRenderer=class{constructor(){i.sDeprecatedRenderer=this,this._SharedTextureManager=this.CreateTextureManager()}SetUserId(e){i.sRenderBridge.UpdateUserId(e)}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(e,t,s,n){return new i.RectArea(e,t,s,n)}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 P={STRING:Symbol("STRING"),FUNCTION:Symbol("FUNCTION"),LINE_FEED:Symbol("LINE_FEED"),LEFT_BRACE:Symbol("LEFT_BRACE"),RIGHT_BRACE:Symbol("RIGHT_BRACE")};const O={},L={BASE:Symbol("BASE"),COLOR:Symbol("COLOR"),BOLD:Symbol("BOLD"),ITALIC:Symbol("ITALIC"),DECORATION:Symbol("DECORATION"),SUPERSCRIPT:Symbol("SUPERSCRIPT"),SUBSCRIPT:Symbol("SUBSCRIPT")};class D{constructor(){this.style,this.styleValue=""}}class k{constructor(){this.textStyle=new D,this.childNodes=[],this.parent}}class M extends k{constructor(){super(),this.styleList=[],this.indexPair,this.lineFeedNode=!1,this.testValue}}function F(e){if(null===e||0===e.length)return null;const t=function(e){const t=[];let i=0;for(;i<e.length;)if("\\"===e[i])if(i<e.length-1)if("\\"===e[i+1]||"{"===e[i+1]||"}"===e[i+1]){const e={type:P.STRING,indexPair:[i+1,i+2]};t.push(e),i+=2}else{++i;const s=i;let n=i,r=!1;for(;i<e.length&&"{"!==e[i]&&"}"!==e[i];)" "!==e[i]&&(r=!0)," "===e[i]&&r?++i:n=++i;const a={type:P.FUNCTION,indexPair:[s,n]};t.push(a)}else console.error("backslash at end.");else if("{"===e[i]){const e={type:P.LEFT_BRACE,indexPair:null};t.push(e),++i}else if("}"===e[i]){const e={type:P.RIGHT_BRACE,indexPair:null};t.push(e),++i}else if("\n"===e[i]){const e={type:P.LINE_FEED,indexPair:null};t.push(e),++i}else{const s=i;let n=i;for(;i<e.length&&"\\"!==e[i]&&"{"!==e[i]&&"}"!==e[i]&&"\n"!==e[i];)++i,n=i;const r={type:P.STRING,indexPair:[s,n]};t.push(r)}for(let i=t.length-1;i>=0;i--){const s=t[i];if(s.type===P.STRING){let n=!0;for(let t=s.indexPair[0];t<s.indexPair[1];t++)if(" "!==e[t]){n=!1;break}!(n&&i>0&&i<t.length-1)||t[i-1].type!==P.LEFT_BRACE&&t[i-1].type!==P.RIGHT_BRACE||t[i+1].type!==P.RIGHT_BRACE&&t[i+1].type!==P.LEFT_BRACE||t.splice(i,1)}}return t}(e),i=[],s=[];let n=0;for(;n<t.length;){const r=t[n];if(r.type===P.STRING){const e=new M;s.push(e),e.indexPair=r.indexPair,e.textStyle.style=L.BASE,i.push(e)}else if(r.type===P.LINE_FEED){const e=new M;s.push(e),e.lineFeedNode=!0}else if(r.type===P.LEFT_BRACE)i.push(O);else if(r.type===P.RIGHT_BRACE)if(i.length>0){const e=[];let t=i.pop();for(;t!==O&&(e.push(t),i.length>0);)t=i.pop();if(i.length>0){const t=i[i.length-1];if(t.textStyle.style===L.BASE)console.error("lack of function");else for(;e.length>0;){const i=e.pop();t.childNodes.push(i),i.parent=t}}else console.error("lack of function")}else console.error("extra }");else if(r.type===P.FUNCTION){const s=e.substring(r.indexPair[0],r.indexPair[1]),a=new k;switch(s){case"textcolor":if(n<t.length-3){a.textStyle.style=L.COLOR;const i=t[n+1],s=t[n+2],r=t[n+3];i.type===P.LEFT_BRACE&&s.type===P.STRING&&r.type===P.RIGHT_BRACE?(a.textStyle.styleValue=e.substring(s.indexPair[0],s.indexPair[1]),n+=3):console.error("textcolor param format error.")}else console.error("textcolor param format error.");break;case"textb":a.textStyle.style=L.BOLD;break;case"texti":a.textStyle.style=L.ITALIC;break;case"textdecoration":if(n<t.length-3){a.textStyle.style=L.DECORATION;const i=t[n+1],s=t[n+2],r=t[n+3];i.type===P.LEFT_BRACE&&s.type===P.STRING&&r.type===P.RIGHT_BRACE?(a.textStyle.styleValue=e.substring(s.indexPair[0],s.indexPair[1]),n+=3):console.error("textdecoration param format error.")}else console.error("textdecoration param format error.");break;case"textsup":a.textStyle.style=L.SUPERSCRIPT;break;case"textsub":a.textStyle.style=L.SUBSCRIPT;break;default:console.error(`undefined style type: ${s}`)}i.push(a)}++n}return s.forEach(((e,t,i)=>{let s=e.parent;for(;s;)e.styleList.push(s.textStyle),s=s.parent})),{nodeList:s,text:e}}function V(){this.positionQueue=[],this.timeQueue=[]}V.prototype.reset=function(){this.positionQueue=[],this.timeQueue=[]},V.prototype.pruneQueue=function(e){for(;this.timeQueue.length&&this.timeQueue[0]<Date.now()-e;)this.timeQueue.shift(),this.positionQueue.shift()},V.prototype.updatePosition=function(e){this.positionQueue.push(e),this.timeQueue.push(Date.now()),this.pruneQueue(50)},V.prototype.getVelocity=function(){this.pruneQueue(1e3);const e=this.timeQueue.length;if(e<2)return 0;const t=(this.timeQueue[e-1]-this.timeQueue[0])/1e3,i=this.positionQueue[e-1]-this.positionQueue[0];return console.log(`getVelocity distance:${i}, time:${t}, velocity:${i/t}, this.timeQueue[length-1]:${this.timeQueue[e-1]}, this.timeQueue[0]:${this.timeQueue[0]}`),i/t};class j{constructor(e,t){this.set(e,t)}add(e,t){return e instanceof j?(this.x+=e.x,this.y+=e.y):(this.x+=e||0,this.y+=t||0),this}angle(e){if(void 0!==e)return this.set(this.length(),0).rotate(e);let t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t}angleDeg(e){return void 0!==e?this.angle(e/180*Math.PI):180*this.angle()/Math.PI}clone(){return new j(this.x,this.y)}cross(e,t){return e instanceof j?this.x*e.y-this.y*e.x:this.x*t-this.y*e}distance(e,t){const i=this.distanceSq(e,t);if(void 0!==i)return Math.sqrt(i)}distanceSq(e,t){let i,s;if(e instanceof j)i=e.x-this.x,s=e.y-this.y;else{if(void 0===t)return;i=e-this.x,s=t-this.y}return i*i+s*s}dot(e,t){return e instanceof j?this.x*e.x+this.y*e.y:this.x*e+this.y*t}equals(e,t,i){return e instanceof j?(t=t||0,Math.abs(this.x-e.x)<=t&&Math.abs(this.y-e.y)<=t):void 0!==t&&(i=i||0,Math.abs(this.x-e)<=i&&Math.abs(this.y-t)<=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(e){const t=Math.cos(e),i=Math.sin(e);return this.set(this.x*t-this.y*i,this.x*i+this.y*t)}rotateDeg(e){return this.rotate(e/180*Math.PI)}scale(e,t){return this.x*=e,this.y*=t||e,this}set(e,t){return e instanceof j?(this.x=e.x,this.y=e.y):(this.x=e||0,this.y=t||0),this}setPolar(e,t){return this.set(t,0).rotate(e)}setPolarDeg(e,t){return this.setPolar(e/180*Math.PI,t)}sub(e,t){return void 0!==t?(this.x-=e,this.y-=t):(this.x-=e.x,this.y-=e.y),this}toString(){return`(${this.x}, ${this.y})`}}function N(e,t,i){return i=i||0,Math.abs(e-t)<Math.abs(i)}const G={isEqual:N,isZero:(e,t)=>N(e,0,t),clamp:(e,t,i)=>e>t?e<i?e:i:t},B=G.isZero,U=G.clamp,W=new j(0,0);function H(e){return"[object Array]"===Object.prototype.toString.call(e)}function $(e){if(!H(e))throw new Error("Polygon must be an array of points");switch(typeof e[0]){case"number":{if(e.length%2!=0)throw new Error("Polygon that contains array of numbers must has even length ([x0, y0, x1, y1, ...., xn, yn])");const t=[];for(let i=0;i<e.length;i+=2)t.push(new j(e[i],e[i+1]));return t}case"object":return e.map(H(e[0])?e=>new j(e[0],e[1]):e=>new j(e.x,e.y));default:throw new Error("Passed polygon is not an array of 2D coordinates")}}function K(e){if(1===e.length)return new j(e[0]);const t=new j(0,0);e.forEach((e=>t.add(e))),t.scale(1/e.length);const i=new j;let s=0;return e.forEach(((n,r)=>{const a=new j(n),o=new j(r+1===e.length?e[0]:e[r+1]);a.add(-t.x,-t.y),o.add(-t.x,-t.y);const l=.5*a.cross(o);s+=l,i.add(a.add(o).scale(.3333333333333333).scale(l))})),B(s,1e-4)?i.set(e[0]):i.scale(1/s).add(t)}function Y(e,t){let i=e[0],s=t.dot(e[0]),n=0;for(let r=1;r<e.length;r++)n=t.dot(e[r]),n>s&&(s=n,i=e[r]);return new j(i)}function z(e,t,i){const s=Y(e,i),n=Y(t,i.negate());return new j(s.sub(n))}function X(e,t){const i=new j(0,0),s=new j(e).negate(),n=new j(t).sub(e),r=n.dot(n);if(B(r,1e-4))return i.set(e);let a=s.dot(n)/r;return a=U(a,0,1),i.set(n.scale(a).add(e))}function J(e,t){e=$(e),t=$(t);const i=K(e),s=K(t).add(i.negate());let n,r,a;n=z(e,t,s),r=z(e,t,s.negate());for(let i=0;i<30;i++){const i=X(n,r);if(B(i.length(),1e-4))return 0;s.set(i.negate().normalize()),a=z(e,t,s);const o=a.dot(s),l=n.dot(s);if(B(o-l,1e-4))return o;n.distanceSq(W)<r.distanceSq(W)?r=a:n=a}return 0}const q={intersect:(e,t)=>B(J(e,t),1e-4),distance:J};class Z{constructor(e,t,i){this.element=i,this.row=e,this.column=t}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(e){if(this.column!==e.row)throw new Error("matrix multiply error");const t=[];for(let i=0;i<this.row;i++)for(let s=0;s<e.column;s++){t[i+s*e.column]=0;for(let n=0;n<this.column;n++)t[i+s*e.column]+=this.element[i+n*this.column]*e.element[n+s*e.column]}return new Z(this.row,e.column,t)}static identity(){return new Z(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static translate(e,t,i){return new Z(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1])}static scale(e,t,i){return new Z(4,4,[e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1])}static rotate(e,t,i,s){const n=Math.cos(s/180*Math.PI),r=Math.sin(s/180*Math.PI),a=Math.sqrt(e*e+t*t+i*i);if(1!==a){const s=1/a;e*=s,t*=s,i*=s}const o=1-n,l=e*t,h=t*i,c=i*e,u=e*r,d=t*r,f=i*r,g=[];return g[0]=e*e*o+n,g[1]=l*o+f,g[2]=c*o-d,g[3]=0,g[4]=l*o-f,g[5]=t*t*o+n,g[6]=h*o+u,g[7]=0,g[8]=c*o+d,g[9]=h*o-u,g[10]=i*i*o+n,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,new Z(4,4,g)}static skew(e,t){const i=new Array(16).fill(0),s=2*Math.PI*(t/360),n=-2*Math.PI*(e/360);return i[0]=1-n*s,i[1]=-Math.tan(s),i[4]=Math.tan(n),i[5]=1,i[10]=1,i[15]=1,new Z(4,4,i)}static transform2d(e,t,i,s,n,r){return new Z(4,4,[e,t,0,0,i,s,0,0,0,0,1,0,n,r,0,1])}}const Q=e=>e>=65&&e<=90||e>=97&&e<=122,ee=e=>e>=48&&e<=57,te=(e,t)=>{switch(e){case"translate3d":return Z.translate(t[0],t[1],t[2]);case"scale3d":return Z.scale(t[0],t[1],t[2]);case"rotate3d":return Z.rotate(t[0],t[1],t[2],t[3]);case"skew":return Z.skew(t[0],t[1]);case"matrix":return Z.transform2d(t[0],t[1],t[2],t[3],t[4],t[5]);case"matrix3d":return new Z(4,4,t);default:throw new Error(`no support type ${e}`)}},ie=e=>{let t=Z.identity();if(!e)return t;let i="",s="",n=[],r=0;for(let a=0;a<e.length;a++){const o=e.charCodeAt(a);0===r?(Q(o)||ee(o))&&(i+=e[a]):(ee(o)||46===o||45===o||101===o)&&(s+=e[a]),40===o?(r=1,s="",n=[]):41===o?(n.push(parseFloat(s)),t=t.multiply(te(i,n)),i="",r=0):44===o&&(n.push(parseFloat(s)),s="")}return t},se=e=>{if(e.indexOf(" ")>=0){return e.split(" ").map((e=>parseInt(e.substr(0,e.length-2),10)))}return parseInt(e.substr(0,e.length-2),10)},ne=e=>{let t=e;const i=se(t.style.width),s=se(t.style.height);let n=Z.identity();for(;t.parentElement;){const e=getComputedStyle(t),i=e.transform?e.transform:e.webkitTransform;if(i){const s=e.transformOrigin?e.transformOrigin:e.webkitTransformOrigin,r=ie(i);if(s){const e=se(s),i=Z.translate(-e[0],-e[1],0),a=Z.translate(e[0],e[1],0);n=Z.translate(t.offsetLeft,t.offsetTop,0).multiply(a.multiply(r.multiply(i.multiply(n))))}else n=r.multiply(n)}t=t.parentElement}const r=new Z(4,4,[0,0,0,1,i,0,0,1,0,s,0,1,i,s,0,1]);n=n.multiply(r);const a=n.element;return[a[0],a[1],a[4],a[5],a[8],a[9],a[12],a[13]]};class re{constructor(e,t,i){this._Id=oe++,this._Element1=e,this._Element2=t,this._Callback=i,this._Contacted=!1,this._Recycled=!1}Recycle(){this._Recycled=!0,this._Callback=null,this._Element1=null,this._Element2=null}TestCollision(){}}class ae extends re{TestCollision(){if(this._Recycled)return;q.intersect(ne(this._Element1),ne(this._Element2))?this._Contacted||(this._Contacted=!0,this._Callback&&this._Callback.OnBeginContact&&this._Callback.OnBeginContact()):this._Contacted&&(this._Callback&&this._Callback.OnEndContact&&this._Callback.OnEndContact(),this._Contacted=!1)}}let oe=0;i.DragImpactSensor=class extends re{TestCollision(){if(this._Recycled)return;const e=ne(this._Element2),t=q.intersect(this._Element1.slice(0,1),e),i=q.intersect(this._Element1.slice(1,2),e),s=q.intersect(this._Element1.slice(2,3),e),n=q.intersect(this._Element1.slice(3,4),e);t&&i&&s&&n?this._Contacted&&(this._Callback&&this._Callback.OnEndContact&&this._Callback.OnEndContact(),this._Contacted=!1):this._Contacted||(this._Contacted=!0,this._Callback&&this._Callback.OnBeginContact&&this._Callback.OnBeginContact({x:e[0],y:e[1]}))}},i.ElementImpactSensor=re,i.sElementImpactSensorManager=new class{constructor(){this._SensorMap={},this._SensorCount=0}TestCollision(){for(const e in this._SensorMap)this._SensorMap[e]._Recycled?(delete this._SensorMap[e],this._SensorCount--):this._SensorMap[e].TestCollision()}HasTrace(){return 0!==this._SensorCount}AddImpactSensor(e){return this._SensorMap[oe]=e,this._SensorCount++,i.sRenderBridge.BeginHtmlFrameLoop(),e}},i.sImpactSensorManager=new class{StartTrace(e,t,s){const n=new ae(e.Element,t.Element,s);return i.sElementImpactSensorManager.AddImpactSensor(n),n}},i.sImpactSensorManager.Callback=class{constructor(e,t){this.OnBeginContact=e,this.OnEndContact=t}},i.sImpactSensorManager.AutoFroze=class{constructor(e,t){this._PreImpactViews=e,this._OnImpactViews=t}UpdatePreImpactList(e){this._PreImpactViews=e}UpdateOnImpactList(e){this._OnImpactViews=e}},window.gRootView=null,i.sRootView=null;i.TextureSetting=class{constructor(e,t,s,n){this.Texture=e,this._IsTextureExternal=!1,t instanceof i.ImageTexture?(t&&t.RenderTexture&&t.RenderTexture.NeedCheckExpired&&(t.RenderTexture.RequireTime=0),this.MaskSetting=new i.ViewTextureMask(t)):this.MaskSetting=t,e&&e.RenderTexture&&e.RenderTexture.NeedCheckExpired&&(e.RenderTexture.RequireTime=0),this._IsMaskTextureExternal=!1,this.TextureBeforeImageLoad=s,this._IsPreloadImageTextureExternal=!1,void 0===n&&(n=!0),this.HasAlpha=n}SetExternal(e,t,i){this._IsTextureExternal=e,this._IsMaskTextureExternal=t,this._IsPreloadImageTextureExternal=i}ReleaseInternalTexture(e,t){!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 le extends i.TextureSetting{constructor(e,t,i,s){super(e,t,i,s),this.SetExternal(!0,!0,!0)}}i.ExternalTextureSetting=le,window.ExternalTextureSetting=i.ExternalTextureSetting;i.PackedLayout=class{constructor(e){const t=e.RectInfo;this.RectInfo={coordX:t.coordX,coordY:t.coordY,width:t.width,height:t.height},this.LayoutParams=JSON.parse(JSON.stringify(e.LayoutParams))}ApplyToView(e){const t=this.RectInfo;e.RectInfo={coordX:t.coordX,coordY:t.coordY,width:t.width,height:t.height},e.LayoutParams=JSON.parse(JSON.stringify(this.LayoutParams))}};i.ViewMask=class{constructor(){this._MaskType="COMMON"}Type(){return this._MaskType}UnLoad(){}};class he extends i.ViewMask{constructor(e){super(),this._MaskType="TEXTURE",this.ImageTexture=e}UnLoad(){this.ImageTexture.UnloadTex()}}i.ViewTextureMask=he;class ce extends i.ViewMask{constructor(e,t,i,s){super(),this._MaskType="CORNER",this._TopLeft=e,this._TopRight=isNaN(t)?e:t,this._BottomLeft=isNaN(i)?e:i,this._BottomRight=isNaN(s)?e:s,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=ce;i.DragSetting=class{constructor(e,t,s,n,r,a){this.DragDirection=e||0,this.TriggerMovedDistance=t||0,this._EnableJsFling=s?1:0,this.SlidePile=n||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(e){this.Listener=e}},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 ue=0;class de{constructor(e,t){this.TextureSetting=e,e&&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=++ue,this.childZIndexCount=0,this._IsChildOfRootView=!1,this._DetachFromSystemCallback=null,this.Element=null,this.InnerChildElement=null,"root"===t?(this.Element=window.originDocument.getElementById(t),this.Element||(this.Element=window.originDocument.getElementById("app"))):"svg"===t||"path"===t?this.Element=document.createElementNS("http://www.w3.org/2000/svg",t):t&&(this.Element=window.originDocument.createElement(t),this.Element.style.position="absolute"),this.TransitionStore={},this.TransformAnimationObj=null,this._TextureAnimationObj=null,this._DragInfo=null,this.DragControl=null,this._Velocity={x:new V,y:new V},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}Init(e){this.ResetTexture(e)}SetElementProp(e,t){e&&Object.keys(e).forEach((t=>{switch(t){case"jsv_enable_fade":case"jsv_poster_on_top":case"jsv_media_usetexture":case"jsv_text_definition":break;case"jsv_innerview":{const s=i.sViewStore.get(e[t]);if(s){const e=s.view,t=s.layout_params;e&&(null===this._ProxyView?this._InsertProxyLayer(e,t):e!==this._ProxyView&&console.error("Error: Can not reset proxy view"))}break}default:i.LogE(`Error: View Unknown prop name=${t}`)}}))}InsertView(e,t,i,s){this._InsertView(e,t,i,s)}AddView(e,t,i){this._InsertView(e,null,t,i)}_InsertView(e,t,s,n){if(s?s instanceof i.LayoutParamsBase?e.LayoutParams=s.Clone():e.LayoutParams=new i.LayoutParams(s):e.LayoutParams||(e.LayoutParams=new i.LayoutParams({x:0,y:0})),null!==e.LayoutParams&&(e.LayoutParams.MarginLeft&&(e.Element.style.left=`${e.LayoutParams.MarginLeft}px`),e.LayoutParams.MarginTop&&(e.Element.style.top=`${e.LayoutParams.MarginTop}px`),e.LayoutParams.Width&&(e.Element.style.width=`${e.LayoutParams.Width}px`),e.LayoutParams.Height?e.Element.style.height=`${e.LayoutParams.Height}px`:e.Element.style.height=""),e.ParentView=this,t){let i=this.ChildViews.indexOf(t);i<0&&(i=this.ChildViews.length),this.ChildViews.splice(i,0,e)}else this.ChildViews.push(e);this._ChildrenListDirty=!0,this._IsChildOfRootView&&e._OnAttachToSystem()}SetZIndex(e){this.Element.style.zIndex=e,this.zIndex=e}SetPerspective(e,t){this.Element.style.perspective=`${e}px`,this.Element.style.webkitPerspective=`${e}px`,this.Element.style.perspectiveOrigin=t,this.Element.style.webkitPerspectiveOrigin=t,this._Perspective=e,this._PerspectiveOrigin=t}SetBackfaceVisibility(e){console.log("set back face",e),this.Element.style.backfaceVisibility=e?"visible":"hidden",this.Element.style.webkitBackfaceVisibility=e?"visible":"hidden",console.log(`back face style ${this.Element.style.backfaceVisibility}`),this._BackfaceVisibility=e?1:0}SetTransformStyle(e){this.Element.style.transformStyle=e,this.Element.style.webkitTransformStyle=e,this._TransformStyle=e}EnableDivTouch(e,t){e.eventHandlers&&e.eventHandlers.onClick&&(this.Element.onclick=t=>{e.eventHandlers.onClick(),t.preventDefault&&t.preventDefault()},this.Element.style.pointerEvents="auto")}_DoDragPause(e){this._DragInfo.Settings.EnableTabMode||this.DragControl&&this.DragControl.pause(((t,i)=>{if(null!==this.Element.style.transform){let s=this.GetLayoutParams();s=this._GetMovedLayoutParams(t-s.MarginLeft,i-s.MarginTop),this.ResetLayoutParams(s),this._DragImactSensorRecycle(),console.log(`_DoDragPause lp.MarginLeft:${s.MarginLeft}, lp.MarginTop:${s.MarginTop}`),this.DragControl=null,this.Element.style.transform=null,e.viewX=t,e.viewY=i,this._DragInfo.Listener.OnFling(e)}}))}TouchEventProcess(e){let t=!1;switch(e.type){case i.DragInfo.EVENT_TYPE.OnDown:console.log("TouchEventProcess OnDown in"),this._DoDragPause(e),this._DragInfo.Listener&&this._DragInfo.Listener.OnDown&&(t=this._DragInfo.Listener.OnDown(e));break;case i.DragInfo.EVENT_TYPE.OnTap:this._DragInfo.Listener&&this._DragInfo.Listener.OnTap&&(t=this._DragInfo.Listener.OnTap(e));break;case i.DragInfo.EVENT_TYPE.OnLongPress:this._DragInfo.Listener&&this._DragInfo.Listener.OnLongPress&&(t=this._DragInfo.Listener.OnLongPress(e));break;case i.DragInfo.EVENT_TYPE.OnDragStart:this._DragMovedDistanceX=0,this._DragMovedDistanceY=0,this._DragInfo.Listener&&this._DragInfo.Listener.OnDragStart&&(t=this._DragInfo.Listener.OnDragStart(e));break;case i.DragInfo.EVENT_TYPE.OnMoved:this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved&&(t=this._DoDragMove(e,!0));break;case i.DragInfo.EVENT_TYPE.OnDragEnd:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnDragEnd){t=!!this._SlideIfEnableTabMod(e,-1)||this._DoDragEnd(e)}break;case i.DragInfo.EVENT_TYPE.OnRelease:this._DragInfo.Listener&&this._DragInfo.Listener.OnRelease&&(t=this._DragInfo.Listener.OnRelease(e));break;case i.DragInfo.EVENT_TYPE.OnFling:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnFling){t=!!this._SlideIfEnableTabMod(e,-1)||this._DoFling(e)}break;default:console.log(`TouchEventProcess:${e}`)}return t}DisableDrag(){this._DragInfo=null}EnableDrag(e,t,s){e instanceof i.DragSetting||i.ThrowError("EnableDrag The setting is not Forge.DragSetting"),null===t&&i.ThrowError("EnableDrag The listener is null");const n=new i.DragInfo;n.Settings=e,n.SetListener(t),n.Formula=s,this._DragInfo=n,this.DragControl=null,this._AddEventListener(),i.sRenderBridge.RequestSwap()}RemoveView(e){for(let t=0;t<this.ChildViews.length;t++)if(this.ChildViews[t]===e){e.IsChildOfRootView()&&e._OnDetachFromSystem(),this.ChildViews.splice(t,1),e.ParentView=null;break}}_OnDetachFromSystem(){this._IsChildOfRootView=!1,this._DetachFromSystemCallback?(this._DetachFromSystemCallback.some(((e,t,i)=>{e()})),this._DetachFromSystemCallback=null):this.OnDettachFromSystem();for(let e=0;e<this.ChildViews.length;e++){this.ChildViews[e]._OnDetachFromSystem()}this.ParentView.Element.removeChild(this.Element),this._releaseViewResources()}RegisterDetachCallback(e){e&&(null==this._DetachFromSystemCallback&&(this._DetachFromSystemCallback=[]),this._DetachFromSystemCallback.push(e))}UnregisterDetachCallback(e){if(e&&this._DetachFromSystemCallback){let t=this._DetachFromSystemCallback;for(let i=0;i<t.length;i++)if(t[i]===e){t.splice(i,1);break}found?0==t.length&&(this._DetachFromSystemCallback=null):console.error("no found")}else console.error("Unregister nothing...")}OnDettachFromSystem(){}_releaseViewResources(){this.StopAnimation(),this.StopTextureAnimation()}ClearViews(){const e=this.ChildViews.length;if(0!==e){for(let t=0;t<e;t++){const e=this.ChildViews[t];e&&e.IsChildOfRootView()&&e._OnDetachFromSystem()}this.ChildViews=[]}}_ResetTextStyle(e){this.Element.style.overflow="hidden";let t=i.sTextStyleCache.GetDsFromId(e.Set.IDS.DS).Describe,s=i.sTextStyleCache.GetFsFromId(e.Set.IDS.FS).Describe,n=i.sTextStyleCache.GetCsFromId(e.Set.IDS.CS).Describe,r=null;"DISABLE"!==e.Set.IDS.SS&&(r=i.sTextStyleCache.GetSsFromId(e.Set.IDS.SS).Describe),this.Element.style.fontFamily=s.font,this.Element.style.fontSize=`${e.Set.FS}px`,s.italic&&(this.Element.style.fontStyle="italic"),s.bold?this.Element.style.fontWeight="bold":this.Element.style.fontWeight="normal",this.Element.style.textOverflow=t.text_overflow,this.Element.style.wordBreak="normal";let a=t.word_wrap;"none"===a?this.Element.style.whiteSpace="nowrap":a&&(this.Element.style.wordWrap=a.replace("_","-")),this.Element.style.textAlign=t.alignment,this.Element.style.verticalAlign=t.vertical_area_align;let o=n.text_color;o.startsWith("#")&&9===o.length&&(o="#"+o.substr(3,6)),this.Element.style.color=o;let l=n.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=`${e.Set.W}px`,this.Element.style.height=`${e.Set.H}px`,e.Set.LH&&(this.Element.style.lineHeight=`${e.Set.LH}px`),e.Set.EA){let t=e.Set.EA,i=window.originDocument.createElement("div");i.style.float=t.x>0?"right":"left",i.style.width=t.w+"px",i.style.height=t.h-1+"px",i.style.backgroundColor="rgba(0,0,0,0)",i.style.position="relative",this.Element.appendChild(i)}if(e.Set.LA){const t=F(e.Set.ST);!function(e,t){const i=t.text;for(const s of t.nodeList){if(s.lineFeedNode){e.appendChild(window.originDocument.createElement("br"));continue}const t=i.substring(s.indexPair[0],s.indexPair[1]),n=window.originDocument.createElement("span");let r,a=n;for(const e of s.styleList)switch(e.style){case L.BASE:break;case L.BOLD:r=window.originDocument.createElement("b"),a.appendChild(r),a=r;break;case L.ITALIC:r=window.originDocument.createElement("i"),a.appendChild(r),a=r;break;case L.COLOR:n.style.color=e.styleValue;break;case L.DECORATION:n.style.textDecoration=e.styleValue;break;case L.SUPERSCRIPT:r=window.originDocument.createElement("sup"),a.appendChild(r),a=r;break;case L.SUBSCRIPT:r=window.originDocument.createElement("sub"),a.appendChild(r),a=r}a.textContent=t,e.appendChild(n)}}(this.Element,t)}else{let t=window.originDocument.createElement("span");t.textContent=e.Set.ST,this.Element.appendChild(t)}}_SetBorderRadius(e){(this.InnerChildElement?this.InnerChildElement:this.Element).style.borderRadius=`${e._TopLeft}px ${e._TopRight}px ${e._BottomRight}px ${e._BottomLeft}px`}_InsertProxyLayer(e,t){if(e.ParentView=this,this._IsChildOfRootView){for(let e of this.ChildViews)e._AdvanceDepthForProxyLayer();e._OnAttachToSystem()}e.ChildViews=e.ChildViews.concat(this.ChildViews),e._ChildrenListDirty=!0;for(let t=0;t<e.ChildViews.length;t++)e.ChildViews[t].ParentView=e,e._RequestLayoutForAddingView(e.ChildViews[t]);null!==t?t instanceof i.LayoutParamsBase?e.LayoutParams=t.Clone():e.LayoutParams=new i.LayoutParams(t):null===e.LayoutParams&&(e.LayoutParams=new i.LayoutParams({x:0,y:0})),e.ResetLayoutParams(e.LayoutParams),this.ChildViews=[e],this._ChildrenListDirty=!0,this._RequestLayoutForAddingView(e),this._ProxyView=e,this._IsChildOfRootView&&e._OnAttachToSystem()}_RequestLayoutForAddingView(e){this._RequestLayout()}ResetTexture(e){if(this.TextureSetting=e,e){if(e.Texture.Source)"IMG"===this.Element.tagName?this.Element.src=e.Texture.Source:(this.Element.style.backgroundImage=`url(${e.Texture.Source})`,this.Element.style.backgroundSize="100% 100%");else if(e.Texture.RenderTexture&&e.Texture.RenderTexture._SyncingResourceInfo){const t=e.Texture.RenderTexture._SyncingResourceInfo;if("TST"===t.Nam)this._ResetTextStyle(t);else if("CT"===t.Nam)this.Element.style.backgroundColor=t.Set.Clr;else if("VPLY"===t.Nam){const e=t.Set.Hdl;e.style.width="100%",e.style.height="100%",e.style.objectFit="fill",this.Element.appendChild(e),this.InnerChildElement=e}}e.MaskSetting&&"CORNER"===e.MaskSetting._MaskType&&this._SetBorderRadius(e.MaskSetting)}}SetVisibility(e){this.Element.style.visibility="string"==typeof e?e.toLocaleLowerCase():"inherit"}_OnAttachToSystem(){"svg"!==this.Element.id&&"path"!==this.Element.id||console.log("_OnAttachToSystem appendChild");let e=this.ParentView.ChildViews[this.ParentView.ChildViews.indexOf(this)+1];e&&this.ParentView.Element.contains(e.Element)?this.ParentView.Element.insertBefore(this.Element,e.Element):this.ParentView.Element.appendChild(this.Element),this._IsChildOfRootView=!0;const t=this.ChildViews;let i;for(let e=0;e<t.length;e++)i=t[e],i._OnAttachToSystem()}IsChildOfRootView(){return this._IsChildOfRootView}StartAnimation(e,t,i){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(e),this.TransformAnimationObj=null,window.jsvInAndroidWebView?this.Element.style.webkitAnimation=null:this.Element.style.animation=null),this.TransformAnimationObj=e,!isNaN(i)&&i>0&&e.EnableDelay(i),e.Start(this)}ApplyStyleTransition(e){this.TransitionStore={...this.TransitionStore,...e};let t="";Object.values(this.TransitionStore).forEach((e=>{t&&(t+=","),t+=e})),window.jsvInAndroidWebView?this.Element.style.webkitTransition=t:this.Element.style.transition=t}StopAnimation(){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(),this.TransformAnimationObj=null)}StartTextureAnimation(e){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(e),this._TextureAnimationObj=null),this._TextureAnimationObj=e,e.AsTextureAnimation(),e.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 e=0;e<this.ChildViews.length;e++)this.ChildViews[e].StopAllAnimations()}GetAnimation(){return this.TransformAnimationObj}DetachAnimation(e){this.TransformAnimationObj===e&&(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(e,t){e===this._CssTransform&&t===this._CssTransformOrigin||(window.jsvInAndroidWebView?(this.Element.style.webkitTransform=e,this.Element.style.webkitTransformOrigin=t):(this.Element.style.transform=e,this.Element.style.transformOrigin=t),this._CssTransform=e,this._CssTransformOrigin=t)}ResetTextureCssTransform(e,t){this.ResetCssTransform(e,t)}SetId(e){this.Id=e}ResetLayoutParams(e){null!==e?(e instanceof i.LayoutParamsBase?this.LayoutParams=e.Clone():this.LayoutParams=new i.LayoutParams(e),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")}GetRenderer(){return i.LayoutViewBase.sRenderer}GetLayoutParams(){return this.LayoutParams?this.LayoutParams.Clone():new i.LayoutParams}EnableAutoHeight(){this._AutoHeight=!0}WaitTextureToResize(e){}ApplyObjectFit(e,t,i,s,n,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===e&&a.objectFit===n&&a.frameHeight===t&&a.textureWidth===i&&a.textureHeight===s)return a.clipLayout;const o={x:0,y:0,width:e,height:t,overflow:!1};a.frameWidth=e,a.frameHeight=t,a.textureWidth=i,a.textureHeight=s,a.objectFit=n,a.clipLayout=o;let l={width:0,height:0},h=e/t;const c=i/s;if(!c)return console.error("Error:Texture size is 0!"),o;if(0===e||0===t){if(0===e&&0===t)return o;0===e?e=t*c:t=e/c,h=e/t}let u="";switch(n){case r.FILL:l.width=e,l.height=t,u="fill";break;case r.NONE:l.width=i,l.height=s,u="none";break;case r.COVER:l=this._StretchSize(e,t,c,c<h),u="cover";break;case r.SCALEDOWN:{let n=c>h;e>i&&t>s&&(n=c<h),l=this._StretchSize(e,t,c,n),u="scaledown";break}case r.CONTAIN:l=this._StretchSize(e,t,c,c>h),u="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,e),o.height=Math.min(l.height,t),o.x=Math.floor((e-o.width)/2),o.y=Math.floor((t-o.height)/2),o.overflow=l.width>e||l.height>t;const d=this.InnerChildElement?this.InnerChildElement:this.Element;return d.style.width=`${e}px`,d.style.height=`${t}px`,d.style.objectFit=u,o}_StretchSize(e,t,i,s){const n={width:0,height:0};return s?(n.width=e,n.height=e/i):(n.height=t,n.width=t*i),n}GetPositionOffset(e){let t=this,s=0,n=0;for(;e!==t;)s+=t.LayoutParams?t.LayoutParams.MarginLeft:0,n+=t.LayoutParams?t.LayoutParams.MarginTop:0,t=t.ParentView,t||i.ThrowError("ERROR: Target parent layoutview is not found in LayoutView tree");return new i.Coordinate(s,n)}_dispatchLongPress(){this._LongPressDelayRequestTaskId=0,this._InLongPress=!0;const e={type:i.DragInfo.EVENT_TYPE.OnLongPress,x:this._CurrentDownEvent.designX,y:this._CurrentDownEvent.designY};this.TouchEventProcess(e)}_onMouseDown(e,t,s){this._Velocity.x.reset(),this._Velocity.y.reset(),this._Velocity.x.updatePosition(e),this._Velocity.y.updatePosition(t),this._LastFocusX=e,this._DownFocusX=this._LastFocusX,this._LastFocusY=t,this._DownFocusY=this._LastFocusY,this._CurrentDownEvent={designX:e,designY:t,timeStamp:s},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:e,y:t,deltaX:0,deltaY:0}}_onMouseMove(e,t,s){if(!this._CurrentDownEvent)return null;this._Velocity.x.updatePosition(e),this._Velocity.y.updatePosition(t);const n=parseInt(e-this._LastFocusX,10),r=parseInt(t-this._LastFocusY,10),a=parseInt(e-this._DownFocusX,10),o=parseInt(t-this._DownFocusY,10);let l=null;if(this._AlwaysInTapRegion){a*a+o*o>this._TouchSlopSquare&&(l={type:i.DragInfo.EVENT_TYPE.OnDragStart,x:e,y:t},this._LastFocusX=e,this._LastFocusY=t,this._LastTimeStamp=s,this._AlwaysInTapRegion=!1,this._InLongPress=!1,this._InDragging=!0,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0))}else this._InDragging&&(Math.abs(n)>=1||Math.abs(r)>=1)&&(l={type:i.DragInfo.EVENT_TYPE.OnMoved,x:e,y:t,deltaX:a,deltaY:o,_deltaX:n,_deltaY:r,timeStamp:parseInt((this._LastTimeStamp-s)/1e3,10)},this._LastFocusX=e,this._LastFocusY=t,this._LastTimeStamp=s);return l}_onMouseUp(e,t,s){let n=null;if(this._CurrentDownEvent){const s=window.Forge.DesignMap(),r=Math.floor(s.displayScale*s.width),a=window.innerWidth/r,o=this._Velocity.x.getVelocity()/a,l=this._Velocity.y.getVelocity()/a;let h=e-this._CurrentDownEvent.designX,c=t-this._CurrentDownEvent.designY;const u=e-this._LastFocusX,d=t-this._LastFocusY;this._InLongPress||(this._AlwaysInTapRegion?n={type:i.DragInfo.EVENT_TYPE.OnTap,x:e,y:t,velocityX:0,velocityY:0,deltaX:h,deltaY:c,_deltaX:u,_deltaY:d}:(Math.abs(l)>70||Math.abs(o)>70?(h=this._GetSplineFlingDistance(o),c=this._GetSplineFlingDistance(l),n={type:i.DragInfo.EVENT_TYPE.OnFling,x:e,y:t,velocityX:o,velocityY:l,deltaX:o<0?-h:h,deltaY:l<0?-c:c,_deltaX:u,_deltaY:d}):n={type:i.DragInfo.EVENT_TYPE.OnDragEnd,x:e,y:t,deltaX:h,deltaY:c,_deltaX:u,_deltaY:d},this.TouchEventProcess(n),n={type:i.DragInfo.EVENT_TYPE.OnRelease,x:e,y:t,deltaX:h,deltaY:c,_deltaX:u,_deltaY:d},this._CurrentDownEvent=null)),this._InLongPress=!1,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0)}return n}_onTouchEvent(e){const t=window.Forge.DesignMap(),i=Math.floor(t.displayScale*t.width),s=window.innerWidth/i,n=e.clientX/s,r=e.clientY/s;let a=null;switch(e.type){case"touchstart":case"mousedown":a=this._onMouseDown(n,r,e.timeStamp);break;case"touchmove":case"mousemove":a=this._onMouseMove(n,r,e.timeStamp);break;case"touchend":case"touchcancel":case"mouseup":a=this._onMouseUp(n,r,e.timeStamp)}return!!a&&this.TouchEventProcess(a)}_AddEventListener(){this.Element.style.pointerEvents="auto",this._ValidTouch=!1;"ontouchstart"in window?(this.Element.addEventListener("touchstart",(e=>{if(console.log("touchstart",e),this._ValidTouch=!0,e.touches&&e.touches.length>0){console.log(`touchstart event.touches[0].clientX:${e.touches[0].clientX}, event.touches[0].clientY:${e.touches[0].clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchmove",(e=>{if(this._ValidTouch&&(console.log("touchmove",e),e.touches&&e.touches.length>0)){console.log(`touchmove event.touches[0].clientX:${e.touches[0].clientX}, event.touches[0].clientY:${e.touches[0].clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchend",(e=>{if(console.log(`touchend event.touches.length:${e.touches.length}, event.clientX:${e.clientX}, event.pageX:${e.pageX}`),this._ValidTouch=!1,e.changedTouches&&e.changedTouches.length>0){console.log(`touchend event.changedTouches[0].clientX:${e.changedTouches[0].clientX}, event.changedTouches[0].pageX:${e.changedTouches[0].pageX}`);this._onTouchEvent({type:e.type,clientX:e.changedTouches[0].clientX,clientY:e.changedTouches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchcancel",(e=>{if(this._ValidTouch=!1,console.log("touchcancel",e),e.changedTouches&&e.changedTouches.length>0){console.log(`touchcancel event.clientX:${e.clientX}, event.clientY:${e.clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0)):(this.Element.addEventListener("mousedown",(e=>{console.log("mousedown",e),this._ValidTouch=!0;this._onTouchEvent(e)&&e.stopPropagation()}),!0),this.Element.addEventListener("mousemove",(e=>{if(this._ValidTouch){this._onTouchEvent(e)&&e.stopPropagation()}}),!0),this.Element.addEventListener("mouseup",(e=>{console.log("mouseup",e),this._ValidTouch=!1;this._onTouchEvent(e)&&e.stopPropagation()}),!0))}_GetSplineDeceleration(e){return Math.log(i.DragInfo.INFLEXION*Math.abs(e)/(i.DragInfo.SCROLL_FRICTION*i.DragInfo.PHYSICAL_COEF))}_GetSplineFlingDistance(e){const t=this._GetSplineDeceleration(e),s=i.DragInfo.DECELERATION_RATE-1;return i.DragInfo.SCROLL_FRICTION*i.DragInfo.PHYSICAL_COEF*Math.exp(i.DragInfo.DECELERATION_RATE/s*t)}_DoDragMove(e,t){let s=e._deltaX,n=e._deltaY;this._DragMovedDistanceX+=s,this._DragMovedDistanceY+=n,t||(s=e.deltaX,n=e.deltaY);const r=e.timeStamp/1e3;let a=`left ${r}s, top ${r}s`;this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_VERTICAL?(s=0,a=`top ${r}s`):this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_HORIZONTAL?(n=0,a=`left ${r}s`):this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_DISABLE&&(s=0,n=0);let o=this.GetLayoutParams();return o=this._GetMovedLayoutParams(s,n),t&&(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)&&(e.viewX=o.MarginLeft,e.viewY=o.MarginTop,this._DragInfo.Listener.OnMoved(e))}_GetMovedLayoutParams(e,t){const i=this.GetLayoutParams();let s=i.MarginLeft+e,n=i.MarginTop+t;return s>this._DragInfo.Settings.SlidePile.x?s=this._DragInfo.Settings.SlidePile.x:s+i.Width<this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width&&(s=this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width-i.Width),n>this._DragInfo.Settings.SlidePile.y?n=this._DragInfo.Settings.SlidePile.y:n+i.Height<this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height&&(n=this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height-i.Height),i.SetPosition(s,n),i}_SlideIfEnableTabMod(e,t){if(!this._DragInfo.Settings.EnableTabMode)return!1;const s=e._deltaX,n=e._deltaY;let r=e.deltaX,a=e.deltaY,o=this._DragInfo.Settings.PageWidth*this._DragInfo.Settings.PageEdge;const l=this.GetLayoutParams(),h=l.MarginLeft+s,c=l.MarginTop+n;switch(e.type===i.DragInfo.EVENT_TYPE.OnFling&&(o=0),this._DragInfo.Settings.DragDirection){case i.DragSetting.DIRECTION_VERTICAL:if(r=0,a>=0){const e=this._DragInfo.Settings.PageWidth-Math.abs(c)%this._DragInfo.Settings.PageWidth;a=e>=o?this._DragInfo.Settings.PageWidth-e:-e}else{const e=Math.abs(c)%this._DragInfo.Settings.PageWidth;a=e>=o?-(this._DragInfo.Settings.PageWidth-e):e}break;case i.DragSetting.DIRECTION_HORIZONTAL:if(a=0,r>=0){const e=this._DragInfo.Settings.PageWidth-Math.abs(h)%this._DragInfo.Settings.PageWidth;r=e>=o?this._DragInfo.Settings.PageWidth-e:-e,console.log(`right, left_width:${e}, distance_x:${r}`)}else{const e=Math.abs(h)%this._DragInfo.Settings.PageWidth;r=e>=o?-(this._DragInfo.Settings.PageWidth-e):e,console.log(`left, left_width:${e}, 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 u=Math.sqrt(r*r+a*a)/.3;return e.deltaX=r,e.deltaY=a,this._DonFlingAnim(e,u),!0}_DoDragEnd(e){let t=e._deltaX,s=e._deltaY;this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_VERTICAL?t=0:this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_HORIZONTAL?s=0:this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_DISABLE&&(t=0,s=0),console.log("_DoDragEnd event:",e,this.Element.style);let n=this.GetLayoutParams();return n=this._GetMovedLayoutParams(t,s),this.ResetLayoutParams(n),e.viewX=n.MarginLeft,e.viewY=n.MarginTop,this._DragInfo.Listener.OnDragEnd(e)}_DragImactSensorRecycle(){console.log("_DragImactSensorRecycle this._DragImactSensor:",this._DragImactSensor),this._DragImactSensor&&this._DragImactSensor.Recycle()}_DonFlingAnim(e,t){const s=e.deltaX,n=e.deltaY,r=this.GetLayoutParams(),a=r.MarginLeft,o=r.MarginTop,l=r.MarginLeft+s,h=r.MarginTop+n,c=this._GetMovedLayoutParams(s,n);if(c.MarginLeft===r.MarginLeft&&c.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(t),console.log(`OnFling speed:${t}`);const u=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(((t,i)=>{this.DragControl=null,r.SetPosition(t,i),this.ResetLayoutParams(r),this.Element.style.transform=null,this._DragImactSensorRecycle(),e.viewX=t,e.viewY=i,this._DragInfo.Listener.OnFling(e),console.log(`_DonFlingAnim end view_x:${t}, view_y:${i}, distance_x:${s}, distance_y:${n}`)}),(e=>{const t=s*e,i=n*e;if(console.log(`_DonFlingAnim progress:${e}, deltaX:${t}, deltaY:${i}`),Math.abs(t)>this._DragInfo.Settings.TriggerMovedDistance||Math.abs(i)>this._DragInfo.Settings.TriggerMovedDistance){const e={deltaX:a+t,deltaY:o+i,_deltaX:t,_deltaY:i,timeStamp:parseInt((Date.now()-d)/1e3,10)};this._DoDragMove(e,!1),d=Date.now()}}));const f=this.GetPositionOffset(this.ParentView);this._DragImactSensor=i.sElementImpactSensorManager.AddImpactSensor(new i.DragImpactSensor([{x:u.SlidePile.x+f.x,y:u.SlidePile.y+f.y},{x:u.SlidePile.x+f.x+u.SlidePile.width,y:u.SlidePile.y+f.y},{x:u.SlidePile.x+f.x,y:u.SlidePile.y+f.y+u.SlidePile.height},{x:u.SlidePile.x+f.x+u.SlidePile.width,y:u.SlidePile.y+f.y+u.SlidePile.height}],this.Element,new i.sImpactSensorManager.Callback((t=>{this._DoDragPause(e),this._DragImactSensorRecycle()}),null)))}_DoFling(e){let t=e.deltaX,s=e.deltaY,n=!0,r=0;switch(this._DragInfo.Settings.DragDirection){case i.DragSetting.DIRECTION_VERTICAL:t=0,0===s&&(n=!1),r=Math.abs(e.velocityY);break;case i.DragSetting.DIRECTION_HORIZONTAL:s=0,0===t&&(n=!1),r=Math.abs(e.velocityX);break;case i.DragSetting.DIRECTION_DISABLE:n=!1;break;default:r=Math.sqrt(e.velocityX**2,e.velocityY**2)}return n&&(e.deltaX=t,e.deltaY=s,this._DonFlingAnim(e,r)),!0}}de.DivId=0,i.LayoutViewBase=de;class fe extends i.LayoutViewBase{constructor(e,t){!e||e instanceof i.TextureSetting||i.ThrowError("ERROR:LayoutView need TextureSetting as parameter"),super(e,t=t||"div")}}i.LayoutView=fe,window.LayoutView=i.LayoutView;class ge extends i.LayoutView{constructor(){super(void 0,"root"),this._ViewType=1,this._IsChildOfRootView=!0,window.gRootView=this,i.sRootView=this}Init(e,t,i,s,n){this.InitLayoutViewStaticValues(e),this.ResetLayoutParams({x:0,y:0,width:1280,height:720})}InitLayoutViewStaticValues(e){i.LayoutViewBase.sRenderer=e,i.LayoutViewBase.sInternalTextureManager=e.GetSharedTextureManager(),i.LayoutViewBase.sIdentityMat4=new i.Mat4,i.LayoutViewBase.sNullDirectParentMat4=new i.Mat4,i.LayoutViewBase.sBakeFlipYMat4=(new i.Mat4).rotatex(180)}}i.RootView=ge,window.RootView=i.RootView;class me{constructor(e,t,i,s,n){this.coordX=e,this.coordY=t,this.width=i,this.height=s,this.useScissors=n,this.maskStencil=null}updateInfo(e,t,i,s,n){this.coordX=e,this.coordY=t,this.width=i,this.height=s,this.useScissors=n}setMaskStencil(e){this.maskStencil=e}}class _e extends i.LayoutView{constructor(e){super(e,"div"),this._ClipRectInfo=null,this.Id="ClipView",this.TextureSetting=null}SetId(e){this.Id=`${e}_ClipView`}SetClipRect(e,t,i,s,n){null===this._ClipRectInfo?this._ClipRectInfo=new me(e,t,i,s,n):this._ClipRectInfo.updateInfo(e,t,i,s,n);const r=e,a=t,o=this.LayoutParams.Width-r-i,l=this.LayoutParams.Height-a-s;n?(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=_e,window.ClipView=i.ClipView;class pe extends i.LayoutView{constructor(e){super(e,"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(e){this.TextureSetting=e,this._ApplyChanges()}SetRepeat(e,t){i.Assert(e.length<=2),i.Assert(t.length<=2);for(let i=0;i<2;i++)i<e.length?(this._HorizontalRepeats[2*i]=e[i].start,this._HorizontalRepeats[2*i+1]=e[i].width):(this._HorizontalRepeats[2*i]=0,this._HorizontalRepeats[2*i+1]=0),i<t.length?(this._VerticalRepeats[2*i]=t[i].start,this._VerticalRepeats[2*i+1]=t[i].width):(this._VerticalRepeats[2*i]=0,this._VerticalRepeats[2*i+1]=0);return this._ApplyChanges(),this}SetPadding(e,t){return i.Assert(null!==e),i.Assert(null!==t),this._VerticalPadding[0]=t.start,this._VerticalPadding[1]=t.width,this._HorizontalPadding[0]=e.start,this._HorizontalPadding[1]=e.width,this._ApplyChanges(),this}SetImageDspSize(e,t){this._ImageDspWidth=e,this._ImageDspHeight=t}_ApplyChanges(){let e=this.TextureSetting;if(e){if(e.MaskSetting&&"CORNER"===e.MaskSetting._MaskType&&this._SetBorderRadius(e.MaskSetting),e.Texture.Source){const t=e.Texture.RenderTexture.Width,i=e.Texture.RenderTexture.Height,s=t/this._ImageDspWidth,n=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]*s),c=t-Math.floor(this._HorizontalRepeats[1]*s)-h,u=Math.floor(this._VerticalRepeats[0]*n),d=i-Math.floor(this._VerticalRepeats[1]*n)-u;h+c>=t&&(h-=1,c-=1),u+d>=i&&(u-=1,d-=1);const f=`${u} ${c} ${d} ${h}`;this.Element.style.borderImage=`url(${e.Texture.Source}) ${f} fill`;const g=this._HorizontalPadding[0],m=this._ImageDspWidth-this._HorizontalPadding[1]-g,_=this._VerticalPadding[0],p=this._ImageDspHeight-this._VerticalPadding[1]-_;this.Element.style.borderImageWidth=`${o}px ${a}px ${l}px ${r}px`,this.Element.style.borderImageOutset=`${_}px ${m}px ${p}px ${g}px`}}else this.Element.style.borderRadius="",this.Element.style.borderImage=""}}i.NinePatchView=pe;class we extends i.LayoutView{constructor(e){super(void 0,e.substr(3))}setAttribute(e,t){this.Element.setAttribute(e,t)}removeAttribute(e){this.Element.removeAttribute(e)}getAttribute(e){return this.Element.getAttribute(e)}hasAttribute(e){return this.Element.hasAttribute(e)}get textContent(){return this.Element.textContent}set textContent(e){this.Element.textContent=e}}i.JsvElementView=we;class ve extends i.LayoutView{constructor(e,t){super(t),this._ViewType=8,this.Element=e.Ele,this.Id="VideoView"}SetId(e){this.Id=`${e}_VideoView`}ResetLayoutParams(e){null!==e?(e instanceof i.LayoutParamsBase?this.LayoutParams=e.Clone():this.LayoutParams=new i.LayoutParams(e),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=ve;class ye 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",(e=>{e=e||window.event;let t=this.Element.selectionStart;console.log(`keydown cur_offset:${t}`),37===e.keyCode?(--t,t<0&&(t=0),t!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,t,!0),e.stopPropagation&&e.stopPropagation()):this.Element.blur()):39===e.keyCode?(++t,t>this.Element.value.length&&(t=this.Element.value.length),t!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,t,!0),e.stopPropagation&&e.stopPropagation()):this.Element.blur()):38!==e.keyCode&&40!==e.keyCode||this.Element.blur()})),this.Element.onfocus=e=>{console.log("onfocus in"),this.OnStatusChanged(1)},this.Element.onblur=e=>{console.log("onblur in"),this.OnStatusChanged(0)};this.Element.oninput=e=>{if(console.log("oninput:",e),e.target.value.length>0&&e.target.selectionStart>0){const s=e.target.selectionStart-1,n=e.target.selectionStart,r=e.target.value.slice(s,n);t=r,"0".charCodeAt()<=t.charCodeAt()&&t.charCodeAt()<="9".charCodeAt()||this._InputType!==i.TextInputType.NUMBER||(e.target.value=e.target.value.substr(0,s)+e.target.value.substr(n),e.target.selectionStart=s)}var t;const s=e.target.value,n=e.target.selectionStart;this.OnTextChanged(decodeURIComponent(s),n)}}SetId(e){this.Id=`${e}_EditControlView`}showIme(e,t,s){this.Element?e!==i.TextInputType.NONE?(null==s&&(s=t.length>0?t.length:0),s<0?s=0:s>t.length&&(s=t.length>0?t.length:0),this._InputType=e,this.Element.type="text",this.Element.value=t,this.Element.focus(),this.Element.selectionStart=s,this.Element.selectionEnd=s):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(e,t){this.Element?(this.Element.selectionStart=t,this.Element.selectionEnd=t,this.Element.value=e):console.log("updateCursorOffset, but ele is null!")}OnTextChanged(e,t,i){console.log(`OnTextChanged value:${e}`)}OnStatusChanged(e){}OnEditAction(e){}}class be extends i.LayoutView{constructor(e,t=1){super(e),this._ViewType=10,this._FilterType=t,this.Id="FilterView",this.Element.style.filter="grayscale(100%)"}FilterSwitch(e){this.Element&&(this.Element.style.filter=e?"grayscale(100%)":"")}SetId(e){this.Id=e+"_FilterView"}}i.FilterView=be,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=ye;i.DragTranslateControl=class extends class{constructor(e){this._Current=new Array(e).fill(0),this._Target=new Array(e).fill(0),this._RepeatStart=new Array(e).fill(0),this._JumpTarget=null,this._Jumping=!1,this._ParameterCount=e,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(e,t){return this._Repeat=e,this._OnRepeatCallback=e?t:null,this}start(e,t){this._NextEndCallback=e,this._EndCallback=null,this._AdvanceCallback=t,this._StartSwitcher=!0,this._Jumping=!1,this._StateMachineNext()}pause(e){this._AdvanceCallback=null,null===this._EndCallback&&null===this._NextEndCallback||(this._EndCallback=null,this._NextEndCallback=null),0===this._StateIndex?e&&this._CallbackWithCatch(this._Current,e):(e&&(this._PausedCallback=e),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(e,t,i,s){console.warn("Should Override")}_WrapCallback(e,t){console.warn("Should Override")}_CallbackWithCatch(e,t){try{this._WrapCallback(e,t)}catch(e){console.error("Error:in callback"),console.error(e)}}_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 e=this._JumpTarget?[...this._JumpTarget]:[...this._Current],t=this._Target,s=this._Repeat?[...this._RepeatStart]:null,n=this._WrapBuildAnimation(s,e,t,this._Jumping);if(this._JumpTarget=null,this._Jumping=!1,null===n)return;const r=[...t],a=this,o=(new i.AnimationListener).OnFinalProgress((t=>{a._OnPaused(null!==s?s:e,r,t)})).OnAdvance((e=>{this._AdvanceCallback&&this._AdvanceCallback(e)}));return this._OnRepeatCallback&&o.OnRepeat((e=>{a._OnRepeatCallback&&a._OnRepeatCallback(e)})),n.AddAnimationListener(o),n.Enable(i.AnimationEnable.KeepTransform),this._Repeat&&n.EnableInfinite(),this._SpriteView.StartAnimation(n),!0}_StopAnimation(){this._SpriteView.StopAnimation()}_OnPaused(e,t,i){for(let s=0;s<this._ParameterCount;s++)this._Current[s]=Math.floor((t[s]-e[s])*i+e[s]);this._StateLocked=!0;const s=this._PausedCallback,n=this._EndCallback;this._PausedCallback=null,s&&this._CallbackWithCatch(this._Current,s),n&&1===i&&(this._EndCallback=null,this._CallbackWithCatch(this._Current,n)),this._StateLocked=!1,this._StateIndex=0;this._StateMachineNext()}_SetView(e){this._SpriteView=e}}{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(e){return this._AllowFrameStep=e,this}selectMode(e){switch(e){case"UniformMotion":this._Mode=0;break;case"AcceleratedMotion":this._Mode=1,this.setRepeat(!1);break;default:console.error(`Unsupported input=${e}`)}return this}targetX(e){return this._Target[0]=e,this}targetY(e){return this._Target[1]=e,this}target(e,t){return this._Target[0]=e,this._Target[1]=t,this}enableRepeatFrom(e,t,i){if(this._ComfirmMode(0))return this.setRepeat(!0,i),this._RepeatStart[0]=e,this._RepeatStart[1]=t,this}speed(e){if(console.log(`speed, pixel_per_second:${e}`),this._ComfirmMode(0))return this._Speed=e,this}accelerateX(e,t){if(this._ComfirmMode(1))return this._Target[0]=t,this._VerlocityAcc=e,this._VerlocityInit=0,this._AccAlongX=!0,this}accelerateY(e,t){if(this._ComfirmMode(1))return this._Target[1]=t,this._VerlocityAcc=e,this._VerlocityInit=0,this._AccAlongX=!1,this}decelerateX(e,t){if(this._ComfirmMode(1))return this._VerlocityAcc=e,this._VerlocityInit=t,this._AccAlongX=!0,this}decelerateY(e,t){if(this._ComfirmMode(1))return this._VerlocityAcc=e,this._VerlocityInit=t,this._AccAlongX=!1,this}decelerate(e,t,i,s){if(1===this._Mode)return this._VerlocityAcc[0]=e,this._VerlocityAcc[1]=t,this._VerlocityInit[0]=i,this._VerlocityInit[1]=s,this;console.error("Error: mode error")}_ComfirmMode(e){return this._Mode===e||(console.error("Error: mode error"),!1)}_WrapBuildAnimation(e,t,i,s){return s?this._AnimationRef=this._UniformMove(null,t,i,s):0===this._Mode?this._AnimationRef=this._UniformMove(e,t,i,!1):1===this._Mode&&(this._AnimationRef=this._AccelerMove(t,i)),this._AnimationRef}_UniformMove(e,t,s,n){let r=0,a=0,o=0,l=1;const h=t[0],c=t[1],u=s[0],d=s[1];if(null!==e){r=e[0],a=e[1];const t=this._Distance(h,c,u,d),i=this._Distance(r,a,u,d);o=(i-t)/i,n||(l=1e3*i/this._Speed)}else r=h,a=c,o=0,n||(l=1e3*this._Distance(h,c,u,d)/this._Speed);n||0!==l||console.warn("Discard starting request for no distance");let f=null;if(r!==u&&a!==d||n||!this._AllowFrameStep||!window.JsView)f=new i.TranslateAnimation(r,u,a,d,l,null);else{console.log("Using frame translate animation");let e=0,t=0,s=!0;r!==u?(e=r,t=u,s=!0):(e=a,t=d,s=!1),f=new i.TranslateFrameAnimation(e,t,this._Speed,s)}return 0!==o&&(o<0?console.warn("Warning: start position out of repeating range"):f.SetStartPos(o)),f}_AccelerMove(e,t){const s=this._AccAlongX?e[0]:e[1],n=this._VerlocityInit,r=this._VerlocityAcc;let a,o,l,h,c=!0;if(0!==r)return 0===n?(a=this._AccAlongX?t[0]:t[1],o=Math.floor(1e3*Math.sqrt(2*Math.abs(a-s)/r)),c=!0):(o=Math.floor(1e3*Math.abs(n)/r),a=s+Math.floor(5e-4*n*o),c=!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(e[0],l,e[1],h,o,c?i.Easing.Circular.In:i.Easing.Circular.Out);console.error("Error: no found acceleration")}_Distance(e,t,i,s){const n=i-e,r=s-t;return Math.sqrt(n*n+r*r)}_WrapCallback(e,t){this._AnimationRef=null,t&&t(e[0],e[1])}};class Te extends i.LayoutView{constructor(){super(),this._ChildTextView=null}PutChildTextView(e){this._ChildTextView=e,this.AddView(e)}EnableAutoHeight(){this._ChildTextView.EnableAutoHeight()}}class Se{StringWithFont(e,t,i,s,n,r,a,o,l,h,c){t||(t=Se._sDefaultFontSize),i||(i=Se._sDefaultFont);let u="";!0===a&&(u="italic");let d="";return!0===o&&(d="bold"),s||(s="left"),n||(n="middle"),r||(r=Se._sDefaultFontColor),l||(l=null),c||(c="top"),h||(h=-1),{str:`${e}`,font:i,size:t,italic:u,bold:d,stroke_width:h,alignment:s,vertical_align:n,textColour:r,backgroundColour:Se._sDefaultBackgroundColor,enableBlend:!0,shadow:l,vertical_area_align:c}}TextAttr(e,t){return e||(e="none"),t||(t="none"),{text_overflow:e,word_wrap:t}}GetTextWidth(...e){if(e.length<=1){let t=e[0];return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextWidth(t):t.str.length*t.size+1}{let t=e[0];if(void 0!==window.PlatformUtils){let i={str:t,font:e[1]?e[1]:"黑体",size:e[2],bold:e[3],italic:e[4]};return window.PlatformUtils.GetTextWidth(i)}return t.length*t.size+1}}GetTextRect(e,t,i,s,n){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextRect(e,t,i,s,n):{width:t.width,height:t.height}}GetTextInfo(e,t,i,s,n){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextInfo(e,t,i,s,n):{start:0,end:e.length,width:t.width,height:t.height}}GetCursorOffset(e,t,i,s,n,r,a){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorOffset(e,t,i,s,n,r,a):0}GetCursorPosition(e,t,i,s,n,r){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorPosition(e,t,i,s,n,r):{x:0,y:0}}BuildTextView(e,t,s,n,r,a,o,l,h,c,u){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 f=e.GetTextTextureFromStylePack(t,s,!!n,r,a,o,l,h,c,u);if(n&&setTimeout((()=>{n({width:d.Element.clientWidth,height:d.Element.clientHeight})})),null===f)return console.error("Error: Build text texture failed!"),null;d.ResetTexture(new i.TextureSetting(f,null,null,!0)),t.length<10?d.SetId("Text-"+t):d.SetId("Text-Long-"+t.length),d.ResetLayoutParams({x:0,y:0,width:r.width,height:r.height});const g=s.DS.Describe;if("middle"===g.vertical_area_align||"bottom"===g.vertical_area_align){const e=new Te;e.PutChildTextView(d),d.Element.style.display="table-cell",d.Element.style.position="static",e.Element.style.display="table",e.Element.style.position="static",d=e}return d}}Se._sDefaultFont="黑体",Se._sDefaultFontSize=30,Se._sDefaultFontColor="#FFFFFF",Se._sDefaultBackgroundColor="rgba(0, 0, 0, 0)",i.TextUtils=Se,i.sTextUtils=new i.TextUtils;class Ce{constructor(){this._InnerViews={},this._ViewToken=1}add(e){const t=++this._ViewToken;return this._InnerViews[`${t}`]=e,t}remove(e){this._InnerViews[e]&&delete this._InnerViews[e]}get(e){return this._InnerViews[e]}clear(){this._InnerViews={},this._ViewToken=1}}i.ViewStore=Ce,i.sViewStore=new Ce;i.ViewInfo=class{constructor(e,t){this.view=e,this.layout_params=t}};let Ee=0;i.AnimationBase=class{constructor(){this.IdToken=Ee++,this._AttachedGroup=null,this.AnimationListenerObj=null,this._AnimationClose=!1,this._LayoutViewRef=null,this._IsTextureAnim=!1}SetAnimationListener(e){this.AnimationListenerObj=e,this.OnNewListener(e)}AddAnimationListener(e){this.AnimationListenerObj&&e.AddInherit(this.AnimationListenerObj),this.AnimationListenerObj=e,this.OnNewListener(e)}OnNewListener(e){}GetAnimationListener(){return this.AnimationListenerObj}Cancel(e){this._LayoutViewRef&&this._LayoutViewRef.DetachAnimation(this);const t=this.AnimationListenerObj;if(t&&t.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,t.OnAnimationEnd(!1)),this._AttachedGroup){let t=!0;e&&(t=e._AttachedGroup!==this._AttachedGroup),t&&(this._AttachedGroup.CancelFromInternalAnimation(this),this._AttachedGroup=null)}}AttachToGroup(e){null!==this._AttachedGroup&&i.ThrowError("ERROR: In TransformAnimation.AttachToGroup(), animation already attached to other group"),this._AttachedGroup=e}RemoveFromGroup(){this._AttachedGroup=null}AsTextureAnimation(){this._IsTextureAnim=!0}Start(e){this._LayoutViewRef=e}SetCannotDisable(e){}OnStart(){const e=this.AnimationListenerObj;e&&e.OnAnimationStart&&e.OnAnimationStart()}OnEnd(e){this._LayoutViewRef&&!e&&(this._LayoutViewRef.DetachAnimation(this),this._LayoutViewRef=null);const t=this.AnimationListenerObj;t&&t.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,t.OnAnimationEnd(!0))}OnRepeatEvent(){const e=this.AnimationListenerObj;e&&e.OnAnimRepeat&&e.OnAnimRepeat()}OnViewHide(){const e=this.AnimationListenerObj;e&&e.OnViewNoVisible&&e.OnViewNoVisible()}OnFinalProgress(e){const t=this.AnimationListenerObj;t&&t.OnAnimFinal&&t.OnAnimFinal(e)}OnAnimAdvance(e){const t=this.AnimationListenerObj;t&&t.OnAnimAdvance&&t.OnAnimAdvance(e)}};i.AnimationListener=class{constructor(e,t,i){this.OnAnimationStart=e,this._OnAnimationStart=e,this.OnAnimationEnd=t,this._OnAnimationEnd=t,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(e){return this._OnAnimationStart=e,this.OnAnimationStart=e,this}OnEnd(e){return this._OnAnimationEnd=e,this.OnAnimationEnd=e,this}OnAdvance(e){return this._OnAnimAdvance=e,this.OnAnimAdvance=e,this}OnFinalProgress(e){return this._OnAnimFinal=e,this.OnAnimFinal=e,this}OnRepeat(e){return this._OnAnimRepeat=e,this.OnAnimRepeat=e,this}AddInherit(e){if(e){if(0===this._InheritListener.length){const e=this;this.OnAnimationStart=function(){e._OnAnimationStart&&e._OnAnimationStart();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimationStart&&e._InheritListener[t].OnAnimationStart()},this.OnAnimationEnd=function(t){e._OnAnimationEnd&&e._OnAnimationEnd(t);for(let i=0;i<e._InheritListener.length;i++)e._InheritListener[i].OnAnimationEnd&&e._InheritListener[i].OnAnimationEnd(t)},this.OnViewNoVisible=function(){e._OnViewNoVisible&&e._OnViewNoVisible();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnViewNoVisible&&e._InheritListener[t].OnViewNoVisible()},this.OnAnimFinal=function(t){e._OnAnimFinal&&e._OnAnimFinal(t);for(let i=0;i<e._InheritListener.length;i++)e._InheritListener[i].OnAnimFinal&&e._InheritListener[i].OnAnimFinal(t)},this.OnAnimRepeat=function(){e._OnAnimRepeat&&e._OnAnimRepeat();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimRepeat&&e._InheritListener[t].OnAnimRepeat()},this.OnAnimAdvance=function(){e._OnAnimAdvance&&e._OnAnimAdvance();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimAdvance&&e._InheritListener[t].OnAnimAdvance()}}this._InheritListener.push(e)}}};class xe{constructor(e){this._SS=e}insertRule(e){window.jsvInAndroidWebView&&(e=(e=e.replace(/@keyframes/,"@-webkit-keyframes")).replace(/transform/g,"-webkit-transform"));const t=this._SS.cssRules.length;this._SS.insertRule(e,t)}removeRule(e){this.removeMultiRules([e])}hasRule(e){const t=this._SS.cssRules;for(let i=t.length-1;i>=0;i--)if(t[i].name===e)return!0;return!1}removeMultiRules(e){const t=this._SS,i=this._SS.cssRules;for(let s=i.length-1;s>=0;s--)for(const n in e)if(i[s].name===e[n]){e.splice(n,1),t.deleteRule(s);break}}}let Ie=null;function Ae(){return null===Ie&&(Ie=function(e){let t=null;const i=document.styleSheets;if(!i||0===i.length)return console.error("Error: styleSheet empty"),null;if(e){for(let s=0;s<i.length;++s){const n=i[s];if(n.cssRules[0]&&n.cssRules[0].name&&n.cssRules[0].name===e){t=n;break}}if(null===t)return console.error(`Error: no found tag=${e}`),null}else t=i[0];return new xe(t)}()),Ie}function Re(e){let t="linear";if(e&&void 0!==e.T)switch(e.T){case i.EasingTypeIn:t="ease-in";break;case i.EasingTypeOut:t="ease-out";break;case i.EasingTypeInOut:t="ease-in-out";break;case i.EasingTypeBezier:t=`cubic-bezier(${e.St.X1},${e.St.Y1},${e.St.X2},${e.St.Y2})`;break;case i.EasingTypeSteps:t=`steps(${e.St.S},${0===e.St.T?"start":"end"})`;case i.EasingTypeBlink:case i.EasingTypeDeceleration:}return t}function Pe(e,t){const i=-1===e.repeatTimes?"infinite":e.repeatTimes;let s="linear";e.easing&&(s=Re(e.easing));return`${t} ${e.duration/1e3}s ${s} ${e.delayedTime/1e3}s ${i}`}const Oe=e=>e>=65&&e<=90||e>=97&&e<=122,Le=e=>e>=48&&e<=57,De=e=>{if(!e)return null;let t="",i="",s=[],n=0;for(let r=0;r<e.length;r++){const a=e.charCodeAt(r);if(0===n?(Oe(a)||Le(a))&&(t+=e[r]):(Le(a)||46===a||45===a||101===a)&&(i+=e[r]),40===a)n=1,i="",s=[];else{if(41===a)return s.push(parseFloat(i)),{name:t,params:s};44===a&&(s.push(parseFloat(i)),i="")}}return console.error("transform error",e),null};function ke(e){const t=e.Element.children;let i=null;for(let e=0;e<t.length;e++)if("_AnimateProgressTracer"===t[e].id){i=t[e];break}return null===i&&(i=window.originDocument.createElement("div"),i.id="_AnimateProgressTracer",e.Element.appendChild(i)),i}let Me=0;class Fe{constructor(e){this._TracerDiv=ke(e),this._IdToken=Me++,this._KeyFrameName=null,this._AdvanceTimer=null,this._AdvanceListener=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=e=>{e.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 e=this.GetProgress();this._AdvanceListener(e),1===e&&this._ClearAdvanceTimer()}),100))}Start(e,t,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(t,this._IdToken,this._TracerDiv._ForgeProgressToken),this._TracerDiv.style.animation=Pe(e,this._KeyFrameName),this._TracerDiv.addEventListener("animationend",this._OnEndListener),this._NotifyAdvance()}Stop(){const e=this.GetProgress();return this._TracerDiv.style.animation=null,this._KeyFrameName&&(this._RemoveTraceKeyFrame(this._KeyFrameName),this._KeyFrameName=null),this._AdvanceListener&&(this._ClearAdvanceTimer(),this._AdvanceListener(e),this._AdvanceListener=null),e}GetProgress(){const e=window.getComputedStyle(this._TracerDiv);if(0===e.transform.length);else if(e.transform.length>0&&"none"!==e.transform){const t=De(e.transform);return null!==t?t.params[4]/1e3:(console.error("Error:internal error"),0)}return 1}_BuildTraceKeyFrame(e,t,i){const s=`_AnimateProgress_${t}_${i}`,n=Ae(),r=`@keyframes ${s}\n {0%{transform:translate3d(${Math.floor(1e3*e)}px,0,0)}\n 100%{transform:translate3d(1000px,0,0)}}`;return n.insertRule(r),s}_RemoveTraceKeyFrame(e){Ae().removeRule(e)}}class Ve{constructor(e,t){this._TracerDiv=ke(e),this._IdToken=Me++,this._KeyFrameNameArray=null,this._StepsTotal=t,this._RunAnimList=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=e=>{e.stopPropagation()},this._TracerDiv.addEventListener("animationend",this._OnEndListener)}Start(e){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(e),this._TracerDiv.style.animation=this._RunAnimList[0]}TriggerNextStep(e){this._TracerDiv.style.animation=this._RunAnimList[e]}Stop(){const e=this.GetProgress();return this._TracerDiv.style.animation=null,null!==this._KeyFrameNameArray&&(this._RemoveTraceKeyFrameGroup(),this._KeyFrameNameArray=null),e}GetProgress(){const e=window.getComputedStyle(this._TracerDiv);if(0===e.transform.length);else if("none"!==e.transform){const t=De(e.transform);if(null!==t){return t.params[4]/(100*this._StepsTotal)}return console.error("Error:internal error"),0}return 1}_BuildTraceKeyFrameGroup(e,t){this._KeyFrameNameArray=new Array(this._StepsTotal);const i=Ae();for(let s=0;s<this._KeyFrameNameArray.length;s++){const n=`_AnimateGroupProgress_${e}_${t}_Cnt_${s===this._KeyFrameNameArray.length-1?"finalStep":`${s}`}`,r=`@keyframes ${n}\n {0%{transform:translate3d(${100*s}px,0,0)}\n 100%{transform:translate3d(${100+100*s}px,0,0)}}`;i.insertRule(r),this._KeyFrameNameArray[s]=n}}_RemoveTraceKeyFrameGroup(){const e=Ae();this._KeyFrameNameArray.forEach((t=>{e.removeRule(t)}))}_ConvertToAnimationStyle(e){const t=[];for(let i=0;i<e.length;i++){let s="linear";const n=e[i];n.easing&&(s=Re(n.easing)),t.push(`${this._KeyFrameNameArray[i]} ${n.duration/1e3}s ${s}`)}return t}}let je=0;i.AnimationDelegate=class extends i.AnimationBase{constructor(e,t,i){super();let s=null;i&&(s=i.Package()),this.typeName=e,this.duration=t,this.easing=s,this.repeatTimes=1,this.delayedTime=0,this.enableFlags=-1,this.enableStartPos=0,this._Progress=null}EnableDelay(e){return this.delayedTime=e,this}SetStartPos(e){this.enableStartPos=e}EnableInfinite(){return this.repeatTimes=-1,this}SetRepeat(e){return this.repeatTimes=e,this}Enable(e){return this._EnableFlagsInner(e),this}OnNewListener(e){let t=0;e.OnAnimFinal&&(t|=i.AnimationEnable.AckFinalProgress),e.OnAnimRepeat&&(t|=i.AnimationEnable.AckRepeat),0!==t&&this._EnableFlagsInner(t)}_EnableFlagsInner(e){-1!==this.enableFlags?this.enableFlags|=e:this.enableFlags=e}_GetCSSKeyframesRule(e){let t=null;const i=document.styleSheets;for(let s=0;s<i.length;++s)if(i[s]&&i[s].cssRules){for(const n in i[s].cssRules)if(i[s].cssRules[n].name===e){t=i[s].cssRules[n];break}if(t)break}return t}CheckCssAnimationFormat(e){const t=this._GetCSSKeyframesRule(e);if(t&&t.cssRules)for(const i in t.cssRules){if(!t.cssRules[i]||!t.cssRules[i].style)continue;if(!t.cssRules[i].style.opacity&&!t.cssRules[i].style.transform)continue;const s=t.cssRules[i].style.transform;s&&(-1!==s.indexOf("rotate(")?console.error(`@keyframe ${e}, only support rotate3d, current transform:${s}`):-1!==s.indexOf("translate(")?console.error(`@keyframe ${e}, only support translate3d, current transform:${s}`):-1!==s.indexOf("scale(")&&console.error(`@keyframe ${e}, only support scale3d, current transform:${s}`))}}},i.KeyFrameAnimation=class extends i.AnimationDelegate{constructor(e,t,i){super(e,t,i),this._KeyFrameNameToRecycle=null,this._TestRepeat=this._TestRepeat.bind(this),this._LatestProgressValue=0;const s=this;this._OnEndEvent=e=>{e.stopPropagation(),s._PerformAnimationEnd(!0)},this._CurrentEndEventFunc=null}Start(e){super.Start(e),e.ResetCssTransform(null,null),e.Element&&(e.Element.style.pointerEvents="auto"),this.enableStartPos>0?this._EnableStarterAnimation():this._EnableCssAnimation(this._BuildKeyFrame(),this._OnEndEvent,0)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableStarterAnimation(){let e=this._OnEndEvent;if(1!==this.repeatTimes){const t=this;e=e=>{e.stopPropagation(),null!==t._Progress&&t._Progress.Stop(),t.delayedTime=0,t.repeatTimes>0&&(t.repeatTimes-=1),this.OnRepeatEvent(),t._EnableCssAnimation(t._BuildKeyFrame(),t._OnEndEvent,0)}}const t=this.repeatTimes,i=this.duration;this.repeatTimes=1,this.duration*=1-this.enableStartPos,this._EnableCssAnimation(this._BuildStarterKeyFrame(),e,this.enableStartPos),this.repeatTimes=t,this.duration=i}_EnableCssAnimation(e,t,s){if(null===e)return;null!==e.keyFrameString&&(Ae().insertRule(e.keyFrameString),this._KeyFrameNameToRecycle=e.name);const n=e.name;this.CheckCssAnimationFormat(n);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 Fe(this._LayoutViewRef),this._Progress.Start(this,s,(e=>{this.OnAnimAdvance(e)})),0!=(this.enableFlags&i.AnimationEnable.AckRepeat)&&(this._LatestProgressValue=0,i.sRenderBridge.RegisterPerFrameCallback(this._TestRepeat)));const a=Pe(this,n);window.jsvInAndroidWebView?(r.style.webkitAnimation=a,r.addEventListener("webkitAnimationEnd",t)):(r.style.animation=a,r.addEventListener("animationend",t)),this._CurrentEndEventFunc=t}_PerformAnimationEnd(e){if(null!==this._CurrentEndEventFunc){const e=this._LayoutViewRef.Element,t=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?e.removeEventListener("webkitAnimationEnd",t):e.removeEventListener("animationend",t)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(e&&this.OnEnd());0!=(this.enableFlags&i.AnimationEnable.AckRepeat)&&i.sRenderBridge.UnregisterPerFrameCallback(this._TestRepeat);let t=this._Progress.Stop();if(e&&(t=1),0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(t);this._LayoutViewRef.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),0!=(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(t)}),0),null!==this._KeyFrameNameToRecycle&&(Ae().removeRule(this._KeyFrameNameToRecycle),this._KeyFrameNameToRecycle=null)}_TestRepeat(){const e=this._Progress.GetProgress();this._LatestProgressValue>e&&this.OnRepeatEvent(),this._LatestProgressValue=e}_BuildStarterKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_BuildKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}},i.TranslateAnimation=class extends i.KeyFrameAnimation{constructor(e,t,i,s,n,r){super("TL",n,r),this.startX=e,this.startY=i,this.endX=t,this.endY=s}_BuildStarterKeyFrame(){if(this.enableStartPos>0){const e=(this.endX-this.startX)*this.enableStartPos+this.startX,t=(this.endY-this.startY)*this.enableStartPos+this.startY,i="_ForgeAnim_TL_"+je++;return{name:i,keyFrameString:`@keyframes ${i} {0%{transform:translate3d(${e}px,${t}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}console.error("Error: no enabled starter position")}_BuildKeyFrame(){const e="_ForgeAnim_TL_"+je++;return{name:e,keyFrameString:`@keyframes ${e} {0%{transform:translate3d(${this.startX}px,${this.startY}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}_GetFrozenTransform(e){return{transform:`translate3d(${Math.floor((this.endX-this.startX)*e+this.startX)}px,${Math.floor((this.endY-this.startY)*e+this.startY)}px,0)`,transformOrigin:null}}},i.FuncAnimation=class extends i.AnimationDelegate{constructor(e,t,i){super("FC2",t,i),this.formula=e,console.warn("NO implemented")}},i.RotateAnimation=class extends i.AnimationDelegate{constructor(e,t,s,n,r,a){super("RO",r,a),s instanceof i.Vec3||(s=new i.Vec3(s)),n instanceof i.Vec3||(n=new i.Vec3(n)),this.startAngle=e,this.offsetAngle=t,this.anchorVec3=s,this.axisVec3=n,console.warn("NO implemented")}},i.BasicScaleAnimation=class extends i.AnimationDelegate{constructor(e,t,i,s,n,r,a,o,l,h){super("SC",a,o),console.warn("NO implemented")}},i.ScaleAnimation=class extends i.BasicScaleAnimation{constructor(e,t,i,s,n,r){const a=200;super(e*a,e*a,t*a,t*a,i,s,n,r,200,200)}},i.OpacityAnimation=class extends i.AnimationDelegate{constructor(e,t,i,s){super("OP",i,s),console.warn("NO implemented")}},i.CssKeyframeAnimation=class extends i.KeyFrameAnimation{constructor(e,t,i,s,n){super("CK",t,i),this._keyFramesSet=e}_BuildKeyFrame(){const e=this._keyFramesSet;if(e.indexOf("@keyframes")<0&&e.indexOf("@-webkit-keyframes")<0)return console.warn("Warning:keyframes array empty"),null;let t=e.split(" ")[1];return t.indexOf("{")>=0&&(t=t.substr(0,t.indexOf("{"))),{name:t,keyFrameString:null}}_GetLastKeyframeTransform(e){let t=e.indexOf("to");if(t<0&&(t=e.indexOf("100%")),t<0)return"";{let i=e.indexOf("transform:",t);return i<0?"":e.substring(i+10,e.indexOf(";",i))}}_GetFrozenTransform(e){let t={transform:"",transformOrigin:null};return 1===e?t={transform:this._GetLastKeyframeTransform(this._keyFramesSet),transformOrigin:null}:console.warn("CssKeyframeAnimation can not get transform whill progress is not 1"),t}},i.CssTransitionAnimation=class extends i.AnimationDelegate{constructor(e){super("CT",null,null),this._transArray=e}Start(e){super.Start(e);const t=this,i=this._transArray,s={};if(0===i.length)return void console.warn("Warning:transition empty");let n="";for(let e=0;e<i.length;e++){let t="linear";const r=i[e];r.tf&&(t=Re(r.tf)),n=`${r.name} ${r.dur/1e3}s ${t} ${r.dly/1e3}s`,s[r.name]=n}e.ApplyStyleTransition(s),n&&(e.Element.addEventListener("transitionend",(e=>{e.stopPropagation(),t.OnEnd(!0)})),e.Element.addEventListener("webkitTransitionEnd",(e=>{e.stopPropagation(),t.OnEnd(!0)})))}},i.KeyFrameGroupAnimation=class extends i.AnimationDelegate{constructor(e){super(e,0,null),this._KeyFrameArray=null,this._LatestProgressValue=0,this._CurrentEndEventFunc=null,this._Progress=null,this._AnimRunList=null,this._AnimationRunIndex=0;const t=this;this._OnEndEvent=e=>{e.stopPropagation(),this._TestFinalKeyFrame(e)?t._PerformAnimationEnd(!0):(this._AnimationRunIndex++,this._LayoutViewRef.Element.style.animation=this._AnimRunList[this._AnimationRunIndex],this._Progress.TriggerNextStep(this._AnimationRunIndex),t._OnSubKeyFrameDone(e))}}Start(e){super.Start(e),e.ResetCssTransform(null,null),e.Element&&(e.Element.style.pointerEvents="auto"),this._EnableCssAnimation(this._BuildKeyFrameGroup(),this._OnEndEvent)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableCssAnimation(e,t){if(null===e)return;this._KeyFrameArray=new Array(e.length);const s=Ae();for(let t=0;t<e.length;t++){const i=e[t];this.CheckCssAnimationFormat(i.name),this._KeyFrameArray[t]={name:i.name,easing:i.ease.Package(),duration:i.duration,needRecycle:!1},null!==i.keyFrameString&&(s.insertRule(i.keyFrameString),this._KeyFrameArray.needRecycle=!0)}const n=this._LayoutViewRef.Element;0==(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&i.AnimationEnable.KeepTransform)||(this._Progress=new Ve(this._LayoutViewRef,this._KeyFrameArray.length),this._Progress.Start(this._KeyFrameArray)),this._AnimRunList=this._ConvertToAnimationStyle(this._KeyFrameArray),this._AnimationRunIndex=0,window.jsvInAndroidWebView?(n.style.webkitAnimation=this._AnimRunList[0],n.addEventListener("webkitAnimationEnd",t)):(n.style.animation=this._AnimRunList[0],n.addEventListener("animationend",t)),this._CurrentEndEventFunc=t}_PerformAnimationEnd(e){if(null!==this._CurrentEndEventFunc){const e=this._LayoutViewRef.Element,t=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?e.removeEventListener("webkitAnimationEnd",t):e.removeEventListener("animationend",t)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(e&&this.OnEnd());let t=this._Progress.Stop();if(e&&(t=1),0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(t);this._LayoutViewRef.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),0!=(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(t)}),0);const s=Ae();for(const e of this._KeyFrameArray)e.needRecycle&&s.removeRule(e.name);this._KeyFrameArray=null}_ConvertToAnimationStyle(e){const t=[];for(let i=0;i<e.length;i++){let s="linear";const n=e[i];n.easing&&(s=Re(n.easing)),t.push(`${n.name} ${n.duration/1e3}s ${s}`)}return t}_BuildKeyFrameGroup(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_TestFinalKeyFrame(e){console.warn("Warning:Should override")}_OnSubKeyFrameDone(e){console.warn("Warning:Should override")}},i.TranslateFrameAnimation=class extends i.TranslateAnimation{constructor(e,t,i,s,n,r){let a=n,o=r,l=n,h=r;s?(a=e,l=t):(o=e,h=t);super(a,l,o,h,Math.abs(Math.floor((t-e)/i*1e3)),null)}},i.ThrowAnimation=class extends i.KeyFrameGroupAnimation{constructor(e,t,i,s,n,r,a,o){super("Thr"),this._FromX=e,this._FromY=t,this._XorY=i,this._InitV=s,this._Acc=n,this._To=r,this._HasPole=a,this._PoleCallback=null,this._PolePosition=o,this._IsPositiveMove=this._InitV>0||0===this._InitV&&this._Acc>0}SetPoleCallback(e){this._PoleCallback=e}_MakeTranslateString(e,t,i){return`@keyframes ${e} {0%{transform:translate3d(${t.x.value}px,${t.y.value}px,0);}100%{transform:translate3d(${i.x.value}px,${i.y.value}px,0);}}`}_BuildKeyFrameGroup(){const e=""+je++,t=[],s={x:{value:this._FromX},y:{value:this._FromY}},n={x:{value:this._FromX},y:{value:this._FromY}},r=0===this._XorY?s.x:s.y,a=0===this._XorY?n.x:n.y;if(this._HasPole){let o=`_ForgeAnim_Thr_Forw_${e}`;a.value=this._PolePosition;let l=this._MakeTranslateString(o,s,n);t.push({name:o,keyFrameString:l,ease:i.Easing.Circular.Out,duration:Math.floor(-this._InitV/this._Acc*1e3)}),o=`_ForgeAnim_Thr_Backw_${e}`,r.value=this._PolePosition,a.value=this._To,l=this._MakeTranslateString(o,s,n),t.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_${e}`;a.value=this._To;const l=this._MakeTranslateString(o,s,n),h=this._IsPositiveMove?this._InitV:-this._InitV,c=this._IsPositiveMove?this._Acc:-this._Acc,u=this._IsPositiveMove?a.value-r.value:r.value-a.value;t.push({name:o,keyFrameString:l,ease:c>0?i.Easing.Circular.In:i.Easing.Circular.Out,duration:Math.floor((Math.sqrt(h*h+2*c*u)-h)/c*1e3)})}return t}_GetFrozenTransform(e){const t={x:{value:this._FromX},y:{value:this._FromY}};let i=0===this._XorY?t.x.value:t.y.value;const s=0===this._XorY?t.x:t.y;let n=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 t=(2*a-i-r)*e;n=t>a-i?a-(t-(a-i)):i+t}else n=i+(r-i)*e;s.value=Math.floor(this._IsPositiveMove?n:-n);return{transform:`translate3d(${t.x.value}px,${t.y.value}px,0)`,transformOrigin:null}}_TestFinalKeyFrame(e){return this._HasPole?e.animationName.indexOf("_ForgeAnim_Thr_Backw_")>=0:e.animationName.indexOf("_ForgeAnim_Thr_Forw_")>=0}_OnSubKeyFrameDone(e){this._HasPole&&this._PoleCallback&&this._PoleCallback()}},i.AnimationEnable={ReleaseAfterEndCallback:1,KeepTransform:2,AckFinalProgress:4,AckRepeat:8};let Ne=0;class Ge extends i.AnimationDelegate{constructor(e,t){super(e,t,null),this._StepsCount=1,this._Running=!1,this._NextStepIndex=0;const i=this;this._OnStepEnd=()=>{i._NextStep()}}SetStepsCount(e){this._StepsCount=e,this._SplitSteps()}Start(e){super.Start(e),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&&(Ae().removeRule(this._KeyFrameName),this._KeyFrameName=null);const e=this._NextStepIndex===this._StepsCount;if(!this._Running||e)return void this._PerformAnimationEnd(e);const t=this._CreateOneStepKeyFrame(this._NextStepIndex);this._KeyFrameName=t.name,Ae().insertRule(t.keyFrameString);const i=Pe({repeatTimes:this.repeatTimes,easing:this.easing,delayedTime:0,duration:this.duration/this._StepsCount},this._KeyFrameName),s=this._LayoutViewRef.Element;window.jsvInAndroidWebView?s.style.webkitAnimation=i:s.style.animation=i,this._NextStepIndex++}_PerformAnimationEnd(e){window.jsvInAndroidWebView?this._LayoutViewRef.Element.removeEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.removeEventListener("animationend",this._OnStepEnd);const t=this._NextStepIndex/this._StepsCount;if(0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(this._NextStepIndex-1);this._LayoutViewRef.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),window.setTimeout((()=>{this.OnFinalProgress(t)}),0)}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_SplitSteps(){console.warn("Warning: should be override by child class")}_CreateOneStepKeyFrame(e){console.warn("Warning: should be override by child class")}}i.TranslateStepAnimation=class extends Ge{constructor(e,t,i,s,n){super("TL-S",n),this.startX=e,this.startY=i,this.endX=t,this.endY=s,this._StepsArray=null}_SplitSteps(){const e=this._StepsCount,t=(this.endX-this.startX)/e,i=(this.endY-this.startY)/e;this._StepsArray=new Array(e);let s=this.startX,n=this.startY;for(let r=0;r<e-1;r++)s+=t,n+=i,this._StepsArray[r]={targetX:Math.floor(s),targetY:Math.floor(n)};this._StepsArray[e-1]={targetX:this.endX,targetY:this.endY}}_CreateOneStepKeyFrame(e){let t=0,i=0;0===e?(t=this.startX,i=this.startY):(t=this._StepsArray[e-1].targetX,i=this._StepsArray[e-1].targetY);const s=this._StepsArray[e].targetX,n=this._StepsArray[e].targetY,r="_ForgeStepAnim_TL_"+Ne++;return{name:r,keyFrameString:`@keyframes ${r} {\n 0%{transform:translate3d(${t}px,${i}px,0);}\n 100%{transform:translate3d(${s}px,${n}px,0);}}`}}_GetFrozenTransform(e){return{transform:`translate3d(${this._StepsArray[e].targetX}px,${this._StepsArray[e].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 e=!1;if(i.sElementImpactSensorManager.HasTrace()&&(i.sElementImpactSensorManager.TestCollision(),i.sElementImpactSensorManager.HasTrace()&&(e=!0)),this._CallbacksPerFrame.size>0){for(const e of this._CallbacksPerFrame)e();this._CallbacksPerFrame.size>0&&(e=!0)}e?window.requestAnimationFrame(this._FrameLoopFunc):this._FrameLoopFunc=null}GetScreenInfo(){return this._ScreenInfo}InitScreenBuffer(e,t){isNaN(e)&&(e=1),isNaN(t)&&(t=1280);const i=t*e,s=i/16*9;this._ScreenInfo.width=Math.floor(i),this._ScreenInfo.height=Math.floor(s),this._ScreenInfo.x=2/this._ScreenInfo.width,this._ScreenInfo.y=2/this._ScreenInfo.height,this._ScreenInfo.perspective=this._ScreenInfo.x,this._ScreenInfo.scaleRatio=e,this._ScreenInfo.designedWidth=t}RequestSwap(){this._OnRequesting||(this._OnRequesting=!0,Promise.resolve().then(this._DoRequestSwap.bind(this)))}SetGlobalConfig(e){}AddWillSwapListener(e,t){this._WillSwapCallbacks.set(e,t)}_DoRequestSwap(){this._WillSwapCallbacks.size>0&&this._WillSwapCallbacks.forEach(this._DoWillSwapCallback),this._OnRequesting=!1}InstantPerformSwap(){this._OnRequesting&&(this._OnRequesting=!1,this._DoRequestSwap(!1))}_OnWillSwap(e){e()}RegisterPerFrameCallback(e){this._CallbacksPerFrame.add(e)}UnregisterPerFrameCallback(e){this._CallbacksPerFrame.delete(e)}},i.sRenderBridge=new i.RenderBridge;class Be{constructor(e,t,i){this._TextureManager=e,this._GL=t,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)}}Be.IMAGE=Symbol("Texture.IMAGE"),Be.COLOR=Symbol("Texture.COLOR");class Ue extends Be{constructor(e,t,i,s){if(super(e,t,i),s){const e=s.trim();if(0===e.indexOf("http"))this.Url=e;else if(0===e.indexOf("url")){const t=e.indexOf("("),i=e.indexOf(")");this.Url=e.substring(t+1,i)}else this.Url=s;this._TextureSource=new Image,this._TextureSource.onload=()=>{this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()},this._TextureSource.src=this.Url}}}class We{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(e,t,i,s){const n=this._GL.createImageData(1,1);return n.data[0]=e,n.data[1]=t,n.data[2]=i,n.data[3]=s,n}}let He=null;class $e extends Be{constructor(e,t,i,s){super(e,t,i),null===He&&(He=new We),this.Color=s;const n=(e=>{if(!e)return null;if(0===(e=e.trim()).indexOf("rgba")){const t=e.indexOf("("),i=e.indexOf(")");return e.substr(t+1,i-t-1).split(",").map(((e,t)=>3===t?Math.ceil(255*parseFloat(e)):parseInt(e,10)))}if(0===e.indexOf("#")){let t=e.substr(1);const i=t.length;if(6===i||8===i){6===i&&(t+="FF");const e=parseInt(`0x${t}`,10);return[e>>24&255,e>>16&255,e>>8&255,255&e]}return null}return null})(this.Color);this._TextureSource=He.getColorImageData(...n),this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()}}const Ke=new class{constructor(){this._TextureMap={}}getTexture(e,t,i,s){let n;if(this._TextureMap[s])n=this._TextureMap[s].texture,this._TextureMap[s].useCount++;else{switch(e){case Be.IMAGE:n=new Ue(this,t,i,s);break;case Be.COLOR:n=new $e(this,t,i,s);break;default:console.log(`getTexture type is error:${e}`)}this._TextureMap[s]={texture:n,useCount:1}}return n}recycle(e){this._TextureMap[e]&&(this._TextureMap[e].useCount--,this._TextureMap[e].useCount<0&&delete this._TextureMap[e])}},Ye=(e,t)=>Math.random()*(t-e)+e;class ze{constructor(e,t,i,s,n){this._ViewId=e,this._Type=t.type,this._ParticleNum=t.particleNum,this._DeltaAngle=t.deltaAngle/180*Math.PI,this._DeltaWidthFact=t.deltaWidth/s.width,this._DeltaHeightFact=t.deltaHeight/s.height,this._PointSizeMin=t.pointSizeMin,this._PointSizeMax=t.pointSizeMax,this._SpeedMin=t.speedMin,this._SpeedMax=t.speedMax,this._LifeMin=t.lifeMin/1e3,this._LifeMax=t.lifeMax/1e3,this._AddNumSpeed=t.addNumSpeed,this._AcceletateX=t.accelerateX,this._AcceletateY=t.accelerateY,this._EnableFade=t.enableFade,this._EnableShrink=t.enableShrink,this._Texture=i,this._Buffer=new Float32Array(7*this._ParticleNum),this._AddedParticleNum=0,this._Element=n,this._StartTime=-1,this._LastFrameTime=-1,this._Stopped=!1,this._getTransform=this._getTransform.bind(this)}_getTransform(){let e=this._Element.jsvMainView.Element;const t=qe(e.style.width),i=qe(e.style.height);let s=new window.WebKitCSSMatrix;for(;e.parentElement;){const t=getComputedStyle(e);if(t.transform){const i=t.transformOrigin?t.transformOrigin:t.webkitTransformOrigin;if(i){const n=qe(i),r=new window.WebKitCSSMatrix(`translate(-${n[0]}px,-${n[1]}px)`),a=new window.WebKitCSSMatrix(`translate(${n[0]}px,${n[1]}px)`),o=new window.WebKitCSSMatrix(`translate(${e.offsetLeft}px,${e.offsetTop}px)`),l=new window.WebKitCSSMatrix(t.transform);s=o.multiply(a.multiply(l.multiply(r.multiply(s))))}else s=new window.WebKitCSSMatrix(t.transform).multiply(s)}e=e.parentElement}const n=new window.WebKitCSSMatrix;n.m11=0,n.m12=0,n.m14=1,n.m21=t,n.m22=0,n.m24=1,n.m31=0,n.m32=i,n.m34=1,n.m41=t,n.m42=i,n.m44=1,s=s.multiply(n);return[s.m11,s.m12,s.m21,s.m22,s.m31,s.m32,s.m41,s.m42]}_updateParticleInfo(e,t,i,s,n,r){const a=Ye(0,2*this._DeltaWidthFact),o=Ye(0,2*this._DeltaHeightFact);this._Buffer[7*e]=a*i[0]+o*s[0]+t[0],this._Buffer[7*e+1]=a*i[1]+o*s[1]+t[1],this._Buffer[7*e+2]=n+Ye(-this._DeltaAngle,this._DeltaAngle),this._Buffer[7*e+3]=Ye(this._SpeedMin,this._SpeedMax),this._Buffer[7*e+4]=r,this._Buffer[7*e+5]=Ye(this._LifeMin,this._LifeMax),this._Buffer[7*e+6]=Ye(this._PointSizeMin,this._PointSizeMax)}onDrawFrame(e,t,i){if(!this._Texture.loaded()||this._Stopped)return;this._StartTime<0&&(this._StartTime=Date.now()),this._LastFrameTime<0&&(this._LastFrameTime=this._StartTime);const s=this._getTransform();for(let e=0;e<s.length;e++)s[e]=e%2==0?2*s[e]/window.innerWidth-1:1-2*s[e]/window.innerHeight;const n=(Date.now()-this._StartTime)/1e3,r=[s[0],s[1]],a=[s[2]-s[0],s[3]-s[1]],o=[s[4]-s[0],s[5]-s[1]],l=Math.sqrt(a[0]*a[0]+a[1]*a[1]),h=-a[1]/l,c=a[0]/l>0?Math.acos(h):2*Math.PI-Math.acos(h);if(0===this._Type)if(this._AddedParticleNum<this._ParticleNum){for(let e=0;e<this._ParticleNum;e++)this._updateParticleInfo(e,r,a,o,c,n);this._AddedParticleNum=this._ParticleNum}else{let e=!0;for(let t=0;t<this._ParticleNum;t++)if(this._Buffer[7*t+4]+this._Buffer[7*t+5]>n){e=!1;break}e&&(this._Stopped=!0)}else if(this._AddedParticleNum<this._ParticleNum){let e=Math.round((Date.now()-this._LastFrameTime)*this._AddNumSpeed);this._AddedParticleNum+e>this._ParticleNum&&(e=this._ParticleNum-this._AddedParticleNum);for(let t=0;t<e;t++)this._updateParticleInfo(this._AddedParticleNum+t,r,a,o,c,n);this._AddedParticleNum+=e}else for(let e=0;e<this._ParticleNum;e++)this._Buffer[7*e+4]+this._Buffer[7*e+5]<n&&this._updateParticleInfo(e,r,a,o,c,n);const u=e.getUniformLocation(t,"uTime");e.uniform1f(u,n);const d=e.getUniformLocation(t,"uAccelerate");e.uniform2f(d,this._AcceletateX,this._AcceletateY);const f=e.getUniformLocation(t,"uEnableFade");e.uniform1i(f,this._EnableFade?1:0);const g=e.getUniformLocation(t,"uEnableShrink");e.uniform1i(g,this._EnableShrink?1:0),e.bindBuffer(e.ARRAY_BUFFER,i),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._Texture.TextureId),e.bufferSubData(e.ARRAY_BUFFER,0,this._Buffer);const m=this._Buffer.BYTES_PER_ELEMENT,_=e.getAttribLocation(t,"aPosition");e.vertexAttribPointer(_,2,e.FLOAT,!1,7*m,0),e.enableVertexAttribArray(_);const p=e.getAttribLocation(t,"aSpeed");e.vertexAttribPointer(p,2,e.FLOAT,!1,7*m,2*m),e.enableVertexAttribArray(p);const w=e.getAttribLocation(t,"aLife");e.vertexAttribPointer(w,2,e.FLOAT,!1,7*m,4*m),e.enableVertexAttribArray(w);const v=e.getAttribLocation(t,"aPointSize");e.vertexAttribPointer(v,1,e.FLOAT,!1,7*m,6*m),e.enableVertexAttribArray(v),e.drawArrays(e.POINTS,0,this._AddedParticleNum)}recycle(){this._Buffer=null,this._Texture.recycle(),this._Stopped=!0}}let Xe=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 e=this._GL.createShader(this._GL.VERTEX_SHADER);this._GL.shaderSource(e,"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(e);const t=this._GL.createShader(this._GL.FRAGMENT_SHADER);this._GL.shaderSource(t,"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(t),this._GLProgram=this._GL.createProgram(),this._GL.attachShader(this._GLProgram,e),this._GL.attachShader(this._GLProgram,t),this._GL.linkProgram(this._GLProgram);const i=new Float32Array(3500),s=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 n=this._GL.getAttribLocation(this._GLProgram,"aPosition");this._GL.vertexAttribPointer(n,2,this._GL.FLOAT,!1,7*s,0),this._GL.enableVertexAttribArray(n);const r=this._GL.getAttribLocation(this._GLProgram,"aSpeed");this._GL.vertexAttribPointer(r,2,this._GL.FLOAT,!1,7*s,2*s),this._GL.enableVertexAttribArray(r);const a=this._GL.getAttribLocation(this._GLProgram,"aLife");this._GL.vertexAttribPointer(a,2,this._GL.FLOAT,!1,7*s,4*s),this._GL.enableVertexAttribArray(a);const o=this._GL.getAttribLocation(this._GLProgram,"aPointSize");this._GL.vertexAttribPointer(o,1,this._GL.FLOAT,!1,7*s,6*s),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 e in this._ParticleViewMap)this._ParticleViewMap.hasOwnProperty(e)&&this._ParticleViewMap[e].onDrawFrame(this._GL,this._GLProgram,this._VBO);window.requestAnimationFrame(this._onDrawFrame)}addParticle(e,t,i,s){this._Inited||this._initCanvas();const n=Xe++;let r;return r=0===t.indexOf("rgba")||0===t.indexOf("#")?Ke.getTexture(Be.COLOR,this._GL,null,t):Ke.getTexture(Be.IMAGE,this._GL,null,t),this._ParticleViewMap[n]=new ze(n,e,r,i,s),this._LoopStarted||(this._LoopStarted=!0,window.requestAnimationFrame(this._onDrawFrame)),n}recycleView(e){this._ParticleViewMap[e]&&(this._ParticleViewMap[e].recycle(),delete this._ParticleViewMap[e])}};let Je,qe=e=>{if(e.indexOf(" ")>=0){return e.split(" ").map((e=>parseInt(e.substr(0,e.length-2),10)))}return parseInt(e.substr(0,e.length-2),10)};i.ReactUtils={StyleClassMap:{}};{let e=0;class t{constructor(t,i){this._ID=i||t+e++,this.Describe={},this._RefCount=0,this._Recycled=!1}ManualSetId(e){this._ID=e}GetId(){return this._ID}DoRef(){this._RefCount++}UnRef(){this._RefCount>0?this._RefCount--:console.warn("Already 0...")}}class s extends t{constructor(e){super(null,e)}}const n=new s("DISABLE"),r={alignment:"left",vertical_align:"top",vertical_area_align:"top",text_overflow:"clip",word_wrap:"normal"},a=["alignment","vertical_align","vertical_area_align","text_overflow","word_wrap"];class o extends t{constructor(e,t,i,s,n){super("DS",null),this.Describe.alignment=e,this.Describe.vertical_align=t,this.Describe.vertical_area_align=i,this.Describe.text_overflow=s,this.Describe.word_wrap=n}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}}}const l={font:"黑体",italic:!1,bold:!1},h=["font","italic","bold"];class c extends t{constructor(e,t,i){super("FS",null),this.Describe.font=e,this.Describe.italic=t,this.Describe.bold=i}GetSyncData(){return{T:1,ID:this._ID,F:this.Describe.font,I:this.Describe.italic,B:this.Describe.bold}}}const u={text_color:"#000000",bg_color:"#00FFFFFF"},d=["text_color","bg_color"];class f extends t{constructor(e,t){super("CS",null),this.Describe.text_color=e,this.Describe.bg_color=t}GetSyncData(){return{T:2,ID:this._ID,TC:this.Describe.text_color,BC:this.Describe.bg_color}}}const g=["shadow_offset_x","shadow_offset_y","shadow_blur","shadow_color","stroke_width","stroke_color"];class m extends t{constructor(e,t,i,s,n,r){super("SS",null),this.Describe.shadow_offset_x=e,this.Describe.shadow_offset_y=t,this.Describe.shadow_blur=i,this.Describe.shadow_color=s,this.Describe.stroke_width=n,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 _{constructor(e){this.DS=i.sTextStyleCache.GetDisplayStyle(e),this.FS=i.sTextStyleCache.GetFontStyle(e),this.CS=i.sTextStyleCache.GetColorStyle(e),this.SS=i.sTextStyleCache.GetSpecialStyle(e),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(e){let t={alignment:void 0!==e.hAlign?e.hAlign:r.alignment,vertical_align:void 0!==e.vAlign?e.vAlign:r.vertical_align,vertical_area_align:void 0!==e.vAreaAlign?e.vAreaAlign:r.vertical_area_align,text_overflow:void 0!==e.textOverflow?e.textOverflow:r.text_overflow,word_wrap:void 0!==e.wordWrap?e.wordWrap:r.word_wrap,font:void 0!==e.font?e.font:l.font,italic:void 0!==e.italic?e.italic:l.italic,bold:void 0!==e.bold?e.bold:l.bold,text_color:void 0!==e.textColor?e.textColor:u.text_color,bg_color:void 0!==e.backgroundColor?e.backgroundColor:u.bg_color,shadow_offset_x:0,shadow_offset_y:0,shadow_blur:0,shadow_color:null,stroke_width:0,stroke_color:null};if(e.shadow){const i=e.shadow;t.shadow_offset_x=i.shadowOffsetX,t.shadow_offset_y=i.shadowOffsetY,t.shadow_blur=i.shadowBlur,t.shadow_color=i.shadowColor}if(e.stroke){const i=e.stroke;t.stroke_width=i.strokeWidth,t.stroke_color=i.strokeColor}return new _(t)}PrepareSyncNewStyles(){if(this._NewStyleList.length>0){let e=[];for(let t of this._NewStyleList)e.push(t.GetSyncData());i.sRenderTextureDelegateManager.CreateTextureHeadStatus().SetResourceInfo({STA:{Nam:"TST",Sta:e}}),this._NewStyleList=[]}}GetDisplayStyle(e){return this._GetStyle(e,a,o,this._DisplayStyleMap,this._DisplayStyleIds)}GetFontStyle(e){return this._GetStyle(e,h,c,this._FontStyleMap,this._FontStyleIds)}GetColorStyle(e){return this._GetStyle(e,d,f,this._ColorStyleMap,this._ColorStyleIds)}GetSpecialStyle(e){return 0===e.shadow_blur&&0===e.stroke_width?n:this._GetStyle(e,g,m,this._SpecialStyleMap,this._SpecialStyleIds)}GetDsFromId(e){return this._DisplayStyleIds.get(e)}GetFsFromId(e){return this._FontStyleIds.get(e)}GetCsFromId(e){return this._ColorStyleIds.get(e)}GetSsFromId(e){return this._SpecialStyleIds.get(e)}_GetStyle(e,t,i,s,n){let r=[];for(let i of t)r.push(e[i]);let a=r.join(":"),o=null;return s.has(a)?o=s.get(a):(o=new i(...r),s.set(a,o),n.set(o.GetId(),o),window.JsView&&this._NewStyleList.push(o)),o}}i.TextStyleObjectBase=t,i.TextStylePack=_,i.sTextStyleCache=new p}Je="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:e=>{throw new Error(e)},Assert:e=>{if(!e)throw new Error("ASSERT!!!!!")},BaseActivity:class{}};class Ze{constructor(e,t,i){this.PageName=e,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,t&&this.SetContentView(t)}OnRenderFrame(){Je.LogE("OnRenderFrame() MUST override")}OnKeyDown(e){return!1}OnKeyUp(e){return!1}DispatchKeyDown(e){if(this._KeyLock)return!0;let t=!1;return Ze.LastFocusPage=this,this._FocusChild&&(t=this._FocusChild.DispatchKeyDown(e)),t||(t=this.OnKeyDown(e)),t}DispatchKeyUp(e){if(this._KeyLock)return!0;let t=!1;return this._FocusChild&&(t=this._FocusChild.DispatchKeyUp(e)),t||(t=this.OnKeyUp(e)),t}OnCustomerEvent(e){return!1}BubbleCustomerEvent(e){this.OnCustomerEvent(e)||this._ParentPage&&this._ParentPage.BubbleCustomerEvent(e)}PrintLastFocusPage(){let e="------"+this.PageName+"\n",t=this._ParentPage;return t&&(e+=t.PrintLastFocusPage()),e}OnMouseDown(e){return!1}EnableTouchDispatcher(){this.TouchDispatcher=new i.TouchDispatcher(this)}DisableTouchDispatcher(){this.TouchDispatcher=null}GetTouchView(){return null}GetSwipeParams(e,t,i){let s=void 0===i||0===i?this._Acc:i,n=e*e/2/s;e<0&&(n=-n);let r=t*t/2/s;return t<0&&(r=-r),{durationX:Math.floor(Math.abs(e/s)),durationY:Math.floor(Math.abs(t/s)),distanceX:n,distanceY:r}}OnTouch(e){return!1}DispatchTouch(e){let t=!1;return this.TouchDispatcher&&(t=this.TouchDispatcher.OnTouch(e)),t}LostTouchFocus(e){}OnJavaKey(e,t){return!0}OnPlatformKey(e,t){return!0}PassPlatformKey(e,t){if(this._KeyLock)return!1;let i=this.OnPlatformKey(e,t);return i&&(i=this.OnJavaKey(e,t)),i}DispatchJavaKey(e,t){if(e===this._ConsumeKeycodeUntilUp)return 1===t&&(this._ConsumeKeycodeUntilUp=-1),i.LogM("Consume Javakey until up keycode="+e+" keyaction="+t),!1;if(this._KeyLock)return!1;-1!==this._ConsumeKeycodeUntilUp&&(i.LogE("ERROR: Other key pressed before locked key release"),this._ConsumeKeycodeUntilUp=-1);let s=this._FocusChild,n=!0;return s&&(n=s.DispatchJavaKey(e,t)),n&&(n=this.PassPlatformKey(e,t)),s!==this._FocusChild&&0===t&&this.CosumeAllKeyUnitlUpForFocusChange(e),n}CosumeAllKeyUnitlUpForFocusChange(e){this._ParentPage?this._ParentPage.CosumeAllKeyUnitlUpForFocusChange(e):this._ConsumeKeycodeUntilUp=e}OnHostActivityGetFocus(){this._ConsumeKeycodeUntilUp=-1}IsFocus(){return!this._ParentPage||this._ParentPage._FocusChild===this}_IsLeafInChain(){return this.IsFocus()&&!this._FocusChild}SetParent(e,t){null!==e?(null!==t&&this.SetContentView(t),e instanceof Je.BaseActivity&&(e=e.GetRootPageBase()),this._ParentPage=e,e.SubPages.push(this),this._HostActivity=e._HostActivity,e._IsShowing&&this._AutoShow&&this._OnShowInternal()):Je.ThrowError("ERROR: parent is null")}SetParentPage(e){this.SetParent(e)}RemoveSubPage(e){e===this._FocusChild&&(this._FocusChild=null),e===this._LatestFocusChild&&(this._LatestFocusChild=null);for(let t=0;t<this.SubPages.length;t++)if(e===this.SubPages[t]){e._OnHideInternal(),this.SubPages.splice(t,1);break}}ClearSubPages(){this.SubPages=[],this._FocusChild=null,this._LatestFocusChild=null}GetParentPage(){return this._ParentPage}Focus(e){if(this.IsFocus()){if(!e)return void Je.LogI("Already focused page_name="+this.PageName);if(this._IsLeafInChain())return void Je.LogI("Already focused page_name="+this.PageName)}if(Ze.sChangingFocusLock)return void Ze.sDelayedFocusChanges.push(this);if(Ze.sChangingFocusLock=!0,this._ParentPage){let t,i=[],s=this;for(;s._ParentPage&&!s.IsFocus();)i.push(s),s=s._ParentPage;t=e&&0===i.length?this._FocusChild:i[i.length-1]._ParentPage._FocusChild;let n=[];for(;t;)n.push(t),t=t._FocusChild;for(let e=n.length-1;e>=0;e--)n[e]._BlurInternal();for(let e=i.length-1;e>=0;e--)i[e]._FocusInternal();if(!e){let e=i[0];for(;e._LatestFocusChild&&null===e._FocusChild;)e._LatestFocusChild._FocusInternal(),e=e._FocusChild,e||Je.ThrowError("ERROR: focus chain is broken")}}Ze.sChangingFocusLock=!1;let t=Ze.sDelayedFocusChanges.length;if(t>0){let e=Ze.sDelayedFocusChanges;Ze.sDelayedFocusChanges=[];for(let i=0;i<t;i++)e[i].Focus()}}_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()):Je.LogW("Not focus yet, page name="+this.PageName)}GetFocusChild(){return this._FocusChild}Hide(){this._AutoShow=!1,this._OnHideInternal()}Show(e){this._OnShowInternal(),e&&this.Focus()}OnFocus(){Je.LogW("No overrided Page OnFocus event, page name="+this.PageName)}OnBlur(){Je.LogW("No overrided Page OnBlur event, page name="+this.PageName)}OnShow(){Je.LogW("No overrided Page OnShow event, page name="+this.PageName)}OnHide(){Je.LogW("No overrided Page OnHide event, page name="+this.PageName)}_OnShowInternal(){let e;for(let t=0;t<this.SubPages.length;t++)e=this.SubPages[t],e._AutoShow&&e._OnShowInternal();this._IsShowing||(this._IsShowing=!0,this.OnShow())}_OnHideInternal(){let e;for(let t=0;t<this.SubPages.length;t++)e=this.SubPages[t],e._IsShowing&&e._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(e){null!==e&&(null!==this._CVSet&&this._CVSet.View.BindedPageBase(null),this._CVSet=new i.MainViewSetting(e,null),e.BindedPageBase(this))}OnContentViewLostInternal(){this.OnContentViewLost()}OnContentViewLost(){}GetHostActivity(){return this._HostActivity}SetHostActivity(e){this._HostActivity=e}GetTextureManager(){return null!==this._HostActivity?this._HostActivity.GetTextureManager():null}SetAutoShow(e){this._AutoShow=e}KeyLock(){this._KeyLock=!0}UnKeyLock(){this._KeyLock=!1}}function Qe(e){if(!e)throw Error("assert :P")}function et(e,t,i){for(var s=0;4>s;s++)if(e[t+s]!=i.charCodeAt(s))return!0;return!1}function tt(e,t,i,s,n){for(var r=0;r<n;r++)e[t+r]=i[s+r]}function it(e,t,i,s){for(var n=0;n<s;n++)e[t+n]=i}function st(e){return new Int32Array(e)}function nt(e,t){for(var i=[],s=0;s<e;s++)i.push(new t);return i}function rt(e,t){var i=[];return function e(i,s,n){for(var r=n[s],a=0;a<r&&(i.push(n.length>s+1?[]:new t),!(n.length<s+1));a++)e(i[a],s+1,n)}(i,0,e),i}function at(e,t){for(var i="",s=0;s<4;s++)i+=String.fromCharCode(e[t++]);return i}function ot(e,t){return(e[t+0]<<0|e[t+1]<<8|e[t+2]<<16)>>>0}function lt(e,t){return(e[t+0]<<0|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}Ze.LastFocusPage=null,Ze.sChangingFocusLock=!1,Ze.sDelayedFocusChanges=[],i.PageBase=Ze,console.log("Using JsView HTML Forge"),window.WebPDecoder=function(){function e(e,t){for(var i=1<<t-1>>>0;e&i;)i>>>=1;return i?(e&i-1)+i:e}function t(e,t,i,s,n){Qe(!(s%i));do{e[t+(s-=i)]=n}while(0<s)}function i(i,n,r,a,o){if(Qe(2328>=o),512>=o)var l=st(512);else if(null==(l=st(o)))return 0;return function(i,n,r,a,o,l){var h,c,u=n,d=1<<r,f=st(16),g=st(16);for(Qe(0!=o),Qe(null!=a),Qe(null!=i),Qe(0<r),c=0;c<o;++c){if(15<a[c])return 0;++f[a[c]]}if(f[0]==o)return 0;for(g[1]=0,h=1;15>h;++h){if(f[h]>1<<h)return 0;g[h+1]=g[h]+f[h]}for(c=0;c<o;++c)h=a[c],0<a[c]&&(l[g[h]++]=c);if(1==g[15])return(a=new s).g=0,a.value=l[0],t(i,u,1,d,a),d;var m,_=-1,p=d-1,w=0,v=1,y=1,b=1<<r;for(c=0,h=1,o=2;h<=r;++h,o<<=1){if(v+=y<<=1,0>(y-=f[h]))return 0;for(;0<f[h];--f[h])(a=new s).g=h,a.value=l[c++],t(i,u+w,o,b,a),w=e(w,h)}for(h=r+1,o=2;15>=h;++h,o<<=1){if(v+=y<<=1,0>(y-=f[h]))return 0;for(;0<f[h];--f[h]){if(a=new s,(w&p)!=_){for(u+=b,m=1<<(_=h)-r;15>_&&!(0>=(m-=f[_]));)++_,m<<=1;d+=b=1<<(m=_-r),i[n+(_=w&p)].g=m+r,i[n+_].value=u-n-_}a.g=h-r,a.value=l[c++],t(i,u+(w>>r),o,b,a),w=e(w,h)}}return v!=2*g[15]-1?0:d}(i,n,r,a,o,l)}function s(){this.value=this.g=0}function n(){this.value=this.g=0}function r(){this.G=nt(5,s),this.H=st(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=nt(Vi,n)}function a(e,t,i,s){Qe(null!=e),Qe(null!=t),Qe(2147483648>s),e.Ca=254,e.I=0,e.b=-8,e.Ka=0,e.oa=t,e.pa=i,e.Jd=t,e.Yc=i+s,e.Zc=4<=s?i+s-4+1:i,w(e)}function o(e,t){for(var i=0;0<t--;)i|=y(e,128)<<t;return i}function l(e,t){var i=o(e,t);return v(e)?-i:i}function h(e,t,i,s){var n,r=0;for(Qe(null!=e),Qe(null!=t),Qe(4294967288>s),e.Sb=s,e.Ra=0,e.u=0,e.h=0,4<s&&(s=4),n=0;n<s;++n)r+=t[i+n]<<8*n;e.Ra=r,e.bb=s,e.oa=t,e.pa=i}function c(e){for(;8<=e.u&&e.bb<e.Sb;)e.Ra>>>=8,e.Ra+=e.oa[e.pa+e.bb]<<Gi-8>>>0,++e.bb,e.u-=8;m(e)&&(e.h=1,e.u=0)}function u(e,t){if(Qe(0<=t),!e.h&&t<=Ni){var i=g(e)&ji[t];return e.u+=t,c(e),i}return e.h=1,e.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 f(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function g(e){return e.Ra>>>(e.u&Gi-1)>>>0}function m(e){return Qe(e.bb<=e.Sb),e.h||e.bb==e.Sb&&e.u>Gi}function _(e,t){e.u=t,e.h=m(e)}function p(e){e.u>=Bi&&(Qe(e.u>=Bi),c(e))}function w(e){Qe(null!=e&&null!=e.oa),e.pa<e.Zc?(e.I=(e.oa[e.pa++]|e.I<<8)>>>0,e.b+=8):(Qe(null!=e&&null!=e.oa),e.pa<e.Yc?(e.b+=8,e.I=e.oa[e.pa++]|e.I<<8):e.Ka?e.b=0:(e.I<<=8,e.b+=8,e.Ka=1))}function v(e){return o(e,1)}function y(e,t){var i=e.Ca;0>e.b&&w(e);var s=e.b,n=i*t>>>8,r=(e.I>>>s>n)+0;for(r?(i-=n,e.I-=n+1<<s>>>0):i=n+1,s=i,n=0;256<=s;)n+=8,s>>=8;return s=7^n+Ui[s],e.b-=s,e.Ca=(i<<s)-1,r}function b(e,t,i){e[t+0]=i>>24&255,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=i>>0&255}function T(e,t){return e[t+0]<<0|e[t+1]<<8}function S(e,t){return T(e,t)|e[t+2]<<16}function C(e,t){return T(e,t)|T(e,t+2)<<16}function E(e,t){var i=1<<t;return Qe(null!=e),Qe(0<t),e.X=st(i),null==e.X?0:(e.Mb=32-t,e.Xa=t,1)}function x(e,t){Qe(null!=e),Qe(null!=t),Qe(e.Xa==t.Xa),tt(t.X,0,e.X,0,1<<t.Xa)}function I(){this.X=[],this.Xa=this.Mb=0}function A(e,t,i,s){Qe(null!=i),Qe(null!=s);var n=i[0],r=s[0];return 0==n&&(n=(e*r+t/2)/t),0==r&&(r=(t*n+e/2)/e),0>=n||0>=r?0:(i[0]=n,s[0]=r,1)}function R(e,t){return e+(1<<t)-1>>>t}function P(e,t){return((4278255360&e)+(4278255360&t)>>>0&4278255360)+((16711935&e)+(16711935&t)>>>0&16711935)>>>0}function O(e,t){self[t]=function(t,i,s,n,r,a,o){var l;for(l=0;l<r;++l){var h=self[e](a[o+l-1],s,n+l);a[o+l]=P(t[i+l],h)}}}function L(){this.ud=this.hd=this.jd=0}function D(e,t){return((4278124286&(e^t))>>>1)+(e&t)>>>0}function k(e){return 0<=e&&256>e?e:0>e?0:255<e?255:void 0}function M(e,t){return k(e+(e-t+.5>>1))}function F(e,t,i){return Math.abs(t-i)-Math.abs(e-i)}function V(e,t,i,s,n,r,a){for(s=r[a-1],i=0;i<n;++i)r[a+i]=s=P(e[t+i],s)}function j(e,t,i,s,n){var r;for(r=0;r<i;++r){var a=e[t+r],o=a>>8&255,l=16711935&(l=(l=16711935&a)+((o<<16)+o));s[n+r]=(4278255360&a)+l>>>0}}function N(e,t){t.jd=e>>0&255,t.hd=e>>8&255,t.ud=e>>16&255}function G(e,t,i,s,n,r){var a;for(a=0;a<s;++a){var o=t[i+a],l=o>>>8,h=o,c=255&(c=(c=o>>>16)+((e.jd<<24>>24)*(l<<24>>24)>>>5));h=255&(h=(h=h+((e.hd<<24>>24)*(l<<24>>24)>>>5))+((e.ud<<24>>24)*(c<<24>>24)>>>5));n[r+a]=(4278255360&o)+(c<<16)+h}}function B(e,t,i,s,n){self[t]=function(e,t,i,r,a,o,l,h,c){for(r=l;r<h;++r)for(l=0;l<c;++l)a[o++]=n(i[s(e[t++])])},self[e]=function(e,t,r,a,o,l,h){var c=8>>e.b,u=e.Ea,d=e.K[0],f=e.w;if(8>c)for(e=(1<<e.b)-1,f=(1<<c)-1;t<r;++t){var g,m=0;for(g=0;g<u;++g)g&e||(m=s(a[o++])),l[h++]=n(d[m&f]),m>>=c}else self["VP8LMapColor"+i](a,o,d,f,l,h,t,r,u)}}function U(e,t,i,s,n){for(i=t+i;t<i;){var r=e[t++];s[n++]=r>>16&255,s[n++]=r>>8&255,s[n++]=r>>0&255}}function W(e,t,i,s,n){for(i=t+i;t<i;){var r=e[t++];s[n++]=r>>16&255,s[n++]=r>>8&255,s[n++]=r>>0&255,s[n++]=r>>24&255}}function H(e,t,i,s,n){for(i=t+i;t<i;){var r=(a=e[t++])>>16&240|a>>12&15,a=a>>0&240|a>>28&15;s[n++]=r,s[n++]=a}}function $(e,t,i,s,n){for(i=t+i;t<i;){var r=(a=e[t++])>>16&248|a>>13&7,a=a>>5&224|a>>3&31;s[n++]=r,s[n++]=a}}function K(e,t,i,s,n){for(i=t+i;t<i;){var r=e[t++];s[n++]=r>>0&255,s[n++]=r>>8&255,s[n++]=r>>16&255}}function Y(e,t,i,s,n,r){if(0==r)for(i=t+i;t<i;)b(s,((r=e[t++])[0]>>24|r[1]>>8&65280|r[2]<<8&16711680|r[3]<<24)>>>0),n+=32;else tt(s,n,e,t,i)}function z(e,t){self[t][0]=self[e+"0"],self[t][1]=self[e+"1"],self[t][2]=self[e+"2"],self[t][3]=self[e+"3"],self[t][4]=self[e+"4"],self[t][5]=self[e+"5"],self[t][6]=self[e+"6"],self[t][7]=self[e+"7"],self[t][8]=self[e+"8"],self[t][9]=self[e+"9"],self[t][10]=self[e+"10"],self[t][11]=self[e+"11"],self[t][12]=self[e+"12"],self[t][13]=self[e+"13"],self[t][14]=self[e+"0"],self[t][15]=self[e+"0"]}function X(e){return e==Bs||e==Us||e==Ws||e==Hs}function J(){this.eb=[],this.size=this.A=this.fb=0}function q(){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 J,this.f.kb=new q,this.sd=null}function Q(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function ee(){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 te(e){return alert("todo:WebPSamplerProcessPlane"),e.T}function ie(e,t){var i=e.T,s=t.ba.f.RGBA,n=s.eb,r=s.fb+e.ka*s.A,a=_n[t.ba.S],o=e.y,l=e.O,h=e.f,c=e.N,u=e.ea,d=e.W,f=t.cc,g=t.dc,m=t.Mc,_=t.Nc,p=e.ka,w=e.ka+e.T,v=e.U,y=v+1>>1;for(0==p?a(o,l,null,null,h,c,u,d,h,c,u,d,n,r,null,null,v):(a(t.ec,t.fc,o,l,f,g,m,_,h,c,u,d,n,r-s.A,n,r,v),++i);p+2<w;p+=2)f=h,g=c,m=u,_=d,c+=e.Rc,d+=e.Rc,r+=2*s.A,a(o,(l+=2*e.fa)-e.fa,o,l,f,g,m,_,h,c,u,d,n,r-s.A,n,r,v);return l+=e.fa,e.j+w<e.o?(tt(t.ec,t.fc,o,l,v),tt(t.cc,t.dc,h,c,y),tt(t.Mc,t.Nc,u,d,y),i--):1&w||a(o,l,null,null,h,c,u,d,h,c,u,d,n,r+s.A,null,null,v),i}function se(e,t,i){var s=e.F,n=[e.J];if(null!=s){var r=e.U,a=t.ba.S,o=a==js||a==Ws;t=t.ba.f.RGBA;var l=[0],h=e.ka;l[0]=e.T,e.Kb&&(0==h?--l[0]:(--h,n[0]-=e.width),e.j+e.ka+e.T==e.o&&(l[0]=e.o-e.j-h));var c=t.eb;h=t.fb+h*t.A;e=Ss(s,n[0],e.width,r,l,c,h+(o?0:3),t.A),Qe(i==l),e&&X(a)&&bs(c,h,o,r,l,t.A)}return 0}function ne(e){var t=e.ma,i=t.ba.S,s=11>i,n=i==Ms||i==Vs||i==js||i==Ns||12==i||X(i);if(t.memory=null,t.Ib=null,t.Jb=null,t.Nd=null,!ki(t.Oa,e,n?11:12))return 0;if(n&&X(i)&&pi(),e.da)alert("todo:use_scaling");else{if(s){if(t.Ib=te,e.Kb){if(i=e.U+1>>1,t.memory=st(e.U+2*i),null==t.memory)return 0;t.ec=t.memory,t.fc=0,t.cc=t.ec,t.dc=t.fc+e.U,t.Mc=t.cc,t.Nc=t.dc+i,t.Ib=ie,pi()}}else alert("todo:EmitYUV");n&&(t.Jb=se,s&&mi())}if(s&&!Pn){for(e=0;256>e;++e)On[e]=89858*(e-128)+En>>Cn,kn[e]=-22014*(e-128)+En,Dn[e]=-45773*(e-128),Ln[e]=113618*(e-128)+En>>Cn;for(e=xn;e<In;++e)t=76283*(e-16)+En>>Cn,Mn[e-xn]=Ve(t,255),Fn[e-xn]=Ve(t+8>>4,15);Pn=1}return 1}function re(e){var t=e.ma,i=e.U,s=e.T;return Qe(!(1&e.ka)),0>=i||0>=s?0:(i=t.Ib(e,t),null!=t.Jb&&t.Jb(e,t,i),t.Dc+=i,1)}function ae(e){e.ma.memory=null}function oe(e,t,i,s){return 47!=u(e,8)?0:(t[0]=u(e,14)+1,i[0]=u(e,14)+1,s[0]=u(e,1),0!=u(e,3)?0:!e.h)}function le(e,t){if(4>e)return e+1;var i=e-2>>1;return(2+(1&e)<<i)+u(t,i)+1}function he(e,t){return 120<t?t-120:1<=(i=((i=Js[t-1])>>4)*e+(8-(15&i)))?i:1;var i}function ce(e,t,i){var s=g(i),n=e[t+=255&s].g-8;return 0<n&&(_(i,i.u+8),s=g(i),t+=e[t].value,t+=s&(1<<n)-1),_(i,i.u+e[t].g),e[t].value}function ue(e,t,i){return i.g+=e.g,i.value+=e.value<<t>>>0,Qe(8>=i.g),e.g}function de(e,t,i){var s=e.xc;return Qe((t=0==s?0:e.vc[e.md*(i>>s)+(t>>s)])<e.Wb),e.Ya[t]}function fe(e,t,i,s){var n=e.ab,r=e.c*t,a=e.C;t=a+t;var o=i,l=s;for(s=e.Ta,i=e.Ua;0<n--;){var h=e.gc[n],c=a,u=t,d=o,f=l,g=(l=s,o=i,h.Ea);switch(Qe(c<u),Qe(u<=h.nc),h.hc){case 2:$i(d,f,(u-c)*g,l,o);break;case 0:var m=c,_=u,p=l,w=o,v=(C=h).Ea;0==m&&(Wi(d,f,null,null,1,p,w),V(d,f+1,0,0,v-1,p,w+1),f+=v,w+=v,++m);for(var y=1<<C.b,b=y-1,T=R(v,C.b),S=C.K,C=C.w+(m>>C.b)*T;m<_;){var E=S,x=C,I=1;for(Hi(d,f,p,w-v,1,p,w);I<v;){var A=(I&~b)+y;A>v&&(A=v),(0,Ji[E[x++]>>8&15])(d,f+ +I,p,w+I-v,A-I,p,w+I),I=A}f+=v,w+=v,++m&b||(C+=T)}u!=h.nc&&tt(l,o-g,l,o+(u-c-1)*g,g);break;case 1:for(g=d,_=f,v=(d=h.Ea)-(w=d&~(p=(f=1<<h.b)-1)),m=R(d,h.b),y=h.K,h=h.w+(c>>h.b)*m;c<u;){for(b=y,T=h,S=new L,C=_+w,E=_+d;_<C;)N(b[T++],S),qi(S,g,_,f,l,o),_+=f,o+=f;_<E&&(N(b[T++],S),qi(S,g,_,v,l,o),_+=v,o+=v),++c&p||(h+=m)}break;case 3:if(d==l&&f==o&&0<h.b){for(_=l,d=g=o+(u-c)*g-(w=(u-c)*R(h.Ea,h.b)),f=l,p=o,m=[],w=(v=w)-1;0<=w;--w)m[w]=f[p+w];for(w=v-1;0<=w;--w)_[d+w]=m[w];Ki(h,c,u,l,g,l,o)}else Ki(h,c,u,d,f,l,o)}o=s,l=i}l!=i&&tt(s,i,o,l,r)}function ge(e,t){var i=e.V,s=e.Ba+e.c*e.C,n=t-e.C;if(Qe(t<=e.l.o),Qe(16>=n),0<n){var r=e.l,a=e.Ta,o=e.Ua,l=r.width;if(fe(e,n,i,s),n=o=[o],Qe((i=e.C)<(s=t)),Qe(r.v<r.va),s>r.o&&(s=r.o),i<r.j){var h=r.j-i;i=r.j;n[0]+=h*l}if(i>=s?i=0:(n[0]+=4*r.v,r.ka=i-r.j,r.U=r.va-r.v,r.T=s-i,i=1),i){if(o=o[0],11>(i=e.ca).S){var c=i.f.RGBA,u=(s=i.S,n=r.U,r=r.T,h=c.eb,c.A),d=r;for(c=c.fb+e.Ma*c.A;0<d--;){var f=a,g=o,m=n,_=h,p=c;switch(s){case ks:Zi(f,g,m,_,p);break;case Ms:Qi(f,g,m,_,p);break;case Bs:Qi(f,g,m,_,p),bs(_,p,0,m,1,0);break;case Fs:is(f,g,m,_,p);break;case Vs:Y(f,g,m,_,p,1);break;case Us:Y(f,g,m,_,p,1),bs(_,p,0,m,1,0);break;case js:Y(f,g,m,_,p,0);break;case Ws:Y(f,g,m,_,p,0),bs(_,p,1,m,1,0);break;case Ns:es(f,g,m,_,p);break;case Hs:es(f,g,m,_,p),Ts(_,p,m,1,0);break;case Gs:ts(f,g,m,_,p);break;default:Qe(0)}o+=l,c+=u}e.Ma+=r}else alert("todo:EmitRescaledRowsYUVA");Qe(e.Ma<=i.height)}}e.C=t,Qe(e.C<=e.i)}function me(e){var t;if(0<e.ua)return 0;for(t=0;t<e.Wb;++t){var i=e.Ya[t].G,s=e.Ya[t].H;if(0<i[1][s[1]+0].g||0<i[2][s[2]+0].g||0<i[3][s[3]+0].g)return 0}return 1}function _e(e,t,i,s,n,r){if(0!=e.Z){var a=e.qd,o=e.rd;for(Qe(null!=mn[e.Z]);t<i;++t)mn[e.Z](a,o,s,n,s,n,r),a=s,o=n,n+=r;e.qd=a,e.rd=o}}function pe(e,t){var i=e.l.ma,s=0==i.Z||1==i.Z?e.l.j:e.C;s=e.C<s?s:e.C;if(Qe(t<=e.l.o),t>s){var n=e.l.width,r=i.ca,a=i.tb+n*s,o=e.V,l=e.Ba+e.c*s,h=e.gc;Qe(1==e.ab),Qe(3==h[0].hc),zi(h[0],s,t,o,l,r,a),_e(i,s,t,r,a,n)}e.C=e.Ma=t}function we(e,t,i,s,n,r,a){var o=e.$/s,l=e.$%s,h=e.m,c=e.s,u=i+e.$,d=u;n=i+s*n;var f=i+s*r,w=280+c.ua,v=e.Pb?o:16777216,y=0<c.ua?c.Wa:null,b=c.wc,T=u<f?de(c,l,o):null;Qe(e.C<r),Qe(f<=n);var S=!1;e:for(;;){for(;S||u<f;){var C=0;if(o>=v){var E=u-i;Qe((v=e).Pb),v.wd=v.m,v.xd=E,0<v.s.ua&&x(v.s.Wa,v.s.vb),v=o+Zs}if(l&b||(T=de(c,l,o)),Qe(null!=T),T.Qb&&(t[u]=T.qb,S=!0),!S)if(p(h),T.jc){C=h,E=t;var I=u,A=T.pd[g(C)&Vi-1];Qe(T.jc),256>A.g?(_(C,C.u+A.g),E[I]=A.value,C=0):(_(C,C.u+A.g-256),Qe(256<=A.value),C=A.value),0==C&&(S=!0)}else C=ce(T.G[0],T.H[0],h);if(h.h)break;if(S||256>C){if(!S)if(T.nd)t[u]=(T.qb|C<<8)>>>0;else{if(p(h),S=ce(T.G[1],T.H[1],h),p(h),E=ce(T.G[2],T.H[2],h),I=ce(T.G[3],T.H[3],h),h.h)break;t[u]=(I<<24|S<<16|C<<8|E)>>>0}if(S=!1,++u,++l>=s&&(l=0,++o,null!=a&&o<=r&&!(o%16)&&a(e,o),null!=y))for(;d<u;)C=t[d++],y.X[(506832829*C&4294967295)>>>y.Mb]=C}else if(280>C){if(C=le(C-256,h),E=ce(T.G[4],T.H[4],h),p(h),E=he(s,E=le(E,h)),h.h)break;if(u-i<E||n-u<C)break e;for(I=0;I<C;++I)t[u+I]=t[u+I-E];for(u+=C,l+=C;l>=s;)l-=s,++o,null!=a&&o<=r&&!(o%16)&&a(e,o);if(Qe(u<=n),l&b&&(T=de(c,l,o)),null!=y)for(;d<u;)C=t[d++],y.X[(506832829*C&4294967295)>>>y.Mb]=C}else{if(!(C<w))break e;for(S=C-280,Qe(null!=y);d<u;)C=t[d++],y.X[(506832829*C&4294967295)>>>y.Mb]=C;C=u,Qe(!(S>>>(E=y).Xa)),t[C]=E.X[S],S=!0}S||Qe(h.h==m(h))}if(e.Pb&&h.h&&u<n)Qe(e.m.h),e.a=5,e.m=e.wd,e.$=e.xd,0<e.s.ua&&x(e.s.vb,e.s.Wa);else{if(h.h)break e;null!=a&&a(e,o>r?r:o),e.a=0,e.$=u-i}return 1}return e.a=3,0}function ve(e){Qe(null!=e),e.vc=null,e.yc=null,e.Ya=null;var t=e.Wa;null!=t&&(t.X=null),e.vb=null,Qe(null!=e)}function ye(){var e=new ri;return null==e?null:(e.a=0,e.xb=gn,z("Predictor","VP8LPredictors"),z("Predictor","VP8LPredictors_C"),z("PredictorAdd","VP8LPredictorsAdd"),z("PredictorAdd","VP8LPredictorsAdd_C"),$i=j,qi=G,Zi=U,Qi=W,es=H,ts=$,is=K,self.VP8LMapColor32b=Yi,self.VP8LMapColor8b=Xi,e)}function be(e,t,n,a,o){var l=1,h=[e],c=[t],d=a.m,f=a.s,m=null,w=0;e:for(;;){if(n)for(;l&&u(d,1);){var v=h,y=c,b=a,T=1,S=b.m,C=b.gc[b.ab],x=u(S,2);if(b.Oc&1<<x)l=0;else{switch(b.Oc|=1<<x,C.hc=x,C.Ea=v[0],C.nc=y[0],C.K=[null],++b.ab,Qe(4>=b.ab),x){case 0:case 1:C.b=u(S,3)+2,T=be(R(C.Ea,C.b),R(C.nc,C.b),0,b,C.K),C.K=C.K[0];break;case 3:var I,A=u(S,8)+1,O=16<A?0:4<A?1:2<A?2:3;if(v[0]=R(C.Ea,O),C.b=O,I=T=be(A,1,0,b,C.K)){var L,D=A,k=C,M=1<<(8>>k.b),F=st(M);if(null==F)I=0;else{var V=k.K[0],j=k.w;for(F[0]=k.K[0][0],L=1;L<1*D;++L)F[L]=P(V[j+L],F[L-1]);for(;L<4*M;++L)F[L]=0;k.K[0]=null,k.K[0]=F,I=1}}T=I;break;case 2:break;default:Qe(0)}l=T}}if(h=h[0],c=c[0],l&&u(d,1)&&!(l=1<=(w=u(d,4))&&11>=w)){a.a=3;break e}var N;if(N=l)t:{var G,B,U,W=a,H=h,$=c,K=w,Y=n,z=W.m,X=W.s,J=[null],q=1,Z=0,Q=qs[K];i:for(;;){if(Y&&u(z,1)){var ee=u(z,3)+2,te=R(H,ee),ie=R($,ee),se=te*ie;if(!be(te,ie,0,W,J))break i;for(J=J[0],X.xc=ee,G=0;G<se;++G){var ne=J[G]>>8&65535;J[G]=ne,ne>=q&&(q=ne+1)}}if(z.h)break i;for(B=0;5>B;++B){var re=Ys[B];!B&&0<K&&(re+=1<<K),Z<re&&(Z=re)}var ae=nt(q*Q,s),oe=q,le=nt(oe,r);if(null==le)var he=null;else Qe(65536>=oe),he=le;var ce=st(Z);if(null==he||null==ce||null==ae){W.a=1;break i}var de=ae;for(G=U=0;G<q;++G){var fe=he[G],ge=fe.G,me=fe.H,_e=0,pe=1,ye=0;for(B=0;5>B;++B){re=Ys[B],ge[B]=de,me[B]=U,!B&&0<K&&(re+=1<<K);s:{var Te,Se=re,Ce=W,Ee=ce,xe=de,Ie=U,Ae=0,Re=Ce.m,Pe=u(Re,1);if(it(Ee,0,0,Se),Pe){var Oe=u(Re,1)+1,Le=u(Re,1),De=u(Re,0==Le?1:8);Ee[De]=1,2==Oe&&(Ee[De=u(Re,8)]=1);var ke=1}else{var Me=st(19),Fe=u(Re,4)+4;if(19<Fe){Ce.a=3;var Ve=0;break s}for(Te=0;Te<Fe;++Te)Me[Xs[Te]]=u(Re,3);var je=void 0,Ne=void 0,Ge=Ce,Be=Me,Ue=Se,We=Ee,He=0,$e=Ge.m,Ke=8,Ye=nt(128,s);n:for(;i(Ye,0,7,Be,19);){if(u($e,1)){var ze=2+2*u($e,3);if((je=2+u($e,ze))>Ue)break n}else je=Ue;for(Ne=0;Ne<Ue&&je--;){p($e);var Xe=Ye[0+(127&g($e))];_($e,$e.u+Xe.g);var Je=Xe.value;if(16>Je)We[Ne++]=Je,0!=Je&&(Ke=Je);else{var qe=16==Je,Ze=Je-16,et=Ks[Ze],tt=u($e,$s[Ze])+et;if(Ne+tt>Ue)break n;for(var rt=qe?Ke:0;0<tt--;)We[Ne++]=rt}}He=1;break n}He||(Ge.a=3),ke=He}(ke=ke&&!Re.h)&&(Ae=i(xe,Ie,8,Ee,Se)),ke&&0!=Ae?Ve=Ae:(Ce.a=3,Ve=0)}if(0==Ve)break i;if(pe&&1==zs[B]&&(pe=0==de[U].g),_e+=de[U].g,U+=Ve,3>=B){var at,ot=ce[0];for(at=1;at<re;++at)ce[at]>ot&&(ot=ce[at]);ye+=ot}}if(fe.nd=pe,fe.Qb=0,pe&&(fe.qb=(ge[3][me[3]+0].value<<24|ge[1][me[1]+0].value<<16|ge[2][me[2]+0].value)>>>0,0==_e&&256>ge[0][me[0]+0].value&&(fe.Qb=1,fe.qb+=ge[0][me[0]+0].value<<8)),fe.jc=!fe.Qb&&6>ye,fe.jc){var lt,ht=fe;for(lt=0;lt<Vi;++lt){var ct=lt,ut=ht.pd[ct],dt=ht.G[0][ht.H[0]+ct];256<=dt.value?(ut.g=dt.g+256,ut.value=dt.value):(ut.g=0,ut.value=0,ct>>=ue(dt,8,ut),ct>>=ue(ht.G[1][ht.H[1]+ct],16,ut),ct>>=ue(ht.G[2][ht.H[2]+ct],0,ut),ue(ht.G[3][ht.H[3]+ct],24,ut))}}}X.vc=J,X.Wb=q,X.Ya=he,X.yc=ae,N=1;break t}N=0}if(!(l=N)){a.a=3;break e}if(0<w){if(f.ua=1<<w,!E(f.Wa,w)){a.a=1,l=0;break e}}else f.ua=0;var ft=a,gt=h,mt=c,_t=ft.s,pt=_t.xc;if(ft.c=gt,ft.i=mt,_t.md=R(gt,pt),_t.wc=0==pt?-1:(1<<pt)-1,n){a.xb=fn;break e}if(null==(m=st(h*c))){a.a=1,l=0;break e}l=(l=we(a,m,0,h,c,c,null))&&!d.h;break e}return l?(null!=o?o[0]=m:(Qe(null==m),Qe(n)),a.$=0,n||ve(f)):ve(f),l}function Te(e,t){var i=e.c*e.i,s=i+t+16*t;return Qe(e.c<=t),e.V=st(s),null==e.V?(e.Ta=null,e.Ua=0,e.a=1,0):(e.Ta=e.V,e.Ua=e.Ba+i+t,1)}function Se(e,t){var i=e.C,s=t-i,n=e.V,r=e.Ba+e.c*i;for(Qe(t<=e.l.o);0<s;){var a=16<s?16:s,o=e.l.ma,l=e.l.width,h=l*a,c=o.ca,u=o.tb+l*i,d=e.Ta,f=e.Ua;fe(e,a,n,r),Cs(d,f,c,u,h),_e(o,i,i+a,c,u,l),s-=a,n+=a*e.c,i+=a}Qe(i==t),e.C=e.Ma=t}function Ce(){this.ub=this.yd=this.td=this.Rb=0}function Ee(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function xe(){this.Fb=this.Bb=this.Cb=0,this.Zb=st(4),this.Lb=st(4)}function Ie(){this.Yb=function(){var e=[];return function e(t,i,s){for(var n=s[i],r=0;r<n&&(t.push(s.length>i+1?[]:0),!(s.length<i+1));r++)e(t[r],i+1,s)}(e,0,[3,11]),e}()}function Ae(){this.jb=st(3),this.Wc=rt([4,8],Ie),this.Xc=rt([4,17],Ie)}function Re(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new st(4),this.od=new st(4)}function Pe(){this.ld=this.La=this.dd=this.tc=0}function Oe(){this.Na=this.la=0}function Le(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function De(){this.ad=st(384),this.Za=0,this.Ob=st(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function ke(){this.uc=this.M=this.Nb=0,this.wa=Array(new Pe),this.Y=0,this.ya=Array(new De),this.aa=0,this.l=new je}function Me(){this.y=st(16),this.f=st(8),this.ea=st(8)}function Fe(){this.cb=this.a=0,this.sc="",this.m=new d,this.Od=new Ce,this.Kc=new Ee,this.ed=new Re,this.Qa=new xe,this.Ic=this.$c=this.Aa=0,this.D=new ke,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=nt(8,d),this.ia=0,this.pb=nt(4,Le),this.Pa=new Ae,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Me),this.Hd=0,this.rb=Array(new Oe),this.sb=0,this.wa=Array(new Pe),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 De),this.L=this.aa=0,this.gd=rt([4,2],Pe),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 Ve(e,t){return 0>e?0:e>t?t:e}function je(){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 Ne(){var e=new Fe;return null!=e&&(e.a=0,e.sc="OK",e.cb=0,e.Xb=0,tn||(tn=We)),e}function Ge(e,t,i){return 0==e.a&&(e.a=t,e.sc=i,e.cb=0),0}function Be(e,t,i){return 3<=i&&157==e[t+0]&&1==e[t+1]&&42==e[t+2]}function Ue(e,t){if(null==e)return 0;if(e.a=0,e.sc="OK",null==t)return Ge(e,2,"null VP8Io passed to VP8GetHeaders()");var i=t.data,s=t.w,n=t.ha;if(4>n)return Ge(e,7,"Truncated header.");var r=i[s+0]|i[s+1]<<8|i[s+2]<<16,h=e.Od;if(h.Rb=!(1&r),h.td=r>>1&7,h.yd=r>>4&1,h.ub=r>>5,3<h.td)return Ge(e,3,"Incorrect keyframe parameters.");if(!h.yd)return Ge(e,4,"Frame not displayable.");s+=3,n-=3;var c=e.Kc;if(h.Rb){if(7>n)return Ge(e,7,"cannot parse picture header");if(!Be(i,s,n))return Ge(e,3,"Bad code word");c.c=16383&(i[s+4]<<8|i[s+3]),c.Td=i[s+4]>>6,c.i=16383&(i[s+6]<<8|i[s+5]),c.Ud=i[s+6]>>6,s+=7,n-=7,e.za=c.c+15>>4,e.Ub=c.i+15>>4,t.width=c.c,t.height=c.i,t.Da=0,t.j=0,t.v=0,t.va=t.width,t.o=t.height,t.da=0,t.ib=t.width,t.hb=t.height,t.U=t.width,t.T=t.height,it((r=e.Pa).jb,0,255,r.jb.length),Qe(null!=(r=e.Qa)),r.Cb=0,r.Bb=0,r.Fb=1,it(r.Zb,0,0,r.Zb.length),it(r.Lb,0,0,r.Lb)}if(h.ub>n)return Ge(e,7,"bad partition length");a(r=e.m,i,s,h.ub),s+=h.ub,n-=h.ub,h.Rb&&(c.Ld=v(r),c.Kd=v(r)),c=e.Qa;var u,d=e.Pa;if(Qe(null!=r),Qe(null!=c),c.Cb=v(r),c.Cb){if(c.Bb=v(r),v(r)){for(c.Fb=v(r),u=0;4>u;++u)c.Zb[u]=v(r)?l(r,7):0;for(u=0;4>u;++u)c.Lb[u]=v(r)?l(r,6):0}if(c.Bb)for(u=0;3>u;++u)d.jb[u]=v(r)?o(r,8):255}else c.Bb=0;if(r.Ka)return Ge(e,3,"cannot parse segment header");if((c=e.ed).zd=v(r),c.Tb=o(r,6),c.wb=o(r,3),c.Pc=v(r),c.Pc&&v(r)){for(d=0;4>d;++d)v(r)&&(c.vd[d]=l(r,6));for(d=0;4>d;++d)v(r)&&(c.od[d]=l(r,6))}if(e.L=0==c.Tb?0:c.zd?1:2,r.Ka)return Ge(e,3,"cannot parse filter header");var f=n;if(n=u=s,s=u+f,c=f,e.Xb=(1<<o(e.m,2))-1,f<3*(d=e.Xb))i=7;else{for(u+=3*d,c-=3*d,f=0;f<d;++f){var g=i[n+0]|i[n+1]<<8|i[n+2]<<16;g>c&&(g=c),a(e.Jc[+f],i,u,g),u+=g,c-=g,n+=3}a(e.Jc[+d],i,u,c),i=u<s?0:5}if(0!=i)return Ge(e,i,"cannot parse partitions");for(i=o(u=e.m,7),n=v(u)?l(u,4):0,s=v(u)?l(u,4):0,c=v(u)?l(u,4):0,d=v(u)?l(u,4):0,u=v(u)?l(u,4):0,f=e.Qa,g=0;4>g;++g){if(f.Cb){var m=f.Zb[g];f.Fb||(m+=i)}else{if(0<g){e.pb[g]=e.pb[0];continue}m=i}var _=e.pb[g];_.Sc[0]=Qs[Ve(m+n,127)],_.Sc[1]=en[Ve(m+0,127)],_.Eb[0]=2*Qs[Ve(m+s,127)],_.Eb[1]=101581*en[Ve(m+c,127)]>>16,8>_.Eb[1]&&(_.Eb[1]=8),_.Qc[0]=Qs[Ve(m+d,117)],_.Qc[1]=en[Ve(m+u,127)],_.lc=m+u}if(!h.Rb)return Ge(e,4,"Not a key frame.");for(v(r),h=e.Pa,i=0;4>i;++i){for(n=0;8>n;++n)for(s=0;3>s;++s)for(c=0;11>c;++c)d=y(r,ln[i][n][s][c])?o(r,8):an[i][n][s][c],h.Wc[i][n].Yb[s][c]=d;for(n=0;17>n;++n)h.Xc[i][n]=h.Wc[i][hn[n]]}return e.kc=v(r),e.kc&&(e.Bd=o(r,8)),e.cb=1}function We(e,t,i,s,n,r,a){var o=t[n].Yb[i];for(i=0;16>n;++n){if(!y(e,o[i+0]))return n;for(;!y(e,o[i+1]);)if(o=t[++n].Yb[0],i=0,16==n)return 16;var l=t[n+1].Yb;if(y(e,o[i+2])){var h=e,c=0;if(y(h,(d=o)[(u=i)+3]))if(y(h,d[u+6])){for(o=0,u=2*(c=y(h,d[u+8]))+(d=y(h,d[u+9+c])),c=0,d=sn[u];d[o];++o)c+=c+y(h,d[o]);c+=3+(8<<u)}else y(h,d[u+7])?(c=7+2*y(h,165),c+=y(h,145)):c=5+y(h,159);else c=y(h,d[u+4])?3+y(h,d[u+5]):2;o=l[2]}else c=1,o=l[1];l=a+nn[n],0>(h=e).b&&w(h);var u,d=h.b,f=(u=h.Ca>>1)-(h.I>>d)>>31;--h.b,h.Ca+=f,h.Ca|=1,h.I-=(u+1&f)<<d,r[l]=((c^f)-f)*s[(0<n)+0]}return 16}function He(e){var t=e.rb[e.sb-1];t.la=0,t.Na=0,it(e.zc,0,0,e.zc.length),e.ja=0}function $e(e,t){if(null==e)return 0;if(null==t)return Ge(e,2,"NULL VP8Io parameter in VP8Decode().");if(!e.cb&&!Ue(e,t))return 0;if(Qe(e.cb),null==t.ac||t.ac(t)){t.ob&&(e.L=0);var i=jn[e.L];if(2==e.L?(e.yb=0,e.zb=0):(e.yb=t.v-i>>4,e.zb=t.j-i>>4,0>e.yb&&(e.yb=0),0>e.zb&&(e.zb=0)),e.Va=t.o+15+i>>4,e.Hb=t.va+15+i>>4,e.Hb>e.za&&(e.Hb=e.za),e.Va>e.Ub&&(e.Va=e.Ub),0<e.L){var s=e.ed;for(i=0;4>i;++i){var n;if(e.Qa.Cb){var r=e.Qa.Lb[i];e.Qa.Fb||(r+=s.Tb)}else r=s.Tb;for(n=0;1>=n;++n){var a=e.gd[i][n],o=r;if(s.Pc&&(o+=s.vd[0],n&&(o+=s.od[0])),0<(o=0>o?0:63<o?63:o)){var l=o;0<s.wb&&((l=4<s.wb?l>>2:l>>1)>9-s.wb&&(l=9-s.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=n}}}i=0}else Ge(e,6,"Frame setup failed"),i=e.a;if(i=0==i){if(i){e.$c=0,0<e.Aa||(e.Ic=Gn);e:{i=e.Ic;s=4*(l=e.za);var h=32*l,c=l+1,u=0<e.L?l*(0<e.Aa?2:1):0,d=(2==e.Aa?2:1)*l;if((a=s+832+(n=3*(16*i+jn[e.L])/2*h)+(r=null!=e.Fa&&0<e.Fa.length?e.Kc.c*e.Kc.i:0))!=a)i=0;else{if(a>e.Vb){if(e.Vb=0,e.Ec=st(a),e.Fc=0,null==e.Ec){i=Ge(e,1,"no memory during frame initialization.");break e}e.Vb=a}a=e.Ec,o=e.Fc,e.Ac=a,e.Bc=o,o+=s,e.Gd=nt(h,Me),e.Hd=0,e.rb=nt(c+1,Oe),e.sb=1,e.wa=u?nt(u,Pe):null,e.Y=0,e.D.Nb=0,e.D.wa=e.wa,e.D.Y=e.Y,0<e.Aa&&(e.D.Y+=l),Qe(!0),e.oc=a,e.pc=o,o+=832,e.ya=nt(d,De),e.aa=0,e.D.ya=e.ya,e.D.aa=e.aa,2==e.Aa&&(e.D.aa+=l),e.R=16*l,e.B=8*l,l=(h=jn[e.L])*e.R,h=h/2*e.B,e.sa=a,e.ta=o+l,e.qa=e.sa,e.ra=e.ta+16*i*e.R+h,e.Ha=e.qa,e.Ia=e.ra+8*i*e.B+h,e.$c=0,o+=n,e.mb=r?a:null,e.nb=r?o:null,Qe(o+r<=e.Fc+e.Vb),He(e),it(e.Ac,e.Bc,0,s),i=1}}if(i){if(t.ka=0,t.y=e.sa,t.O=e.ta,t.f=e.qa,t.N=e.ra,t.ea=e.Ha,t.Vd=e.Ia,t.fa=e.R,t.Rc=e.B,t.F=null,t.J=0,!Rs){for(i=-255;255>=i;++i)Es[255+i]=0>i?-i:i;for(i=-1020;1020>=i;++i)xs[1020+i]=-128>i?-128:127<i?127:i;for(i=-112;112>=i;++i)Is[112+i]=-16>i?-16:15<i?15:i;for(i=-255;510>=i;++i)As[255+i]=0>i?0:255<i?255:i;Rs=1}ss=lt,ns=qe,as=Ze,os=at,ls=ot,rs=Je,hs=Yt,cs=zt,us=qt,ds=Zt,fs=Xt,gs=Jt,ms=Qt,_s=ei,ps=Bt,ws=Ut,vs=Wt,ys=Ht,un[0]=St,un[1]=ct,un[2]=bt,un[3]=Tt,un[4]=Ct,un[5]=xt,un[6]=Et,un[7]=It,un[8]=Rt,un[9]=At,cn[0]=_t,cn[1]=dt,cn[2]=ft,cn[3]=gt,cn[4]=pt,cn[5]=wt,cn[6]=vt,dn[0]=Dt,dn[1]=ut,dn[2]=Pt,dn[3]=Ot,dn[4]=Mt,dn[5]=kt,dn[6]=Ft,i=1}else i=0}i&&(i=function(e,t){for(e.M=0;e.M<e.Va;++e.M){var i,s=e.Jc[e.M&e.Xb],n=e.m,r=e;for(i=0;i<r.za;++i){var a=n,o=r,l=o.Ac,h=o.Bc+4*i,c=o.zc,u=o.ya[o.aa+i];if(o.Qa.Bb?u.$b=y(a,o.Pa.jb[0])?2+y(a,o.Pa.jb[2]):y(a,o.Pa.jb[1]):u.$b=0,o.kc&&(u.Ad=y(a,o.Bd)),u.Za=!y(a,145)+0,u.Za){var d=u.Ob,f=0;for(o=0;4>o;++o){var g,m=c[0+o];for(g=0;4>g;++g){m=on[l[h+g]][m];for(var _=rn[y(a,m[0])];0<_;)_=rn[2*_+y(a,m[_])];m=-_,l[h+g]=m}tt(d,f,l,h,4),f+=4,c[0+o]=m}}else m=y(a,156)?y(a,128)?1:3:y(a,163)?2:0,u.Ob[0]=m,it(l,h,m,4),it(c,0,m,4);u.Dd=y(a,142)?y(a,114)?y(a,183)?1:3:2:0}if(r.m.Ka)return Ge(e,7,"Premature end-of-partition0 encountered.");for(;e.ja<e.za;++e.ja){if(r=s,a=(n=e).rb[n.sb-1],l=n.rb[n.sb+n.ja],i=n.ya[n.aa+n.ja],h=n.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=n.Pa.Xc,c=n.ya[n.aa+n.ja],u=n.pb[c.$b],o=c.ad,d=0,f=n.rb[n.sb-1],m=g=0,it(o,d,0,384),c.Za)var v=0,b=h[3];else{_=st(16);var T=a.Na+f.Na;if(T=tn(l,h[1],T,u.Eb,0,_,0),a.Na=f.Na=(0<T)+0,1<T)ss(_,0,o,d);else{var S=_[0]+3>>3;for(_=0;256>_;_+=16)o[d+_]=S}v=1,b=h[0]}var C=15&a.la,E=15&f.la;for(_=0;4>_;++_){var x=1&E;for(S=w=0;4>S;++S)C=C>>1|(x=(T=tn(l,b,T=x+(1&C),u.Sc,v,o,d))>v)<<7,w=w<<2|(3<T?3:1<T?2:0!=o[d+0]),d+=16;C>>=4,E=E>>1|x<<7,g=(g<<8|w)>>>0}for(b=C,v=E>>4,p=0;4>p;p+=2){for(w=0,C=a.la>>4+p,E=f.la>>4+p,_=0;2>_;++_){for(x=1&E,S=0;2>S;++S)T=x+(1&C),C=C>>1|(x=0<(T=tn(l,h[2],T,u.Qc,0,o,d)))<<3,w=w<<2|(3<T?3:1<T?2:0!=o[d+0]),d+=16;C>>=2,E=E>>1|x<<5}m|=w<<4*p,b|=C<<4<<p,v|=(240&E)<<p}a.la=b,f.la=v,c.Hc=g,c.Gc=m,c.ia=43690&m?0:u.ia,h=!(g|m)}if(0<n.L&&(n.wa[n.Y+n.ja]=n.gd[i.$b][i.Za],n.wa[n.Y+n.ja].La|=!h),r.Ka)return Ge(e,7,"Premature end-of-file encountered.")}if(He(e),n=t,r=1,i=(s=e).D,a=0<s.L&&s.M>=s.zb&&s.M<=s.Va,0==s.Aa)e:{if(i.M=s.M,i.uc=a,Li(s,i),r=1,i=(w=s.D).Nb,a=(m=jn[s.L])*s.R,l=m/2*s.B,_=16*i*s.R,S=8*i*s.B,h=s.sa,c=s.ta-a+_,u=s.qa,o=s.ra-l+S,d=s.Ha,f=s.Ia-l+S,E=0==(C=w.M),g=C>=s.Va-1,2==s.Aa&&Li(s,w),w.uc)for(x=(T=s).D.M,Qe(T.D.uc),w=T.yb;w<T.Hb;++w){v=w,b=x;var I=(A=(V=T).D).Nb;p=V.R;var A=A.wa[A.Y+v],R=V.sa,P=V.ta+16*I*p+16*v,O=A.dd,L=A.tc;if(0!=L)if(Qe(3<=L),1==V.L)0<v&&ws(R,P,p,L+4),A.La&&ys(R,P,p,L),0<b&&ps(R,P,p,L+4),A.La&&vs(R,P,p,L);else{var D=V.B,k=V.qa,M=V.ra+8*I*D+8*v,F=V.Ha,V=V.Ia+8*I*D+8*v;I=A.ld,0<v&&(cs(R,P,p,L+4,O,I),ds(k,M,F,V,D,L+4,O,I)),A.La&&(gs(R,P,p,L,O,I),_s(k,M,F,V,D,L,O,I)),0<b&&(hs(R,P,p,L+4,O,I),us(k,M,F,V,D,L+4,O,I)),A.La&&(fs(R,P,p,L,O,I),ms(k,M,F,V,D,L,O,I))}}if(s.ia&&alert("todo:DitherRow"),null!=n.put){if(w=16*C,C=16*(C+1),E?(n.y=s.sa,n.O=s.ta+_,n.f=s.qa,n.N=s.ra+S,n.ea=s.Ha,n.W=s.Ia+S):(w-=m,n.y=h,n.O=c,n.f=u,n.N=o,n.ea=d,n.W=f),g||(C-=m),C>n.o&&(C=n.o),n.F=null,n.J=null,null!=s.Fa&&0<s.Fa.length&&w<C&&(n.J=ci(s,n,w,C-w),n.F=s.mb,null==n.F&&0==n.F.length)){r=Ge(s,3,"Could not decode alpha data.");break e}w<n.j&&(m=n.j-w,w=n.j,Qe(!(1&m)),n.O+=s.R*m,n.N+=s.B*(m>>1),n.W+=s.B*(m>>1),null!=n.F&&(n.J+=n.width*m)),w<C&&(n.O+=n.v,n.N+=n.v>>1,n.W+=n.v>>1,null!=n.F&&(n.J+=n.v),n.ka=w-n.j,n.U=n.va-n.v,n.T=C-w,r=n.put(n))}i+1!=s.Ic||g||(tt(s.sa,s.ta-a,h,c+16*s.R,a),tt(s.qa,s.ra-l,u,o+8*s.B,l),tt(s.Ha,s.Ia-l,d,f+8*s.B,l))}if(!r)return Ge(e,6,"Output aborted.")}return 1}(e,t)),null!=t.bc&&t.bc(t),i&=1}return i?(e.cb=0,i):0}function Ke(e,t,i,s,n){n=e[t+i+32*s]+(n>>3),e[t+i+32*s]=-256&n?0>n?0:255:n}function Ye(e,t,i,s,n,r){Ke(e,t,0,i,s+n),Ke(e,t,1,i,s+r),Ke(e,t,2,i,s-r),Ke(e,t,3,i,s-n)}function ze(e){return(20091*e>>16)+e}function Xe(e,t,i,s){var n,r=0,a=st(16);for(n=0;4>n;++n){var o=e[t+0]+e[t+8],l=e[t+0]-e[t+8],h=(35468*e[t+4]>>16)-ze(e[t+12]),c=ze(e[t+4])+(35468*e[t+12]>>16);a[r+0]=o+c,a[r+1]=l+h,a[r+2]=l-h,a[r+3]=o-c,r+=4,t++}for(n=r=0;4>n;++n)o=(e=a[r+0]+4)+a[r+8],l=e-a[r+8],h=(35468*a[r+4]>>16)-ze(a[r+12]),Ke(i,s,0,0,o+(c=ze(a[r+4])+(35468*a[r+12]>>16))),Ke(i,s,1,0,l+h),Ke(i,s,2,0,l-h),Ke(i,s,3,0,o-c),r++,s+=32}function Je(e,t,i,s){var n=e[t+0]+4,r=35468*e[t+4]>>16,a=ze(e[t+4]),o=35468*e[t+1]>>16;Ye(i,s,0,n+a,e=ze(e[t+1]),o),Ye(i,s,1,n+r,e,o),Ye(i,s,2,n-r,e,o),Ye(i,s,3,n-a,e,o)}function qe(e,t,i,s,n){Xe(e,t,i,s),n&&Xe(e,t+16,i,s+4)}function Ze(e,t,i,s){ns(e,t+0,i,s,1),ns(e,t+32,i,s+128,1)}function at(e,t,i,s){var n;for(e=e[t+0]+4,n=0;4>n;++n)for(t=0;4>t;++t)Ke(i,s,t,n,e)}function ot(e,t,i,s){e[t+0]&&os(e,t+0,i,s),e[t+16]&&os(e,t+16,i,s+4),e[t+32]&&os(e,t+32,i,s+128),e[t+48]&&os(e,t+48,i,s+128+4)}function lt(e,t,i,s){var n,r=st(16);for(n=0;4>n;++n){var a=e[t+0+n]+e[t+12+n],o=e[t+4+n]+e[t+8+n],l=e[t+4+n]-e[t+8+n],h=e[t+0+n]-e[t+12+n];r[0+n]=a+o,r[8+n]=a-o,r[4+n]=h+l,r[12+n]=h-l}for(n=0;4>n;++n)a=(e=r[0+4*n]+3)+r[3+4*n],o=r[1+4*n]+r[2+4*n],l=r[1+4*n]-r[2+4*n],h=e-r[3+4*n],i[s+0]=a+o>>3,i[s+16]=h+l>>3,i[s+32]=a-o>>3,i[s+48]=h-l>>3,s+=64}function ht(e,t,i){var s,n=t-32,r=Ls,a=255-e[n-1];for(s=0;s<i;++s){var o,l=r,h=a+e[t-1];for(o=0;o<i;++o)e[t+o]=l[h+e[n+o]];t+=32}}function ct(e,t){ht(e,t,4)}function ut(e,t){ht(e,t,8)}function dt(e,t){ht(e,t,16)}function ft(e,t){var i;for(i=0;16>i;++i)tt(e,t+32*i,e,t-32,16)}function gt(e,t){var i;for(i=16;0<i;--i)it(e,t,e[t-1],16),t+=32}function mt(e,t,i){var s;for(s=0;16>s;++s)it(t,i+32*s,e,16)}function _t(e,t){var i,s=16;for(i=0;16>i;++i)s+=e[t-1+32*i]+e[t+i-32];mt(s>>5,e,t)}function pt(e,t){var i,s=8;for(i=0;16>i;++i)s+=e[t-1+32*i];mt(s>>4,e,t)}function wt(e,t){var i,s=8;for(i=0;16>i;++i)s+=e[t+i-32];mt(s>>4,e,t)}function vt(e,t){mt(128,e,t)}function yt(e,t,i){return e+2*t+i+2>>2}function bt(e,t){var i,s=t-32;s=new Uint8Array([yt(e[s-1],e[s+0],e[s+1]),yt(e[s+0],e[s+1],e[s+2]),yt(e[s+1],e[s+2],e[s+3]),yt(e[s+2],e[s+3],e[s+4])]);for(i=0;4>i;++i)tt(e,t+32*i,s,0,s.length)}function Tt(e,t){var i=e[t-1],s=e[t-1+32],n=e[t-1+64],r=e[t-1+96];b(e,t+0,16843009*yt(e[t-1-32],i,s)),b(e,t+32,16843009*yt(i,s,n)),b(e,t+64,16843009*yt(s,n,r)),b(e,t+96,16843009*yt(n,r,r))}function St(e,t){var i,s=4;for(i=0;4>i;++i)s+=e[t+i-32]+e[t-1+32*i];for(s>>=3,i=0;4>i;++i)it(e,t+32*i,s,4)}function Ct(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1-32],a=e[t+0-32],o=e[t+1-32],l=e[t+2-32],h=e[t+3-32];e[t+0+96]=yt(s,n,e[t-1+96]),e[t+1+96]=e[t+0+64]=yt(i,s,n),e[t+2+96]=e[t+1+64]=e[t+0+32]=yt(r,i,s),e[t+3+96]=e[t+2+64]=e[t+1+32]=e[t+0+0]=yt(a,r,i),e[t+3+64]=e[t+2+32]=e[t+1+0]=yt(o,a,r),e[t+3+32]=e[t+2+0]=yt(l,o,a),e[t+3+0]=yt(h,l,o)}function Et(e,t){var i=e[t+1-32],s=e[t+2-32],n=e[t+3-32],r=e[t+4-32],a=e[t+5-32],o=e[t+6-32],l=e[t+7-32];e[t+0+0]=yt(e[t+0-32],i,s),e[t+1+0]=e[t+0+32]=yt(i,s,n),e[t+2+0]=e[t+1+32]=e[t+0+64]=yt(s,n,r),e[t+3+0]=e[t+2+32]=e[t+1+64]=e[t+0+96]=yt(n,r,a),e[t+3+32]=e[t+2+64]=e[t+1+96]=yt(r,a,o),e[t+3+64]=e[t+2+96]=yt(a,o,l),e[t+3+96]=yt(o,l,l)}function xt(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1-32],a=e[t+0-32],o=e[t+1-32],l=e[t+2-32],h=e[t+3-32];e[t+0+0]=e[t+1+64]=r+a+1>>1,e[t+1+0]=e[t+2+64]=a+o+1>>1,e[t+2+0]=e[t+3+64]=o+l+1>>1,e[t+3+0]=l+h+1>>1,e[t+0+96]=yt(n,s,i),e[t+0+64]=yt(s,i,r),e[t+0+32]=e[t+1+96]=yt(i,r,a),e[t+1+32]=e[t+2+96]=yt(r,a,o),e[t+2+32]=e[t+3+96]=yt(a,o,l),e[t+3+32]=yt(o,l,h)}function It(e,t){var i=e[t+0-32],s=e[t+1-32],n=e[t+2-32],r=e[t+3-32],a=e[t+4-32],o=e[t+5-32],l=e[t+6-32],h=e[t+7-32];e[t+0+0]=i+s+1>>1,e[t+1+0]=e[t+0+64]=s+n+1>>1,e[t+2+0]=e[t+1+64]=n+r+1>>1,e[t+3+0]=e[t+2+64]=r+a+1>>1,e[t+0+32]=yt(i,s,n),e[t+1+32]=e[t+0+96]=yt(s,n,r),e[t+2+32]=e[t+1+96]=yt(n,r,a),e[t+3+32]=e[t+2+96]=yt(r,a,o),e[t+3+64]=yt(a,o,l),e[t+3+96]=yt(o,l,h)}function At(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1+96];e[t+0+0]=i+s+1>>1,e[t+2+0]=e[t+0+32]=s+n+1>>1,e[t+2+32]=e[t+0+64]=n+r+1>>1,e[t+1+0]=yt(i,s,n),e[t+3+0]=e[t+1+32]=yt(s,n,r),e[t+3+32]=e[t+1+64]=yt(n,r,r),e[t+3+64]=e[t+2+64]=e[t+0+96]=e[t+1+96]=e[t+2+96]=e[t+3+96]=r}function Rt(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1+96],a=e[t-1-32],o=e[t+0-32],l=e[t+1-32],h=e[t+2-32];e[t+0+0]=e[t+2+32]=i+a+1>>1,e[t+0+32]=e[t+2+64]=s+i+1>>1,e[t+0+64]=e[t+2+96]=n+s+1>>1,e[t+0+96]=r+n+1>>1,e[t+3+0]=yt(o,l,h),e[t+2+0]=yt(a,o,l),e[t+1+0]=e[t+3+32]=yt(i,a,o),e[t+1+32]=e[t+3+64]=yt(s,i,a),e[t+1+64]=e[t+3+96]=yt(n,s,i),e[t+1+96]=yt(r,n,s)}function Pt(e,t){var i;for(i=0;8>i;++i)tt(e,t+32*i,e,t-32,8)}function Ot(e,t){var i;for(i=0;8>i;++i)it(e,t,e[t-1],8),t+=32}function Lt(e,t,i){var s;for(s=0;8>s;++s)it(t,i+32*s,e,8)}function Dt(e,t){var i,s=8;for(i=0;8>i;++i)s+=e[t+i-32]+e[t-1+32*i];Lt(s>>4,e,t)}function kt(e,t){var i,s=4;for(i=0;8>i;++i)s+=e[t+i-32];Lt(s>>3,e,t)}function Mt(e,t){var i,s=4;for(i=0;8>i;++i)s+=e[t-1+32*i];Lt(s>>3,e,t)}function Ft(e,t){Lt(128,e,t)}function Vt(e,t,i){var s=e[t-i],n=e[t+0],r=3*(n-s)+Ps[1020+e[t-2*i]-e[t+i]],a=Os[112+(r+4>>3)];e[t-i]=Ls[255+s+Os[112+(r+3>>3)]],e[t+0]=Ls[255+n-a]}function jt(e,t,i,s){var n=e[t+0],r=e[t+i];return Ds[255+e[t-2*i]-e[t-i]]>s||Ds[255+r-n]>s}function Nt(e,t,i,s){return 4*Ds[255+e[t-i]-e[t+0]]+Ds[255+e[t-2*i]-e[t+i]]<=s}function Gt(e,t,i,s,n){var r=e[t-3*i],a=e[t-2*i],o=e[t-i],l=e[t+0],h=e[t+i],c=e[t+2*i],u=e[t+3*i];return 4*Ds[255+o-l]+Ds[255+a-h]>s?0:Ds[255+e[t-4*i]-r]<=n&&Ds[255+r-a]<=n&&Ds[255+a-o]<=n&&Ds[255+u-c]<=n&&Ds[255+c-h]<=n&&Ds[255+h-l]<=n}function Bt(e,t,i,s){var n=2*s+1;for(s=0;16>s;++s)Nt(e,t+s,i,n)&&Vt(e,t+s,i)}function Ut(e,t,i,s){var n=2*s+1;for(s=0;16>s;++s)Nt(e,t+s*i,1,n)&&Vt(e,t+s*i,1)}function Wt(e,t,i,s){var n;for(n=3;0<n;--n)Bt(e,t+=4*i,i,s)}function Ht(e,t,i,s){var n;for(n=3;0<n;--n)Ut(e,t+=4,i,s)}function $t(e,t,i,s,n,r,a,o){for(r=2*r+1;0<n--;){if(Gt(e,t,i,r,a))if(jt(e,t,i,o))Vt(e,t,i);else{var l=e,h=t,c=i,u=l[h-2*c],d=l[h-c],f=l[h+0],g=l[h+c],m=l[h+2*c],_=27*(w=Ps[1020+3*(f-d)+Ps[1020+u-g]])+63>>7,p=18*w+63>>7,w=9*w+63>>7;l[h-3*c]=Ls[255+l[h-3*c]+w],l[h-2*c]=Ls[255+u+p],l[h-c]=Ls[255+d+_],l[h+0]=Ls[255+f-_],l[h+c]=Ls[255+g-p],l[h+2*c]=Ls[255+m-w]}t+=s}}function Kt(e,t,i,s,n,r,a,o){for(r=2*r+1;0<n--;){if(Gt(e,t,i,r,a))if(jt(e,t,i,o))Vt(e,t,i);else{var l=e,h=t,c=i,u=l[h-c],d=l[h+0],f=l[h+c],g=Os[112+((m=3*(d-u))+4>>3)],m=Os[112+(m+3>>3)],_=g+1>>1;l[h-2*c]=Ls[255+l[h-2*c]+_],l[h-c]=Ls[255+u+m],l[h+0]=Ls[255+d-g],l[h+c]=Ls[255+f-_]}t+=s}}function Yt(e,t,i,s,n,r){$t(e,t,i,1,16,s,n,r)}function zt(e,t,i,s,n,r){$t(e,t,1,i,16,s,n,r)}function Xt(e,t,i,s,n,r){var a;for(a=3;0<a;--a)Kt(e,t+=4*i,i,1,16,s,n,r)}function Jt(e,t,i,s,n,r){var a;for(a=3;0<a;--a)Kt(e,t+=4,1,i,16,s,n,r)}function qt(e,t,i,s,n,r,a,o){$t(e,t,n,1,8,r,a,o),$t(i,s,n,1,8,r,a,o)}function Zt(e,t,i,s,n,r,a,o){$t(e,t,1,n,8,r,a,o),$t(i,s,1,n,8,r,a,o)}function Qt(e,t,i,s,n,r,a,o){Kt(e,t+4*n,n,1,8,r,a,o),Kt(i,s+4*n,n,1,8,r,a,o)}function ei(e,t,i,s,n,r,a,o){Kt(e,t+4,1,n,8,r,a,o),Kt(i,s+4,1,n,8,r,a,o)}function ti(){this.ba=new Z,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new ee,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 si(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function ni(){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 s}function ri(){this.xb=this.a=0,this.l=new je,this.ca=new Z,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new f,this.Pb=0,this.wd=new f,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new ni,this.ab=0,this.gc=nt(4,si),this.Oc=0}function ai(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new je,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function oi(e,t,i,s,n,r,a){for(e=null==e?0:e[t+0],t=0;t<a;++t)n[r+t]=e+i[s+t]&255,e=n[r+t]}function li(e,t,i,s,n,r,a){var o;if(null==e)oi(null,null,i,s,n,r,a);else for(o=0;o<a;++o)n[r+o]=e[t+o]+i[s+o]&255}function hi(e,t,i,s,n,r,a){if(null==e)oi(null,null,i,s,n,r,a);else{var o,l=e[t+0],h=l,c=l;for(o=0;o<a;++o)h=c+(l=e[t+o])-h,c=i[s+o]+(-256&h?0>h?0:255:h)&255,h=l,n[r+o]=c}}function ci(e,t,i,s){var n=t.width,r=t.o;if(Qe(null!=e&&null!=t),0>i||0>=s||i+s>r)return null;if(!e.Cc){if(null==e.ga){var a;if(e.ga=new ai,(a=null==e.ga)||(a=t.width*t.o,Qe(0==e.Gb.length),e.Gb=st(a),e.Uc=0,null==e.Gb?a=0:(e.mb=e.Gb,e.nb=e.Uc,e.rc=null,a=1),a=!a),!a){a=e.ga;var o=e.Fa,l=e.P,c=e.qc,u=e.mb,d=e.nb,f=l+1,g=c-1,_=a.l;if(Qe(null!=o&&null!=u&&null!=t),mn[0]=null,mn[1]=oi,mn[2]=li,mn[3]=hi,a.ca=u,a.tb=d,a.c=t.width,a.i=t.height,Qe(0<a.c&&0<a.i),1>=c)t=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)t=0;else if(_.put=re,_.ac=ne,_.bc=ae,_.ma=a,_.width=t.width,_.height=t.height,_.Da=t.Da,_.v=t.v,_.va=t.va,_.j=t.j,_.o=t.o,a.$a)e:{Qe(1==a.$a),t=ye();t:for(;;){if(null==t){t=0;break e}if(Qe(null!=a),a.mc=t,t.c=a.c,t.i=a.i,t.l=a.l,t.l.ma=a,t.l.width=a.c,t.l.height=a.i,t.a=0,h(t.m,o,f,g),!be(a.c,a.i,1,t,null))break t;if(1==t.ab&&3==t.gc[0].hc&&me(t.s)?(a.ic=1,o=t.c*t.i,t.Ta=null,t.Ua=0,t.V=st(o),t.Ba=0,null==t.V?(t.a=1,t=0):t=1):(a.ic=0,t=Te(t,a.c)),!t)break t;t=1;break e}a.mc=null,t=0}else t=g>=a.c*a.i;a=!t}if(a)return null;1!=e.ga.Lc?e.Ga=0:s=r-i}Qe(null!=e.ga),Qe(i+s<=r);e:{if(t=(o=e.ga).c,r=o.l.o,0==o.$a){if(f=e.rc,g=e.Vc,_=e.Fa,l=e.P+1+i*t,c=e.mb,u=e.nb+i*t,Qe(l<=e.P+e.qc),0!=o.Z)for(Qe(null!=mn[o.Z]),a=0;a<s;++a)mn[o.Z](f,g,_,l,c,u,t),f=c,g=u,u+=t,l+=t;else for(a=0;a<s;++a)tt(c,u,_,l,t),f=c,g=u,u+=t,l+=t;e.rc=f,e.Vc=g}else{if(Qe(null!=o.mc),t=i+s,Qe(null!=(a=o.mc)),Qe(t<=a.i),a.C>=t)t=1;else if(o.ic||mi(),o.ic){o=a.V,f=a.Ba,g=a.c;var w=a.i,v=(_=1,l=a.$/g,c=a.$%g,u=a.m,d=a.s,a.$),y=g*w,b=g*t,T=d.wc,S=v<b?de(d,c,l):null;Qe(v<=y),Qe(t<=w),Qe(me(d));t:for(;;){for(;!u.h&&v<b;){if(c&T||(S=de(d,c,l)),Qe(null!=S),p(u),256>(w=ce(S.G[0],S.H[0],u)))o[f+v]=w,++v,++c>=g&&(c=0,++l<=t&&!(l%16)&&pe(a,l));else{if(!(280>w)){_=0;break t}w=le(w-256,u);var C,E=ce(S.G[4],S.H[4],u);if(p(u),!(v>=(E=he(g,E=le(E,u)))&&y-v>=w)){_=0;break t}for(C=0;C<w;++C)o[f+v+C]=o[f+v+C-E];for(v+=w,c+=w;c>=g;)c-=g,++l<=t&&!(l%16)&&pe(a,l);v<b&&c&T&&(S=de(d,c,l))}Qe(u.h==m(u))}pe(a,l>t?t:l);break t}!_||u.h&&v<y?(_=0,a.a=u.h?5:3):a.$=v,t=_}else t=we(a,a.V,a.Ba,a.c,a.i,t,Se);if(!t){s=0;break e}}i+s>=r&&(e.Cc=1),s=1}if(!s)return null;if(e.Cc&&(null!=(s=e.ga)&&(s.mc=null),e.ga=null,0<e.Ga))return alert("todo:WebPDequantizeLevels"),null}return e.nb+i*n}function ui(e,t,i,s,n,r){for(;0<n--;){var a,o=e,l=t+(i?1:0),h=e,c=t+(i?0:3);for(a=0;a<s;++a){var u=h[c+4*a];255!=u&&(u*=32897,o[l+4*a+0]=o[l+4*a+0]*u>>23,o[l+4*a+1]=o[l+4*a+1]*u>>23,o[l+4*a+2]=o[l+4*a+2]*u>>23)}t+=r}}function di(e,t,i,s,n){for(;0<s--;){var r;for(r=0;r<i;++r){var a=e[t+2*r+0],o=15&(h=e[t+2*r+1]),l=4369*o,h=(240&h|h>>4)*l>>16;e[t+2*r+0]=(240&a|a>>4)*l>>16&240|(15&a|a<<4)*l>>16>>4&15,e[t+2*r+1]=240&h|o}t+=n}}function fi(e,t,i,s,n,r,a,o){var l,h,c=255;for(h=0;h<n;++h){for(l=0;l<s;++l){var u=e[t+l];r[a+4*l]=u,c&=u}t+=i,a+=o}return 255!=c}function gi(e,t,i,s,n){var r;for(r=0;r<n;++r)i[s+r]=e[t+r]>>8}function mi(){bs=ui,Ts=di,Ss=fi,Cs=gi}function _i(e,t,i){self[e]=function(e,s,n,r,a,o,l,h,c,u,d,f,g,m,_,p,w){var v,y=w-1>>1,b=a[o+0]|l[h+0]<<16,T=c[u+0]|d[f+0]<<16;Qe(null!=e);var S=3*b+T+131074>>2;for(t(e[s+0],255&S,S>>16,g,m),null!=n&&(S=3*T+b+131074>>2,t(n[r+0],255&S,S>>16,_,p)),v=1;v<=y;++v){var C=a[o+v]|l[h+v]<<16,E=c[u+v]|d[f+v]<<16,x=b+C+T+E+524296,I=x+2*(C+T)>>3;S=I+b>>1,b=(x=x+2*(b+E)>>3)+C>>1,t(e[s+2*v-1],255&S,S>>16,g,m+(2*v-1)*i),t(e[s+2*v-0],255&b,b>>16,g,m+(2*v-0)*i),null!=n&&(S=x+T>>1,b=I+E>>1,t(n[r+2*v-1],255&S,S>>16,_,p+(2*v-1)*i),t(n[r+2*v+0],255&b,b>>16,_,p+(2*v+0)*i)),b=C,T=E}1&w||(S=3*b+T+131074>>2,t(e[s+w-1],255&S,S>>16,g,m+(w-1)*i),null!=n&&(S=3*T+b+131074>>2,t(n[r+w-1],255&S,S>>16,_,p+(w-1)*i)))}}function pi(){_n[ks]=pn,_n[Ms]=vn,_n[Fs]=wn,_n[Vs]=yn,_n[js]=bn,_n[Ns]=Tn,_n[Gs]=Sn,_n[Bs]=vn,_n[Us]=yn,_n[Ws]=bn,_n[Hs]=Tn}function wi(e){return e&~Rn?0>e?0:255:e>>An}function vi(e,t){return wi((19077*e>>8)+(26149*t>>8)-14234)}function yi(e,t,i){return wi((19077*e>>8)-(6419*t>>8)-(13320*i>>8)+8708)}function bi(e,t){return wi((19077*e>>8)+(33050*t>>8)-17685)}function Ti(e,t,i,s,n){s[n+0]=vi(e,i),s[n+1]=yi(e,t,i),s[n+2]=bi(e,t)}function Si(e,t,i,s,n){s[n+0]=bi(e,t),s[n+1]=yi(e,t,i),s[n+2]=vi(e,i)}function Ci(e,t,i,s,n){var r=yi(e,t,i);t=r<<3&224|bi(e,t)>>3,s[n+0]=248&vi(e,i)|r>>5,s[n+1]=t}function Ei(e,t,i,s,n){var r=240&bi(e,t)|15;s[n+0]=240&vi(e,i)|yi(e,t,i)>>4,s[n+1]=r}function xi(e,t,i,s,n){s[n+0]=255,Ti(e,t,i,s,n+1)}function Ii(e,t,i,s,n){Si(e,t,i,s,n),s[n+3]=255}function Ai(e,t,i,s,n){Ti(e,t,i,s,n),s[n+3]=255}function Ve(e,t){return 0>e?0:e>t?t:e}function Ri(e,t,i){self[e]=function(e,s,n,r,a,o,l,h,c){for(var u=h+(-2&c)*i;h!=u;)t(e[s+0],n[r+0],a[o+0],l,h),t(e[s+1],n[r+0],a[o+0],l,h+i),s+=2,++r,++o,h+=2*i;1&c&&t(e[s+0],n[r+0],a[o+0],l,h)}}function Pi(e,t,i){return 0==i?0==e?0==t?6:5:0==t?4:0:i}function Oi(e,t,i,s,n){switch(e>>>30){case 3:ns(t,i,s,n,0);break;case 2:rs(t,i,s,n);break;case 1:os(t,i,s,n)}}function Li(e,t){var i,s,n=t.M,r=t.Nb,a=e.oc,o=e.pc+40,l=e.oc,h=e.pc+584,c=e.oc,u=e.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,c[u+32*i-1]=129;for(0<n?a[o-1-32]=l[h-1-32]=c[u-1-32]=129:(it(a,o-32-1,127,21),it(l,h-32-1,127,9),it(c,u-32-1,127,9)),s=0;s<e.za;++s){var d=t.ya[t.aa+s];if(0<s){for(i=-1;16>i;++i)tt(a,o+32*i-4,a,o+32*i+12,4);for(i=-1;8>i;++i)tt(l,h+32*i-4,l,h+32*i+4,4),tt(c,u+32*i-4,c,u+32*i+4,4)}var f=e.Gd,g=e.Hd+s,m=d.ad,_=d.Hc;if(0<n&&(tt(a,o-32,f[g].y,0,16),tt(l,h-32,f[g].f,0,8),tt(c,u-32,f[g].ea,0,8)),d.Za){var p=a,w=o-32+16;for(0<n&&(s>=e.za-1?it(p,w,f[g].y[15],4):tt(p,w,f[g+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,_<<=2)p=a,w=o+Vn[i],un[d.Ob[i]](p,w),Oi(_,m,16*+i,p,w)}else if(p=Pi(s,n,d.Ob[0]),cn[p](a,o),0!=_)for(i=0;16>i;++i,_<<=2)Oi(_,m,16*+i,a,o+Vn[i]);for(i=d.Gc,p=Pi(s,n,d.Dd),dn[p](l,h),dn[p](c,u),_=m,p=l,w=h,255&(d=i>>0)&&(170&d?as(_,256,p,w):ls(_,256,p,w)),d=c,_=u,255&(i>>=8)&&(170&i?as(m,320,d,_):ls(m,320,d,_)),n<e.Ub-1&&(tt(f[g].y,0,a,o+480,16),tt(f[g].f,0,l,h+224,8),tt(f[g].ea,0,c,u+224,8)),i=8*r*e.B,f=e.sa,g=e.ta+16*s+16*r*e.R,m=e.qa,d=e.ra+8*s+i,_=e.Ha,p=e.Ia+8*s+i,i=0;16>i;++i)tt(f,g+i*e.R,a,o+32*i,16);for(i=0;8>i;++i)tt(m,d+i*e.B,l,h+32*i,8),tt(_,p+i*e.B,c,u+32*i,8)}}function Di(e,t,i,s,n,r,a,o,l){var c=[0],u=[0],d=0,g=null!=l?l.kd:0,m=null!=l?l:new ii;if(null==e||12>i)return 7;m.data=e,m.w=t,m.ha=i,t=[t],i=[i],m.gb=[m.gb];e:{var _=t,p=i,w=m.gb;if(Qe(null!=e),Qe(null!=p),Qe(null!=w),w[0]=0,12<=p[0]&&!et(e,_[0],"RIFF")){if(et(e,_[0]+8,"WEBP")){w=3;break e}var v=C(e,_[0]+4);if(12>v||4294967286<v){w=3;break e}if(g&&v>p[0]-8){w=7;break e}w[0]=v,_[0]+=12,p[0]-=12}w=0}if(0!=w)return w;for(v=0<m.gb[0],i=i[0];;){e:{var y=e;p=t,w=i;var b=c,T=u,E=_=[0];if((A=d=[d])[0]=0,8>w[0])w=7;else{if(!et(y,p[0],"VP8X")){if(10!=C(y,p[0]+4)){w=3;break e}if(18>w[0]){w=7;break e}var x=C(y,p[0]+8),I=1+S(y,p[0]+12);if(2147483648<=I*(y=1+S(y,p[0]+15))){w=3;break e}null!=E&&(E[0]=x),null!=b&&(b[0]=I),null!=T&&(T[0]=y),p[0]+=18,w[0]-=18,A[0]=1}w=0}}if(d=d[0],_=_[0],0!=w)return w;if(p=!!(2&_),!v&&d)return 3;if(null!=r&&(r[0]=!!(16&_)),null!=a&&(a[0]=p),null!=o&&(o[0]=0),a=c[0],_=u[0],d&&p&&null==l){w=0;break}if(4>i){w=7;break}if(v&&d||!v&&!d&&!et(e,t[0],"ALPH")){i=[i],m.na=[m.na],m.P=[m.P],m.Sa=[m.Sa];e:{x=e,w=t,v=i;var A=m.gb;b=m.na,T=m.P,E=m.Sa;I=22,Qe(null!=x),Qe(null!=v),y=w[0];var R=v[0];for(Qe(null!=b),Qe(null!=E),b[0]=null,T[0]=null,E[0]=0;;){if(w[0]=y,v[0]=R,8>R){w=7;break e}var P=C(x,y+4);if(4294967286<P){w=3;break e}var O=8+P+1&-2;if(I+=O,0<A&&I>A){w=3;break e}if(!et(x,y,"VP8 ")||!et(x,y,"VP8L")){w=0;break e}if(R[0]<O){w=7;break e}et(x,y,"ALPH")||(b[0]=x,T[0]=y+8,E[0]=P),y+=O,R-=O}}if(i=i[0],m.na=m.na[0],m.P=m.P[0],m.Sa=m.Sa[0],0!=w)break}i=[i],m.Ja=[m.Ja],m.xa=[m.xa];e:if(A=e,w=t,v=i,b=m.gb[0],T=m.Ja,E=m.xa,x=w[0],y=!et(A,x,"VP8 "),I=!et(A,x,"VP8L"),Qe(null!=A),Qe(null!=v),Qe(null!=T),Qe(null!=E),8>v[0])w=7;else{if(y||I){if(A=C(A,x+4),12<=b&&A>b-12){w=3;break e}if(g&&A>v[0]-8){w=7;break e}T[0]=A,w[0]+=8,v[0]-=8,E[0]=I}else E[0]=5<=v[0]&&47==A[x+0]&&!(A[x+4]>>5),T[0]=v[0];w=0}if(i=i[0],m.Ja=m.Ja[0],m.xa=m.xa[0],t=t[0],0!=w)break;if(4294967286<m.Ja)return 3;if(null==o||p||(o[0]=m.xa?2:1),a=[a],_=[_],m.xa){if(5>i){w=7;break}o=a,g=_,p=r,null==e||5>i?e=0:5<=i&&47==e[t+0]&&!(e[t+4]>>5)?(v=[0],A=[0],b=[0],h(T=new f,e,t,i),oe(T,v,A,b)?(null!=o&&(o[0]=v[0]),null!=g&&(g[0]=A[0]),null!=p&&(p[0]=b[0]),e=1):e=0):e=0}else{if(10>i){w=7;break}o=_,null==e||10>i||!Be(e,t+3,i-3)?e=0:(g=e[t+0]|e[t+1]<<8|e[t+2]<<16,p=16383&(e[t+7]<<8|e[t+6]),e=16383&(e[t+9]<<8|e[t+8]),1&g||3<(g>>1&7)||!(g>>4&1)||g>>5>=m.Ja||!p||!e?e=0:(a&&(a[0]=p),o&&(o[0]=e),e=1))}if(!e)return 3;if(a=a[0],_=_[0],d&&(c[0]!=a||u[0]!=_))return 3;null!=l&&(l[0]=m,l.offset=t-l.w,Qe(4294967286>t-l.w),Qe(l.offset==l.ha-i));break}return 0==w||7==w&&d&&null==l?(null!=r&&(r[0]|=null!=m.na&&0<m.na.length),null!=s&&(s[0]=a),null!=n&&(n[0]=_),0):w}function ki(e,t,i){var s=t.width,n=t.height,r=0,a=0,o=s,l=n;if(t.Da=null!=e&&0<e.Da,t.Da&&(o=e.cd,l=e.bd,r=e.v,a=e.j,11>i||(r&=-2,a&=-2),0>r||0>a||0>=o||0>=l||r+o>s||a+l>n))return 0;if(t.v=r,t.j=a,t.va=r+o,t.o=a+l,t.U=o,t.T=l,t.da=null!=e&&0<e.da,t.da){if(!A(o,l,i=[e.ib],r=[e.hb]))return 0;t.ib=i[0],t.hb=r[0]}return t.ob=null!=e&&e.ob,t.Kb=null==e||!e.Sd,t.da&&(t.ob=t.ib<3*s/4&&t.hb<3*n/4,t.Kb=0),1}function Mi(e){if(null==e)return 2;if(11>e.S){var t=e.f.RGBA;t.fb+=(e.height-1)*t.A,t.A=-t.A}else t=e.f.kb,e=e.height,t.O+=(e-1)*t.fa,t.fa=-t.fa,t.N+=(e-1>>1)*t.Ab,t.Ab=-t.Ab,t.W+=(e-1>>1)*t.Db,t.Db=-t.Db,null!=t.F&&(t.J+=(e-1)*t.lb,t.lb=-t.lb);return 0}function Fi(e,t,i,s){if(null==s||0>=e||0>=t)return 2;if(null!=i){if(i.Da){var n=i.cd,r=i.bd,a=-2&i.v,o=-2&i.j;if(0>a||0>o||0>=n||0>=r||a+n>e||o+r>t)return 2;e=n,t=r}if(i.da){if(!A(e,t,n=[i.ib],r=[i.hb]))return 2;e=n[0],t=r[0]}}s.width=e,s.height=t;e:{var l=s.width,h=s.height;if(e=s.S,0>=l||0>=h||!(e>=ks&&13>e))e=2;else{if(0>=s.Rd&&null==s.sd){a=r=n=t=0;var c=(o=l*Bn[e])*h;if(11>e||(r=(h+1)/2*(t=(l+1)/2),12==e&&(a=(n=l)*h)),null==(h=st(c+2*r+a))){e=1;break e}s.sd=h,11>e?((l=s.f.RGBA).eb=h,l.fb=0,l.A=o,l.size=c):((l=s.f.kb).y=h,l.O=0,l.fa=o,l.Fd=c,l.f=h,l.N=0+c,l.Ab=t,l.Cd=r,l.ea=h,l.W=0+c+r,l.Db=t,l.Ed=r,12==e&&(l.F=h,l.J=0+c+2*r),l.Tc=a,l.lb=n)}if(t=1,n=s.S,r=s.width,a=s.height,n>=ks&&13>n)if(11>n)e=s.f.RGBA,t&=(o=Math.abs(e.A))*(a-1)+r<=e.size,t&=o>=r*Bn[n],t&=null!=e.eb;else{e=s.f.kb,o=(r+1)/2,c=(a+1)/2,l=Math.abs(e.fa);h=Math.abs(e.Ab);var u=Math.abs(e.Db),d=Math.abs(e.lb),f=d*(a-1)+r;t&=l*(a-1)+r<=e.Fd,t&=h*(c-1)+o<=e.Cd,t=(t&=u*(c-1)+o<=e.Ed)&l>=r&h>=o&u>=o,t&=null!=e.y,t&=null!=e.f,t&=null!=e.ea,12==n&&(t&=d>=r,t&=f<=e.Tc,t&=null!=e.F)}else t=0;e=t?0:2}}return 0!=e||null!=i&&i.fd&&(e=Mi(s)),e}var Vi=64,ji=[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,Gi=32,Bi=8,Ui=[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];O("Predictor0","PredictorAdd0"),self.Predictor0=function(){return 4278190080},self.Predictor1=function(e){return e},self.Predictor2=function(e,t,i){return t[i+0]},self.Predictor3=function(e,t,i){return t[i+1]},self.Predictor4=function(e,t,i){return t[i-1]},self.Predictor5=function(e,t,i){return D(D(e,t[i+1]),t[i+0])},self.Predictor6=function(e,t,i){return D(e,t[i-1])},self.Predictor7=function(e,t,i){return D(e,t[i+0])},self.Predictor8=function(e,t,i){return D(t[i-1],t[i+0])},self.Predictor9=function(e,t,i){return D(t[i+0],t[i+1])},self.Predictor10=function(e,t,i){return D(D(e,t[i-1]),D(t[i+0],t[i+1]))},self.Predictor11=function(e,t,i){var s=t[i+0];return 0>=F(s>>24&255,e>>24&255,(t=t[i-1])>>24&255)+F(s>>16&255,e>>16&255,t>>16&255)+F(s>>8&255,e>>8&255,t>>8&255)+F(255&s,255&e,255&t)?s:e},self.Predictor12=function(e,t,i){var s=t[i+0];return(k((e>>24&255)+(s>>24&255)-((t=t[i-1])>>24&255))<<24|k((e>>16&255)+(s>>16&255)-(t>>16&255))<<16|k((e>>8&255)+(s>>8&255)-(t>>8&255))<<8|k((255&e)+(255&s)-(255&t)))>>>0},self.Predictor13=function(e,t,i){var s=t[i-1];return(M((e=D(e,t[i+0]))>>24&255,s>>24&255)<<24|M(e>>16&255,s>>16&255)<<16|M(e>>8&255,s>>8&255)<<8|M(e>>0&255,s>>0&255))>>>0};var Wi=self.PredictorAdd0;self.PredictorAdd1=V,O("Predictor2","PredictorAdd2"),O("Predictor3","PredictorAdd3"),O("Predictor4","PredictorAdd4"),O("Predictor5","PredictorAdd5"),O("Predictor6","PredictorAdd6"),O("Predictor7","PredictorAdd7"),O("Predictor8","PredictorAdd8"),O("Predictor9","PredictorAdd9"),O("Predictor10","PredictorAdd10"),O("Predictor11","PredictorAdd11"),O("Predictor12","PredictorAdd12"),O("Predictor13","PredictorAdd13");var Hi=self.PredictorAdd2;B("ColorIndexInverseTransform","MapARGB","32b",(function(e){return e>>8&255}),(function(e){return e})),B("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",(function(e){return e}),(function(e){return e>>8&255}));var $i,Ki=self.ColorIndexInverseTransform,Yi=self.MapARGB,zi=self.VP8LColorIndexInverseTransformAlpha,Xi=self.MapAlpha,Ji=self.VP8LPredictorsAdd=[];Ji.length=16,(self.VP8LPredictors=[]).length=16,(self.VP8LPredictorsAdd_C=[]).length=16,(self.VP8LPredictors_C=[]).length=16;var qi,Zi,Qi,es,ts,is,ss,ns,rs,as,os,ls,hs,cs,us,ds,fs,gs,ms,_s,ps,ws,vs,ys,bs,Ts,Ss,Cs,Es=st(511),xs=st(2041),Is=st(225),As=st(767),Rs=0,Ps=xs,Os=Is,Ls=As,Ds=Es,ks=0,Ms=1,Fs=2,Vs=3,js=4,Ns=5,Gs=6,Bs=7,Us=8,Ws=9,Hs=10,$s=[2,3,7],Ks=[3,3,11],Ys=[280,256,256,256,40],zs=[0,1,1,1,0],Xs=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],Js=[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],qs=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],Zs=8,Qs=[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],en=[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],tn=null,sn=[[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]],nn=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],rn=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],an=[[[[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]]]],on=[[[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]]],ln=[[[[255,255,255,255,255,255,255,255,255,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]]]],hn=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],cn=[],un=[],dn=[],fn=1,gn=2,mn=[],_n=[];_i("UpsampleRgbLinePair",Ti,3),_i("UpsampleBgrLinePair",Si,3),_i("UpsampleRgbaLinePair",Ai,4),_i("UpsampleBgraLinePair",Ii,4),_i("UpsampleArgbLinePair",xi,4),_i("UpsampleRgba4444LinePair",Ei,2),_i("UpsampleRgb565LinePair",Ci,2);var pn=window.UpsampleRgbLinePair,wn=window.UpsampleBgrLinePair,vn=window.UpsampleRgbaLinePair,yn=window.UpsampleBgraLinePair,bn=window.UpsampleArgbLinePair,Tn=window.UpsampleRgba4444LinePair,Sn=window.UpsampleRgb565LinePair,Cn=16,En=1<<Cn-1,xn=-227,In=482,An=6,Rn=(256<<An)-1,Pn=0,On=st(256),Ln=st(256),Dn=st(256),kn=st(256),Mn=st(In-xn),Fn=st(In-xn);Ri("YuvToRgbRow",Ti,3),Ri("YuvToBgrRow",Si,3),Ri("YuvToRgbaRow",Ai,4),Ri("YuvToBgraRow",Ii,4),Ri("YuvToArgbRow",xi,4),Ri("YuvToRgba4444Row",Ei,2),Ri("YuvToRgb565Row",Ci,2);var Vn=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],jn=[0,2,8],Nn=[8,7,6,4,4,2,2,2,1,1,1,1],Gn=1;this.WebPDecodeRGBA=function(e,t,i,s,n){var r=Ms,a=new ti,o=new Z;a.ba=o,o.S=r,o.width=[o.width],o.height=[o.height];var l=o.width,c=o.height,u=new Q;if(null==u||null==e)var d=2;else Qe(null!=u),d=Di(e,t,i,u.width,u.height,u.Pd,u.Qd,u.format,null);if(0!=d?l=0:(null!=l&&(l[0]=u.width[0]),null!=c&&(c[0]=u.height[0]),l=1),l){o.width=o.width[0],o.height=o.height[0],null!=s&&(s[0]=o.width),null!=n&&(n[0]=o.height);e:{if(s=new je,(n=new ii).data=e,n.w=t,n.ha=i,n.kd=1,t=[0],Qe(null!=n),(0==(e=Di(n.data,n.w,n.ha,null,null,null,t,null,n))||7==e)&&t[0]&&(e=4),0==(t=e)){if(Qe(null!=a),s.data=n.data,s.w=n.w+n.offset,s.ha=n.ha-n.offset,s.put=re,s.ac=ne,s.bc=ae,s.ma=a,n.xa){if(null==(e=ye())){a=1;break e}if(function(e,t){var i=[0],s=[0],n=[0];t:for(;;){if(null==e)return 0;if(null==t)return e.a=2,0;if(e.l=t,e.a=0,h(e.m,t.data,t.w,t.ha),!oe(e.m,i,s,n)){e.a=3;break t}if(e.xb=gn,t.width=i[0],t.height=s[0],!be(i[0],s[0],1,e,null))break t;return 1}return Qe(0!=e.a),0}(e,s)){if(s=0==(t=Fi(s.width,s.height,a.Oa,a.ba))){t:{s=e;i:for(;;){if(null==s){s=0;break t}if(Qe(null!=s.s.yc),Qe(null!=s.s.Ya),Qe(0<s.s.Wb),Qe(null!=(i=s.l)),Qe(null!=(n=i.ma)),0!=s.xb){if(s.ca=n.ba,s.tb=n.tb,Qe(null!=s.ca),!ki(n.Oa,i,Vs)){s.a=2;break i}if(!Te(s,i.width))break i;if(i.da)break i;if((i.da||X(s.ca.S))&&mi(),11>s.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),null!=s.ca.f.kb.F&&mi()),s.Pb&&0<s.s.ua&&null==s.s.vb.X&&!E(s.s.vb,s.s.Wa.Xa)){s.a=1;break i}s.xb=0}if(!we(s,s.V,s.Ba,s.c,s.i,i.o,ge))break i;n.Dc=s.Ma,s=1;break t}Qe(0!=s.a),s=0}s=!s}s&&(t=e.a)}else t=e.a}else{if(null==(e=new Ne)){a=1;break e}if(e.Fa=n.na,e.P=n.P,e.qc=n.Sa,Ue(e,s)){if(0==(t=Fi(s.width,s.height,a.Oa,a.ba))){if(e.Aa=0,i=a.Oa,Qe(null!=(n=e)),null!=i){if(0<(l=0>(l=i.Md)?0:100<l?255:255*l/100)){for(c=u=0;4>c;++c)12>(d=n.pb[c]).lc&&(d.ia=l*Nn[0>d.lc?0:d.lc]>>3),u|=d.ia;u&&(alert("todo:VP8InitRandom"),n.ia=1)}n.Ga=i.Id,100<n.Ga?n.Ga=100:0>n.Ga&&(n.Ga=0)}$e(e,s)||(t=e.a)}}else t=e.a}0==t&&null!=a.Oa&&a.Oa.fd&&(t=Mi(a.ba))}a=t}r=0!=a?null:11>r?o.f.RGBA.eb:o.f.kb.y}else r=null;return r};var Bn=[3,4,3,4,4,2,2,4,4,4,2,1,1]},new window.WebPDecoder,window.WebPRiffParser=function(e,t){var i={},s=0,n=!1,r=0,a=0;if(i.frames=[],!function(e,t,i,s){for(var n=0;n<s;n++)if(e[t+n]!=i.charCodeAt(n))return!0;return!1}(e,t,"RIFF",4)){for(lt(e,t+=4),t+=8;t<e.length;){var o=at(e,t),l=lt(e,t+=4);t+=4;var h=l+(1&l);switch(o){case"VP8 ":case"VP8L":void 0===i.frames[s]&&(i.frames[s]={}),(d=i.frames[s]).src_off=n?a:t-8,d.src_size=r+l+8,s++,n&&(n=!1,r=0,a=0);break;case"VP8X":(d=i.header={}).feature_flags=e[t];var c=t+4;d.canvas_width=1+ot(e,c),c+=3,d.canvas_height=1+ot(e,c),c+=3;break;case"ALPH":n=!0,r=h+8,a=t-8;break;case"ANIM":(d=i.header).bgcolor=lt(e,t),c=t+4,d.loop_count=(f=e)[(g=c)+0]<<0|f[g+1]<<8,c+=2;break;case"ANMF":var u,d;(d=i.frames[s]={}).offset_x=2*ot(e,t),t+=3,d.offset_y=2*ot(e,t),t+=3,d.width=1+ot(e,t),t+=3,d.height=1+ot(e,t),t+=3,d.duration=ot(e,t),t+=3,u=e[t++],d.dispose=1&u,d.blend=u>>1&1}"ANMF"!=o&&(t+=h)}var f,g;return i}},window.ApicTools={parseGIF:e,decompressFrames:t},console.log("Define originDocument ..."),window.originDocument={},window.originDocument.headAppendChild=window.document.head.appendChild.bind(window.document.head),window.originDocument.headRemoveChild=window.document.head.removeChild.bind(window.document.head),window.originDocument.createElement=window.document.createElement.bind(window.document),window.originDocument.createTextNode=window.document.createTextNode.bind(window.document),window.originDocument.createComment=window.document.createComment.bind(window.document),window.originDocument.getElementById=window.document.getElementById.bind(window.document),window.originDocument.getElementsByTagName=window.document.getElementsByTagName.bind(window.document),window.originDocument.querySelector=window.document.querySelector.bind(window.document),window.originDocument.createEvent=window.document.createEvent.bind(window.document),window.originDocument.dispatchEvent=window.document.dispatchEvent.bind(window.document);class ht{constructor(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){let t=e.indexOf("(")+1,i=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,i).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if((!0===e.startsWith("./")||!0===e.startsWith("../"))&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.__MainPath||"undefined"===window.JsView.Dom.__MainPathRef||window.JsView.Dom.__MainPathRef!==document.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.__MainPathRef=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.__MainPath=document.location.origin+document.location.pathname.substring(0,e)+"/"}let t=window.JsView.Dom.__MainPath;e=e.startsWith("./")?t+e.substring(2):t+e}if(this.href=e,!t)return;let s=this.href,n=s.indexOf("#");n>0&&(this.hash=s.substring(n),s=s.substring(0,n));let r=s.indexOf("?");r>1&&(this.search=s.substring(r),s=s.substring(0,r));let a=s,o=a.indexOf("://");this.protocol=o>0?a.substring(0,o+1):"";let l=o>1?a.substring(o+3):"";if(o=l.indexOf("/"),this.host=o>0?l.substring(0,o):"",this.pathname=o>1?l.substring(o):"",this.origin=o>0?this.protocol+"//"+this.host:"",this.host.startsWith("[")){let e=this.host.indexOf("]");this.hostname=this.host.substring(0,e+1),e=this.host.substring(e+1).indexOf(":"),this.port=e>1?this.host.substring(e+1):""}else{let e=this.host.indexOf(":");this.hostname=e>0?this.host.substring(0,e):this.host,this.port=e>1?this.host.substring(e+1):""}}replace(e){this.href=e}}window.JsView&&window.JsView.registerUriConverter?.((e=>new ht(e,!1).href));class ct{static SetBackgroundColor(e,t,s){const n=ct.TextureManager.GetColorTexture(t);let r;s&&(r=new i.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new i.TextureSetting(n,r);e.ResetTexture(a)}static SetBackgroundImage(e,t,s,n,r,a){if("string"==typeof t&&(t=new ht(t)),t instanceof ht==!1)throw Error("Bad Argument.",t);let o;if(o=t.href.endsWith("gif")||t.href.endsWith("webp")?ct.TextureManager.GetGifImage(t.href,!1,null):ct.TextureManager.GetImage2(t.href,!1,r,a||i.ColorSpace.RGBA_8888),o){let t;s&&(t=new i.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const r=new i.ExternalTextureSetting(o,t);if(e.ResetTexture(r),n){let t=o.RegisterLoadImageCallback(null,(function(){n({width:o.Width,height:o.Height})}));e.RegisterDetachCallback((()=>{o.UnregisterLoadImageCallback(t)}))}}}static SetMaskedBackgroundImage(e,t,s,n){if("string"==typeof t&&(t=new ht(t)),t instanceof ht==!1)throw Error("Bad Argument.",t);if("string"==typeof s&&(s=new ht(s)),s instanceof ht==!1)throw Error("Bad Argument(MaskURL).",s);const r=ct.TextureManager.GetImage2(t.href,!1,null,n||i.ColorSpace.RGBA_8888);if(r){const t=ct.TextureManager.GetImage2(s.href,!1,null,i.ColorSpace.RGBA_8888),n=new i.ExternalTextureSetting(r,new i.ViewTextureMask(t));e.ResetTexture(n)}}static SetVideoTexture(e,t,s){const n=ct.TextureManager.GetColorTexture(t);let r;s&&(r=new i.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new i.TextureSetting(n,r);e.ResetTexture(a)}static GetTextWidth(e){return e.str||(e.str=""),e.font||(e.font=i.TextUtils._sDefaultFont),e.size||(e.size=i.TextUtils._sDefaultFontSize),"italic"!==e.italic&&(e.italic=""),"bold"!==e.bold&&(e.bold=""),window.PlatformUtils.GetTextWidth(e)}static RequestSwap(){i.sRenderBridge.RequestSwap()}static SetImgTexSize(e,t){let i={size:t,refNum:0};ct.TextureInfo.Cache[e.Source]=i}static RefImgTexSize(e,t){let i=ct.TextureInfo.Cache[e.Source];i?(i.refNum>0?i.refNum++:i.refNum=1,t(i.size)):e.RegisterLoadImageCallback(null,(function(){const i={width:e.Width,height:e.Height};t(i);let s=ct.TextureInfo.Cache[e.Source];if(s)s.refNum>0?s.refNum++:s.refNum=1;else{let t={size:i,refNum:1};ct.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=ct.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&ct.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of ct.TextureInfo.Unused){let t=ct.TextureInfo.Cache[e];t.refNum<-2?(delete ct.TextureInfo.Cache[e],ct.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:ct.TextureInfo.Unused.delete(e)}}}ct.TextureInfo={Cache:{},Unused:new Set},ct.TextureManager=null,ct.RootView=null,ct.RootActivity=null,ct.HaltKeyEvent=!1;class ut{constructor(e){this.target=null,this.timeStamp=Date.now(),this.type=e}initEvent(e,t,i){this.type=e}}let dt={cnt:0};class ft{constructor(e){this.type=e,this.cachedValues=null,this.onSyncCallback=null}setOnSyncCallback(e){this.onSyncCallback=e,this.syncLastCaches(!0)}setCacheProperty(e,t){this.cachedValues||(this.cachedValues={}),this.cachedValues[e]=t,this.syncLastCaches(!1),ct.RequestSwap()}syncLastCaches(e){let t=ft.LastModified[this.type];if((e||t!==this)&&(ft.LastModified[this.type]=this,t&&t.cachedValues&&"function"==typeof t.onSyncCallback)){let e=t.cachedValues;t.cachedValues=null,t.onSyncCallback(e)}}static SyncAllCachedProperty(){for(let e of Object.values(ft.LastModified))e.syncLastCaches(!0);dt.cnt=(dt.cnt+1)%65535}}ft.LastModified={},window.JsView&&(window.JsView.Dom={DesignMap:null,Render:null,Extension:ct,UrlRef:ht},window.JsView.React=window.JsView.Dom);class gt{static SetLevel(e){switch(gt.E=gt.W=gt.I=gt.D=function(){},e){case gt.Level.Verbose:gt.V=console.debug.bind(console);case gt.Level.Debug:gt.D=console.debug.bind(console);case gt.Level.Info:gt.I=console.info.bind(console)}}static Throw(...e){throw console.error(...e),[...e]}}gt.E=console.error.bind(console),gt.W=console.warn.bind(console),gt.I=console.info.bind(console),gt.D=function(){},gt.V=function(){},gt.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class mt{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[],this.jsvEventListener=void 0,this.jsvChildChangedCallback=void 0}jsvGetTagName(){return"Unknown"}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.jsvChildChangedCallback?.()}removeChild(e){for(let t=e.childNodes.length-1;t>=0;t--)e.removeChild(e.childNodes[t]);let t=this.childNodes.indexOf(e);t<0&>.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(t,1),e.parentNode=void 0,this.jsvChildChangedCallback?.()}insertBefore(e,t){let i=this.childNodes.length;void 0===t?gt.Throw("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present."):null!==t&&(i=this.childNodes.indexOf(t)),i<0&>.Throw("Failed to call Node.insertBefore(), before node not found. beforeNode=",t),this.childNodes.splice(i,0,e),e.parentNode=this,this.jsvChildChangedCallback?.()}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);return t<0&>.Throw("Failed to call Node.previousSibling(), this node not found. this=",this),e[t-1]}get nextSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);return t<0&>.Throw("Failed to call Node.nextSibling(), this node not found. this=",this),e[t+1]}addEventListener(e,t,i){this.jsvEventListener||(this.jsvEventListener={});let s=this.jsvEventListener[e];s||(s=new Set,this.jsvEventListener[e]=s),s.add(t)}removeEventListener(e,t,i){if(!this.jsvEventListener)return;let s=this.jsvEventListener[e];s&&(s.delete(t),s.size<=0&&this.jsvEventListener.hasOwnProperty(e)&&delete this.jsvEventListener[e],0===Object.values(this.jsvEventListener).length&&(this.jsvEventListener=void 0))}dispatchEvent(e){if(!this.jsvEventListener)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.jsvEventListener[e.type];if(t){e.target||(e.target=document.activeElement);for(let i of t)i(e)}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.jsvChildChangedCallback=e}}mt.ELEMENT_NODE=1,mt.TEXT_NODE=3,mt.COMMENT_NODE=8,mt.DOCUMENT_NODE=9,mt.NOLAYOUT_NODE=10;class _t extends ut{}_t.Type={FOCUS:"focus",BLUR:"blur"};class pt extends ut{stopPropagation(){}}class wt{static ConvertInt(e){return e?"number"==typeof e?Math.floor(e):"string"==typeof e?parseInt(e):e:e}static ConvertFloat(e){if(!e)return e;if("string"!=typeof e)return e;return parseFloat(e)}static ConvertPx(e){if(!e)return e;if("string"!=typeof e)return e;if("0"===e)return 0;if(e.endsWith("px")){return parseInt(e)}return e}static ConvertRect(e){let t=wt.SplitString(e," "),i={top:t.length>0?parseInt(t[0]):0,right:t.length>1?parseInt(t[1]):null,bottom:t.length>2?parseInt(t[2]):null,left:t.length>3?parseInt(t[3]):null};return i.right=i.right||0===i.right?i.right:i.top,i.bottom=i.bottom||0===i.bottom?i.bottom:i.top,i.left=i.left||0===i.left?i.left:i.right,i}static ConvertCorner(e){let t=wt.SplitString(e," "),i={topLeft:t.length>0?parseInt(t[0]):0,topRight:t.length>1?parseInt(t[1]):null,bottomRight:t.length>2?parseInt(t[2]):null,bottomLeft:t.length>3?parseInt(t[3]):null};return i.topRight=i.topRight||0===i.topRight?i.topRight:i.topLeft,i.bottomRight=i.bottomRight||0===i.bottomRight?i.bottomRight:i.topLeft,i.bottomLeft=i.bottomLeft||0===i.bottomLeft?i.bottomLeft:i.bottomRight,i}static ConvertSize(e){let t=wt.SplitString(e," "),i={width:t.length>0?parseInt(t[0]):0,height:t.length>1?parseInt(t[1]):null};return i.height=i.height||0===i.height?i.height:i.width,i}static ConvertAnimation(e){if(null===e||0===e.length)return null;let t=e.indexOf("cubic-bezier"),i=[];if(t>=0){let s=e.indexOf(")"),n=e.substring(t,s+1),r=wt.SplitString(e,n);for(let e of r){let t=wt.SplitString(e," ");i=i.concat(t)}i.push(n)}else i=wt.SplitString(e," ");let s=null,n=0,r=1,a=e.includes("alternate");for(let e=2;e<i.length;e++){if("infinite"===i[e]){r=-1;continue}let t=wt.ConvertTimeMs(i[e]);!1===isNaN(t)?n=t:(t=parseFloat(i[e]),!1===isNaN(t)?r=t:s=i[e])}let o=i.length>1?wt.ConvertTimeMs(i[1]):0;return{name:i.length>0?i[0]:"",duration:o,timingFunction:wt.ConvertEasing(s,o),delay:n,iterationCount:r,direction:a,originStr:e}}static ConvertTransition(e){if(null==e||0==e.length)return null;let t={},i=new Array,s=e.split(",");for(let e=0;e<s.length;e++)if(s[e].indexOf("(")>=0){let t=e;for(;t<s.length&&s[t].indexOf(")")<0;)t++;let n="";for(let i=e;i<=t;i++)i!=e&&(n+=","),n+=s[i];e=t,i=i.concat(n)}else i=i.concat(s[e]);for(let e of i){let i=wt.ConvertAnimation(e);if(t[i.name]=i,"all"==i.name){let e=new Array("opacity","left","top","width","height","transform");for(let s of e)t[s]=i}}return t}static ConvertTimeMs(e){e||(e="");let t=NaN;return(e=e.trim()).endsWith("ms")?t=1:e.endsWith("s")&&(t=1e3),t*=parseFloat(e),t}static ConvertEasing(e,t){let s=i.Easing.Circular.InOut;if(!e)return s;if(e.includes("ease"))s=e.includes("-in-out")?i.Easing.Circular.InOut:e.includes("-out")?i.Easing.Circular.Out:e.includes("-in")?i.Easing.Circular.In:i.Easing.Circular.InOut;else if(e.includes("linear"))s=null;else if(e.includes("cubic-bezier")){let n=wt.ConvertBezier(e);s=new i.BezierEasing(n.x1,n.y1,n.x2,n.y2,t)}else if(e.includes("steps")){let t=wt.ConvertSteps(e);s=new i.StepsEasing(t.steps,t.type)}return s}static ConvertBezier(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let i=wt.SplitString(e,",");return{x1:i.length>0?parseFloat(i[0]):0,y1:i.length>1?parseFloat(i[1]):0,x2:i.length>2?parseFloat(i[2]):0,y2:i.length>3?parseFloat(i[3]):0}}static ConvertSteps(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let i=wt.SplitString(e,",");return{steps:i.length>0?parseInt(i[0]):1,type:i.length>1?i[1].includes("start")?0:1:0}}static ConvertOverflow(e,t){return e&&!e.includes("visible")?t.HIDDEN:t.VISIBLE}static ConvertObjectFit(e,t){return"symbol"==typeof e?e:(e||(e=""),e.includes("fill")?t.FILL:e.includes("contain")?t.CONTAIN:e.includes("cover")?t.COVER:e.includes("none")?t.NONE:e.includes("scale-down")?t.SCALEDOWN:t.CONTAIN)}static SplitString(e,t){e||(e="");let i=e.trim().split(t);if(" "!==t)return i;let s=[];for(let e of i)e&&s.push(e);return s}}class vt{constructor(e){if(this.top=null,this.right=null,this.bottom=null,this.left=null,!e||!1===e.startsWith("inset"))return void console.error("Inset.Parse() InvalidArgs: value=",e);let t=e.indexOf("(")+1,i=e.substring(t),s=wt.ConvertRect(i);this.top=s.top,this.right=s.right,this.bottom=s.bottom,this.left=s.left}}class yt{constructor(e){if(this.source=null,this.slice=null,this.repeat=null,this.outset=null,this.width=null,!e)return void console.error("BorderImage.constructor() InvalidArgs: value=",e);let t=e.indexOf(")")+1,i=e.substring(0,t),s=e.substring(t);this.source=new ht(i),this.slice=wt.ConvertRect(s)}}class bt{constructor(){this.refStyleObject=new Map,this.value=void 0}static AppendRefStyle(e,t,i){let s=bt.jsvGetStyleVar(e);s.refStyleObject.has(t)||s.refStyleObject.set(t,[]),s.refStyleObject.get(t).push(i)}static RemoveRefStyle(e){for(const t of bt.VariableMap.values())for(const i of t.refStyleObject.keys())i==e&&t.refStyleObject.delete(e)}static UpdateValue(e,t){let i=bt.jsvGetStyleVar(e);i.value=t;for(const[e,t]of i.refStyleObject)for(const i of t)e.jsvSetClassProperty(i)}static GetValue(e){return bt.jsvGetStyleVar(e).value}static jsvGetStyleVar(e){e.startsWith("--")&&(e=`var(${e})`),bt.VariableMap.has(e)||bt.VariableMap.set(e,new bt);return bt.VariableMap.get(e)}}bt.VariableMap=new Map;class Tt{constructor(){this.jsvStore={},this.jsvLazySyncCache=new ft("style"),this.jsvLockedProps={},this.jsvNamedClassArray=null,this.jsvCustomStyles={},this.jsvLazyPrevClassNames=null,this.jsvLazyPrevInheritedClassNames=null,this.jsvLazyClassNames=null,this.jsvLazyInheritedClassNames=null,this.jsvLazyClassAttributes=null}setProperty(e,t){"function"==typeof document.jsvCheckStyleFormat&&document.jsvCheckStyleFormat(e,t),this.jsvLockedProps[e]=!0,t=Tt.JsvConvertPropValue(e,t),this.jsvUpdateProperty(e,t)}getPropertyValue(e){if(void 0!==this.jsvStore[e])return this.jsvStore[e];let t=this.jsvGetClassPropValue(this.jsvLazyClassNames,this.jsvLazyClassAttributes,e);return t?(e==Tt.PROP.ANIMATION?t=wt.ConvertAnimation(t):e==Tt.PROP.TRANSITION&&(t=wt.ConvertTransition(t)),t):(t=this.jsvGetClassPropValue(this.jsvLazyInheritedClassNames,this.jsvLazyClassAttributes,e),t?(e==Tt.PROP.ANIMATION?t=wt.ConvertAnimation(t):e==Tt.PROP.TRANSITION&&(t=wt.ConvertTransition(t)),t):void 0)}jsvDestory(){bt.RemoveRefStyle(this)}jsvUpdateProperty(e,t){let i=this.jsvSetPropertySilently(e,t);i&&this.jsvLazySyncCache.setCacheProperty(i,!0)}jsvSetPropertySilently(e,t){if(e.startsWith("--"))return void bt.UpdateValue(e,t);if("string"==typeof t&&t.startsWith("var(--"))return void bt.AppendRefStyle(t,this,e);if("animation"===e){if(this.jsvStore[e]?.originStr===t?.originStr)return null}else if(this.jsvStore[e]===t)return null;return this.jsvStore[e]=t,Tt.JsvGetStyleType(e)}jsvApplyClasses(e,t){if(e.indexOf("JsvStyle_")<0){t?(this.jsvLazyPrevInheritedClassNames=this.jsvLazyInheritedClassNames,this.jsvLazyInheritedClassNames=e.split(" ")):(this.jsvLazyPrevClassNames=this.jsvLazyClassNames,this.jsvLazyClassNames=e.split(" "));const i=Tt.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(i,!0)}else if(e){let t=e.split(" "),s={};this.jsvNamedClassArray=new Array(t.length);let n=0;for(let e of t){let t=null;if(i.ReactUtils.StyleClassMap.hasOwnProperty(e)){t=i.ReactUtils.StyleClassMap[e];let n=t.getAttach();if(null==n){let e=t.getStyles();n={altStyles:{},hasTextMajorStyle:0,textPackAttr:null};for(let t in e)n.altStyles[t]=Tt.JsvConvertPropValue(t,e[t]);t.updateAttach(n)}"text"===t.classType()&&(n.hasTextMajorStyle=2,null===n.textPackAttr&&(n.textPackAttr={textLineAlign:t.getLineAlign(),textVerticalAlign:t.getVerticalAlign()}),this.jsvCustomStyles.textLineAlign=n.textPackAttr.textLineAlign,this.jsvCustomStyles.textVerticalAlign=n.textPackAttr.textVerticalAlign),Object.assign(s,n.altStyles)}else console.error("Error: className not found");this.jsvNamedClassArray[n]=t,n++}for(let e in s)this.jsvLockedProps[e]||this.jsvUpdateProperty(e,s[e])}}jsvAppendClassAttribute(e){this.jsvLazyClassAttributes||(this.jsvLazyClassAttributes=new Set),this.jsvLazyClassAttributes.add(e);const t=Tt.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(t,!0)}jsvSetClassProperty(e){let t=Tt.JsvGetStyleType(e);t&&this.jsvLazySyncCache.setCacheProperty(t,!0)}jsvGetClassPropValue(e,t,i){if(!e)return;const s=(e,t,i,s)=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(i&&(r+="["+i+"]"),!e.hasOwnProperty(r))continue;const a=e[r];if(!a.hasOwnProperty(s))continue;let o=a[s];return"string"==typeof o&&o.startsWith("var(--")&&(o=bt.GetValue(o)),o}},n=window.JsvCode.Dom.StyleSheets;for(const r of t??[]){const t=s(n,e,r,i);if(t)return t}return s(n,e,null,i)}jsvGetClassDeclarations(e,t){if(!e)return;const i=(e,t,i)=>{let s={};for(let n=0;n<t.length;n++){let r=t[n];if(i&&(r+="["+i+"]"),!e.hasOwnProperty(r))continue;const a=e[r];Object.assign(s,a)}return s},s=window.JsvCode.Dom.StyleSheets;let n=i(s,e,null);for(const r of t??[]){const t=i(s,e,r);Object.assign(n,t)}return n}jsvUpdateChangedClasses(e,t,i){gt.D("jsvGetChangedClassTypes() classNames="+e);let s={};if(t){bt.RemoveRefStyle(this);const e=this.jsvGetClassDeclarations(t,i);for(const t of Object.keys(e)){s[Tt.JsvGetStyleType(t)]=!0}t=null}if(e){const t=this.jsvGetClassDeclarations(e,i);for(const[e,i]of Object.entries(t)){s[Tt.JsvGetStyleType(e)]=!0,"string"==typeof i&&i.startsWith("var(--")&&bt.AppendRefStyle(i,this,e)}}return s}jsvSetChangedListener(e){let t=null;e&&(t=t=>{if(t.hasOwnProperty(Tt.TYPE.CLASS_NAME)){let e=this.jsvUpdateChangedClasses(this.jsvLazyClassNames,this.jsvLazyPrevClassNames,this.jsvLazyClassAttributes);Object.assign(t,e),e=this.jsvUpdateChangedClasses(this.jsvLazyInheritedClassNames,this.jsvLazyPrevInheritedClassNames,this.jsvLazyClassAttributes),Object.assign(t,e),t[Tt.TYPE.CLASS_NAME]=void 0}e(t)}),this.jsvLazySyncCache.setOnSyncCallback(t)}static JsvContainsTextMajor(e){for(let t of Tt.TextClassMajorStyles)if(e.hasOwnProperty(t))return!0;return!1}static JsvGetStyleType(e){switch(e){case Tt.PROP.LEFT:case Tt.PROP.RIGHT:case Tt.PROP.TOP:case Tt.PROP.BOTTOM:case Tt.PROP.ZINDEX:return Tt.TYPE.LAYOUT_POS;case Tt.PROP.TRANSFORM:case Tt.PROP.TRANSFORMORIGIN:return Tt.TYPE.TRANSFORM;case Tt.PROP.WIDTH:case Tt.PROP.HEIGHT:case Tt.PROP.VISIBILITY:case Tt.PROP.DISPLAY:case Tt.PROP.CLIPPATH:case Tt.PROP.OVERFLOW:case Tt.PROP.OBJECTFIT:case Tt.PROP.PERSPECTIVE:case Tt.PROP.PERSPECTIVEORIGIN:case Tt.PROP.BACKFACEVISIBILITY:case Tt.PROP.TRANSFORMSTYLE:case Tt.PROP.JSVVIDEOROTATION:return Tt.TYPE.LAYOUT_SIZE;case Tt.PROP.BACKGROUNDCOLOR:case Tt.PROP.BACKGROUNDIMAGE:case Tt.PROP.BORDERRADIUS:return Tt.TYPE.BACKGROUND;case Tt.PROP.COLOR:case Tt.PROP.LINEHEIGHT:case Tt.PROP.WHITESPACE:case Tt.PROP.FONTFAMILY:case Tt.PROP.FONTSIZE:case Tt.PROP.FONTSTYLE:case Tt.PROP.FONTWEIGHT:case Tt.PROP.TEXTALIGN:case Tt.PROP.TEXTSHADOW:case Tt.PROP.TEXTOVERFLOW:case Tt.PROP.WEBKITTEXTSTROKE:return Tt.TYPE.FOREGROUND;case Tt.PROP.BORDERIMAGE:case Tt.PROP.BORDERIMAGEWIDTH:case Tt.PROP.BORDERIMAGEOUTSET:return Tt.TYPE.BORDER;case Tt.PROP.ANIMATION:return Tt.TYPE.ANIMATION;case Tt.PROP.TRANSITION:return Tt.TYPE.TRANSITION;case Tt.PROP.OPACITY:break;default:return console.warn("Unknown style type for: "+e),null}}static JsvConvertPropValue(e,t){if(void 0===t)return t;if(e.startsWith("--")||t?.startsWith?.("var(--"))return t;switch(e){case Tt.PROP.TOP:case Tt.PROP.BOTTOM:case Tt.PROP.LEFT:case Tt.PROP.RIGHT:case Tt.PROP.WIDTH:case Tt.PROP.HEIGHT:case Tt.PROP.JSVVIDEOROTATION:return wt.ConvertInt(t);case Tt.PROP.VISIBILITY:case Tt.PROP.DISPLAY:return t.toUpperCase();case Tt.PROP.OVERFLOW:return wt.ConvertOverflow(t,Tt.Overflow);case Tt.PROP.OBJECTFIT:return wt.ConvertObjectFit(t,Tt.ObjectFit);case Tt.PROP.TRANSFORM:case Tt.PROP.TRANSFORMORIGIN:return t;case Tt.PROP.CLIPPATH:return new vt(t);case Tt.PROP.BORDERIMAGE:return new yt(t);case Tt.PROP.BORDERIMAGEWIDTH:case Tt.PROP.BORDERIMAGEOUTSET:return wt.ConvertRect(t);case Tt.PROP.BORDERRADIUS:return wt.ConvertCorner(t);case Tt.PROP.ANIMATION:return wt.ConvertAnimation(t);case Tt.PROP.TRANSITION:return wt.ConvertTransition(t);case Tt.PROP.OPACITY:return wt.ConvertFloat(t);default:return wt.ConvertPx(t)}}}Tt.Overflow={HIDDEN:Symbol("hidden"),VISIBLE:Symbol("visible")},Tt.ObjectFit={FILL:Symbol("fill"),CONTAIN:Symbol("contain"),COVER:Symbol("cover"),NONE:Symbol("none"),SCALEDOWN:Symbol("scale-down")},Tt.TextClassMajorStyles=new Set(["textOverflow","wordWrap","textShadow","color","fontFamily","fontStyle","fontWeight","textAlign","WebkitTextStroke"]),Tt.TYPE={LAYOUT_POS:"layout-position",LAYOUT_SIZE:"layout-size",FOREGROUND:"foreground",BACKGROUND:"background",BORDER:"border",ANIMATION:"animation",TRANSFORM:"transform",TRANSITION:"transition",CLASS_NAME:"class-name"},Tt.PROP={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",WIDTH:"width",HEIGHT:"height",VISIBILITY:"visibility",DISPLAY:"display",BACKFACEVISIBILITY:"backfaceVisibility",CLIPPATH:"clipPath",OVERFLOW:"overflow",OBJECTFIT:"objectFit",TRANSFORM:"transform",TRANSFORMORIGIN:"transformOrigin",PERSPECTIVE:"perspective",PERSPECTIVEORIGIN:"perspectiveOrigin",ZINDEX:"zIndex",TRANSFORMSTYLE:"transformStyle",BACKGROUNDCOLOR:"backgroundColor",BACKGROUNDIMAGE:"backgroundImage",BORDERRADIUS:"borderRadius",COLOR:"color",LINEHEIGHT:"lineHeight",WHITESPACE:"whiteSpace",FONTFAMILY:"fontFamily",FONTSIZE:"fontSize",FONTSTYLE:"fontStyle",FONTWEIGHT:"fontWeight",TEXTALIGN:"textAlign",TEXTSHADOW:"textShadow",TEXTOVERFLOW:"textOverflow",WEBKITTEXTSTROKE:"WebkitTextStroke",BORDERIMAGE:"borderImage",BORDERIMAGEWIDTH:"borderImageWidth",BORDERIMAGEOUTSET:"borderImageOutset",ANIMATION:"animation",TRANSITION:"transition",OPACITY:"opacity",JSVVIDEOROTATION:"JsvVideoRotation"};for(let e in Tt.PROP){let t=Tt.PROP[e];Object.defineProperty(Tt.prototype,t,{set:function(e){this.setProperty(t,e)},get:function(){return this.getPropertyValue(t)}})}let St=null;class Ct{static getHandlers(e){const t=Ct.reactEventHandlers(e);return t||(e._vei?e._vei:{})}static reactEventHandlers(e){return null==St&&Ct._getReactToken(e),e["__reactEventHandlers$"+St]}static _getReactToken(e){for(let t in e)if(t.indexOf("__reactEventHandlers")>=0||t.indexOf("__reactInternalInstance")>=0){let e=t.indexOf("$");St=t.substring(e+1);break}}}class Et extends mt{constructor(e){super(mt.ELEMENT_NODE),this.parentElement=null,this.tagName=this.jsvGetTagName(),this.tagName===Et.TAG.STYLE?(this.style=null,this.jsvMainView=null,this.jsvMaskView=null):(this.style=new Tt,this.jsvMainView=new i.LayoutView,this.jsvMaskView=null),this.jsvAnimation=null,this.jsvStore={transition:null,transitionTmp:null,textContent:null,textStylePack:null,clientWidth:NaN,clientHeight:NaN,textureWidth:NaN,textureHeight:NaN,scopedAttributes:[]},this.jsvLazySyncCache=new ft("element"),this.instantSwapCallback=null,this.eventHandlers=null,this.jsvInheritClassDepth=null,this.jsvHasInheritClassChildren=!1}appendChild(e){super.appendChild(e),this.jsvInsertChild(e,null)}removeChild(e){this.jsvRemoveChild(e),super.removeChild(e)}insertBefore(e,t){super.insertBefore(e,t),this.jsvInsertChild(e,t)}get childElementCount(){return this.childNodes.length}get firstElementChild(){return this.childNodes.length>0?this.childNodes[0]:null}get lastElementChild(){const e=this.childNodes.length;return e>0?this.childNodes[e-1]:null}set className(e){this.setAttribute("class",e)}setAttribute(e,t){e&&(this[e]=t,e.startsWith("data-v-")?this._jsvAppendScopedAttribute(e,0):"class"===e?this._jsvSetClassNames(t,0):"jsv-inherit-class"===e?this._jsvSetInheritClassDepth(parseInt(t)):e.startsWith(Et.ATTRIBUTE.JSVPREFIX)?(e=e.replace(/-/g,"_"),this.jsvLazySyncCache.setCacheProperty(e,t)):window.JsView||"id"!==e||this.jsvMainView.Element&&(this.jsvMainView.Element.id=t))}removeAttribute(e){this[e]=void 0,e.startsWith(Et.ATTRIBUTE.JSVPREFIX)&&this.jsvLazySyncCache.setCacheProperty(e,void 0)}getAttribute(e){return this[e]}hasAttribute(e){return console.log("Element.hasAttribute() name="+e),!!this[e]}get clientWidth(){return isNaN(this.jsvStore.clientWidth)?this.style.width:this.jsvStore.clientWidth}get clientHeight(){return isNaN(this.jsvStore.clientHeight)?this.style.height:this.jsvStore.clientHeight}focus(){console.log("Element.focus()"),document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new _t(_t.Type.BLUR);t.target=e,document.dispatchEvent(t)}let t=new _t(_t.Type.FOCUS);document.dispatchEvent(t)}jsvInsertChild(e,t){if(e.parentElement=this,e.nodeType===mt.ELEMENT_NODE&&e.tagName!==Et.TAG.STYLE){if(!1===document.jsvIsReady)return void console.warn("Element.appendChild() Failed to append child to Forge. jsvIsReady="+document.jsvIsReady);e.jsvOnLoadForgeView(),e.style.jsvSetChangedListener(e.jsvOnStyleChanged.bind(e)),t=this.jsvBackwardFindForgeView(t);let i=e.jsvMaskView.GetLayoutParams();this.jsvMainView.InsertView(e.jsvMaskView,t?t.jsvMaskView:null,i),(e.jsvInheritClassDepth>0||e.jsvHasInheritClassChildren)&&(this.jsvHasInheritClassChildren=!0)}else e.nodeType===mt.TEXT_NODE&&(this.textContent=e.textContent)}jsvRemoveChild(e){e.parentElement=null,e.jsvLazySyncCache=null,e.style?.jsvSetChangedListener(null),e.style?.jsvDestory(),e.jsvAnimation?.Cancel(),e.jsvAnimation=null,e instanceof Et&&this.jsvMainView.RemoveView(e.jsvMaskView)}jsvOnLoadForgeView(){if(this.style.clipPath||this.style.overflow||this.style.objectFit){if(this.jsvMaskView)throw Error("Jsview: jsvMaskView is conflicting.");this.jsvMaskView=new i.ClipView}else this.jsvMaskView||(this.jsvMaskView=this.jsvMainView);this.jsvMaskView!==this.jsvMainView&&this.jsvMaskView.AddView(this.jsvMainView);let e=this.jsvCallbackOnUnloadForgeView();e&&this.jsvMainView.RegisterDetachCallback(e),this.jsvLazySyncCache.setOnSyncCallback((e=>{this.jsvSetElementProp(e)}))}jsvSetElementProp(e){this.jsvMainView&&this.jsvMainView.SetElementProp(e,ct.RootActivity)}jsvCallbackOnUnloadForgeView(){return null}jsvOnStyleChanged(e){let t=!!e[Tt.TYPE.LAYOUT_SIZE],i=!1;e[Tt.TYPE.LAYOUT_POS]&&(t||(this.jsvFlushViewLayout(),i=!0)),e[Tt.TYPE.LAYOUT_SIZE]&&(this.jsvFlushViewLayout(),i=!0),e[Tt.TYPE.TRANSFORM]&&!i&&(this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.jsvFlushViewTransition(),i=!0),e[Tt.TYPE.BACKGROUND]&&this.jsvFlushViewBackground(),e[Tt.TYPE.ANIMATION]&&this.jsvFlushViewAnimation(),e[Tt.TYPE.TRANSITION]&&!i&&this.jsvFlushViewTransition(),this.jsvFlushEventHandlers()}jsvFlushEventHandlers(){null===this.eventHandlers&&(this.eventHandlers=Ct.getHandlers(this),this.eventHandlers&&this.eventHandlers.onClick&&this.jsvMainView&&this.jsvMainView.EnableDivTouch(this,null))}jsvApplyObjectFit(e){return null}jsvFlushViewLayout(){if((this.style.clipPath||this.style.overflow||this.style.objectFit)&&!this.jsvMaskView)return void console.error("Element.jsvFlushViewLayout() InvalidOpt: clippath=",this.style.clipPath);const e={x:isNaN(this.style.left)?0:this.style.left,y:isNaN(this.style.top)?0:this.style.top,width:isNaN(this.style.width)?0:this.style.width,height:isNaN(this.style.height)?0:this.style.height};let t=null;if(this.style.objectFit&&(t=this.jsvApplyObjectFit(e),this.style.objectFit===Tt.ObjectFit.FILL&&(t=null)),this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.style.perspective&&this.style.perspective>0){let e=this.style.perspectiveOrigin?this.style.perspectiveOrigin:null;this.jsvMainView.SetPerspective(this.style.perspective,e)}if(this.style.backfaceVisibility&&this.jsvMainView.SetBackfaceVisibility("visible"==this.style.backfaceVisibility),this.style.transformStyle&&this.jsvMainView.SetTransformStyle(this.style.transformStyle),this.jsvMaskView.ResetLayoutParams({x:e.x,y:e.y,width:this.clientWidth,height:this.clientHeight}),this.jsvMaskView!==this.jsvMainView){const e={x:0,y:0,width:this.jsvMaskView.LayoutParams.Width,height:this.jsvMaskView.LayoutParams.Height};this.jsvMainView.ResetLayoutParams(e)}let s=this.style.visibility;"NONE"==this.style.display&&(s="HIDDEN"),this.jsvMaskView.SetVisibility(s);let n=null;null!==t&&window.JsView?n={x:t.x,y:t.y,width:t.width,height:t.height}:this.style.clipPath?n={x:this.style.clipPath.left,y:this.style.clipPath.top,width:this.jsvMaskView.LayoutParams.Width-this.style.clipPath.left-this.style.clipPath.right,height:this.jsvMaskView.LayoutParams.Height-this.style.clipPath.top-this.style.clipPath.bottom}:this.style.overflow===Tt.Overflow.HIDDEN&&null===this.jsvStore.textContent&&(n={x:0,y:0,width:this.style.width,height:this.style.height}),n?this.jsvMaskView.SetClipRect(n.x,n.y,n.width,n.height,!0):this.jsvMaskView instanceof i.ClipView&&this.jsvMaskView.SetClipRect(0,0,0,0,!1),void 0!==this.style.zIndex&&null!==this.style.zIndex&&this.jsvMaskView.SetZIndex(this.style.zIndex),this.jsvFlushViewTransition()}jsvFlushViewBackground(){this.style.backgroundColor&&(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,ct.SetBackgroundColor(this.jsvMainView,this.style.backgroundColor,this.style.borderRadius)),this.style.backgroundImage&&(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,ct.SetBackgroundImage(this.jsvMainView,this.style.backgroundImage,this.style.borderRadius))}jsvFlushViewAnimation(){if(this.jsvAnimation&&this.jsvAnimation.Cancel(),!this.style.animation)return;let e=document.jsvGetKeyFrames(this.style.animation.name,this.jsvStore.scopedAttributes);this.jsvAnimation=new i.CssKeyframeAnimation(e,this.style.animation.duration,this.style.animation.timingFunction,this.style.width?this.style.width:this.clientWidth,this.style.height),this.jsvAnimation.EnableDelay(this.style.animation.delay).SetRepeat(this.style.animation.iterationCount),"forwards"===this.style.animationFillMode&&this.jsvAnimation.Enable(i.AnimationEnable.KeepTransform);var t=this;let s=new i.AnimationListener;s.OnEnd((e=>{if(t.jsvAnimation=null,e){if(t.eventHandlers&&t.eventHandlers.onAnimationEnd){let e;e=new pt("animationend"),e.target=t,t.eventHandlers.onAnimationEnd(e)}null==t.instantSwapCallback&&(t.instantSwapCallback=i.sRenderBridge.InstantPerformSwap.bind(i.sRenderBridge)),Promise.resolve().then(t.instantSwapCallback)}})),this.jsvAnimation.Enable(i.AnimationEnable.ReleaseAfterEndCallback),this.jsvAnimation.SetAnimationListener(s),this.jsvMaskView.StartAnimation(this.jsvAnimation)}jsvFlushViewTransition(){if(this.style.animation)return;if(null!=this.jsvStore.transitionTmp&&this.jsvStore.transitionTmp.syncTimes!=dt.cnt&&-1!=this.jsvStore.transitionTmp.syncTimes){let e=this.jsvStore.transition;this.jsvStore.transition=this.jsvStore.transitionTmp,this.jsvStore.transitionTmp=e,null!=this.jsvStore.transitionTmp&&(this.jsvStore.transitionTmp.syncTimes=-1)}if(this.style.transition){if(this.jsvStore.transition){if(!this._JsvBuildTransition())return}}else this.jsvAnimation&&(this.jsvAnimation.Cancel(),this.jsvAnimation=null);let e=this.jsvStore.transitionTmp;e||(e={left:0,top:0,width:0,height:0,opacity:1,transform:null,syncTimes:-1}),e.left=this.style.left,e.top=this.style.top,e.width=this.style.width,e.height=this.style.height,e.opacity=this.style.opacity,e.transform=this.style.transform,e.syncTimes=dt.cnt,this.jsvStore.transitionTmp=e}_JsvBuildTransition(){let e=[];for(let t in this.style.transition){let i=this.jsvStore.transition[t],s=this.style[t];if(i===s)continue;let n=this.style.transition[t],r={name:t,dur:n.duration,tf:null,dly:n.delay,from:i||"",to:s};"transform"===t&&(r.origin=this.style.transformOrigin?this.style.transformOrigin:"center center"),n.timingFunction&&(r.tf=n.timingFunction.Package()),e.push(r)}if(e.length<=0)return!1;var t=this;let s=new i.AnimationListener;return s.OnEnd((e=>{if(t.jsvAnimation=null,e){if(t.eventHandlers&&t.eventHandlers.onTransitionEnd){let e=new pt("transitionend");e.target=t,t.eventHandlers.onTransitionEnd(e)}null==t.instantSwapCallback&&(t.instantSwapCallback=i.sRenderBridge.InstantPerformSwap.bind(i.sRenderBridge)),Promise.resolve().then(t.instantSwapCallback)}})),this.jsvAnimation=new i.CssTransitionAnimation(e),this.jsvAnimation.SetAnimationListener(s),this.jsvMaskView.StartAnimation(this.jsvAnimation),!0}jsvBackwardFindForgeView(e){let t=e;for(;t&&!(t instanceof Et);)t=t.nextSibling;return t}static applyObjectFitCommon(e,t,i){if(i&&!isNaN(e.jsvStore.textureWidth)&&!isNaN(e.jsvStore.textureHeight)){const s=e.style.objectFit,n=i.ApplyObjectFit(t.width,t.height,e.jsvStore.textureWidth,e.jsvStore.textureHeight,s,Tt.ObjectFit);return 0!==t.width&&0!==t.height||0===t.width&&0===t.height||(e.jsvStore.clientWidth=Math.max(t.width,n.width),e.jsvStore.clientHeight=Math.max(t.height,n.height)),n}return null}_jsvAppendScopedAttribute(e,t){if(0!=t&&this.jsvInheritClassDepth!=t||(this.jsvStore.scopedAttributes.push(e),this.style.jsvAppendClassAttribute(e)),this.jsvHasInheritClassChildren){t=this.jsvInheritClassDepth==t?1:t+1;for(const i of this.childNodes)i.jsvInheritClassDepth<=0&&0==i.jsvHasInheritClassChildren||i instanceof Et&&(i.jsvStore.scopedAttributes.includes(e)||i._jsvAppendScopedAttribute(e,t))}}_jsvSetClassNames(e,t){if(0!=t&&this.jsvInheritClassDepth!=t||this.style.jsvApplyClasses(e,this.jsvInheritClassDepth==t),this.jsvHasInheritClassChildren){t=this.jsvInheritClassDepth==t?1:t+1;for(const i of this.childNodes)i.jsvInheritClassDepth<=0&&0==i.jsvHasInheritClassChildren||i instanceof Et&&i._jsvSetClassNames(e,t)}}_jsvSetInheritClassDepth(e){if(e<=0)return;this.jsvInheritClassDepth=e;let t=this;for(let i=0;i<e&&(t=t.parentNode,t);i++);if(t){for(const i of t.jsvStore.scopedAttributes)this._jsvAppendScopedAttribute(i,e);this._jsvSetClassNames(t.class,e)}}}Et.TAG={DIV:"DIV",IMAGE:"IMAGE",LINK:"LINK",STYLE:"STYLE",AUDIO:"AUDIO",VIDEO:"VIDEO",ANCHOR:"A",SVG:"SVG",FDIV:"FDIV",AUDIOTRACK:"AUDIOTRACK"},Et.ATTRIBUTE={SRC:"src",JSVPREFIX:"jsv"};class xt extends Et{constructor(){super(),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return Et.TAG.ANCHOR}}class It extends Et{constructor(e){super(),this.jsvMediaView=null,this.jsvMedia=null,this.onVisibilityChange=this.onVisibilityChange.bind(this),this.stopByOnHide=!1,this.playBackground=!1,e&&(this.srcValue=e)}addEventListener(e,t,i){e=e.replace(/-/g,""),super.addEventListener(e,t,i),this.jsvAddMediaListener(e)}jsvOnLoaded(){}set src(e){if(e&&"about:null"!==e&&"about:blank"!==e){e=new ht(e).href}this.jsvMedia||this.jsvInit(),e!==this.jsvMedia.src&&(this.jsvMedia.src=e,this.srcValue=e)}jsvOnLoadForgeView(){console.log("MediaElement jsvOnLoadForgeView"),super.jsvOnLoadForgeView(),this.jsvMedia||this.jsvInit(),this.registerOnVisibilityChange()}jsvInit(){let e=this.jsvEventListener;if(e)for(var t in e.keys)this.jsvAddMediaListener(t);Promise.resolve().then((()=>{this.jsvMedia&&this.jsvMedia.confirmInitSetup?.()}))}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){console.log("MediaElement jsvOnUnloadForgeView"),this.unregisterOnVisibilityChange(),this.jsvMediaView&&(this.jsvMediaView=null),this.jsvRelease()}jsvRelease(){this.jsvMedia&&(this.jsvMedia.pause(),this.jsvMedia.unload&&this.jsvMedia.unload(),this.jsvMedia.releaseResource&&(this.jsvMedia.releaseResource(),this.jsvMedia.onPlatformDestroy())),this.jsvEventListener=void 0}jsvAddMediaListener(e){}onJsViewHide(){this.jsvMedia&&(this.jsvMedia.paused||(this.stopByOnHide=!0),this.jsvMedia.unload())}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}onVisibilityChange(e){this.playBackground||("show"===e.status?this.onJsViewShow():"hide"===e.status&&this.onJsViewHide())}registerOnVisibilityChange(){window.JsView&&window.JsView.onVisibilityChange(this.onVisibilityChange)}unregisterOnVisibilityChange(){window.JsView&&window.JsView.removeEventCallback(this.onVisibilityChange)}setAttribute(e,t){"jsv_play_background"!==e?super.setAttribute(e,t):this.playBackground="true"===t}}It.HOOKS={Audio:Audio,Video:window._ExtVideo,OffscreenVideo:window._ExtOVP},It.PROP={SetOnly:["autoplay","loop","timeupdateless","predownload"],GetOnly:["duration","paused"],SetAndGet:["currentTime","muted","playbackRate","preload","volume"],Function:["load","pause","play","unload","confirmInitSetup"]};for(let e in It.PROP){let t=It.PROP[e];for(let i of t){let t={};"SetOnly"!==e&&"SetAndGet"!==e||(t.set=function(e){this.jsvMedia||this.jsvInit(),this.jsvMedia[i]=e}),"GetOnly"!==e&&"SetAndGet"!==e||(t.get=function(){return this.jsvMedia||this.jsvInit(),this.jsvMedia[i]}),"Function"===e&&(t=function(...e){return this.jsvMedia||this.jsvInit(),this.jsvMedia[i]?this.jsvMedia[i](...e):null}),t instanceof Function?It.prototype[i]=t:Object.defineProperty(It.prototype,i,t)}}class At extends It{constructor(e){super(e),this.jsvOverrideMedia=!1,console.log("AudioElement.constructor()",this)}jsvGetTagName(){return Et.TAG.AUDIO}jsvInit(){this.jsvOverrideMedia||(this.jsvMedia=new It.HOOKS.Audio),super.jsvInit(),this.jsvOnLoaded()}jsvOnLoaded(){this.jsvMediaView=new i.LayoutView,this.jsvMainView.AddView(this.jsvMediaView)}jsvAddMediaListener(e){this.jsvMedia||this.jsvInit(),this.jsvMedia.addEventListener(e,(()=>{let t=new ut(e);t.target=this,this.dispatchEvent(t)}))}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}setAttribute(e,t){if("data-jsv-audio-predownload"==e)return this.jsvMedia||this.jsvInit(),void(this.jsvMedia.predownload=!0);super.setAttribute(e,t)}}class Rt{constructor(){this._PersistMap=new Map,this._PersistMax=300,this._PersistIdx=0,this._PersistTrackList=new Array(this._PersistMax),this._TempMap=new Map,this._TempMax=50,this._TempIdx=0,this._TempTrackList=new Array(this._TempMax)}getPersistPack(e){return this._PersistMap.get(e)}putPersistPack(e,t){Rt._putPack(this._PersistMap,this._PersistTrackList,this._PersistIdx,e,t),this._PersistIdx=(this._PersistIdx+1)%this._PersistMax}getTempPack(e){return this._TempMap.get(e)}putTempPack(e,t){Rt._putPack(this._TempMap,this._TempTrackList,this._TempIdx,e,t),this._TempIdx=(this._TempIdx+1)%this._TempMax}static _putPack(e,t,i,s,n){let r=t[i];r&&(e.delete(r),t[i]=s),e.set(s,n)}}let Pt=new Rt;class Ot extends Et{constructor(){super(),this.jsvContentView=null,this.jsvRefedImgTex=null,this.jsvTextLatexEnable=!1,this.jsvEmoji=!1,this.jsvTextAlignMinWidth=NaN,this.jsvEmptyRect=null}jsvGetTagName(){return Et.TAG.DIV}get textContent(){return this.jsvStore.textContent}set textContent(e){(e||this.jsvStore.textContent)&&(this.jsvStore.textContent=e,this.jsvStore.clientWidth=NaN,this.jsvContentView||(this.jsvContentView=new i.LayoutView,this.jsvMainView.AddView(this.jsvContentView)),this.parentElement&&this.jsvFlushViewForeground())}get clientWidth(){const e=this.style.width;if(e||0===e)return e;if(this.jsvStore.textContent){if(!isNaN(this.jsvStore.clientWidth))return this.jsvStore.clientWidth;const e={str:this.jsvStore.textContent,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};return this.jsvStore.clientWidth=ct.GetTextWidth(e),this.jsvStore.clientWidth}return super.clientWidth}jsvOnLoadForgeView(){this.style.borderImage&&(this.jsvMaskView=new i.NinePatchView),super.jsvOnLoadForgeView()}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){ct.UnrefImgTexSize(this.jsvRefedImgTex),this.jsvRefedImgTex=null}jsvOnStyleChanged(e){super.jsvOnStyleChanged(e),this.jsvStore.textStylePack=null;let t=!!e[Tt.TYPE.FOREGROUND];e[Tt.TYPE.LAYOUT_SIZE]&&(t||this.jsvFlushViewForeground()),e[Tt.TYPE.FOREGROUND]&&this.jsvFlushViewForeground(),e[Tt.TYPE.BORDER]&&this.jsvFlushViewBorder()}jsvFlushViewForeground(){if(this.jsvContentView&&(this.jsvContentView.ClearViews(),this.jsvStore.textContent)){let e=void 0===this.style.height||0==this.style.height,t=e?(e,t)=>{this.jsvStore.clientHeight=e.height}:null,i=this.jsvBuildTextView(t);e&&i.EnableAutoHeight(),this.jsvContentView.AddView(i)}}jsvBuildTextView(e){let t=this.jsvStore.textStylePack;if(null===t&&(t=this._jsvGetClassNameCache()),null===t){this.style.jsvCustomStyles.textLineAlign||(this.style.jsvCustomStyles.textLineAlign=this.style.lineHeight?"middle":"top"),this.style.jsvCustomStyles.textVerticalAlign||(this.style.jsvCustomStyles.textVerticalAlign="top");let e=Ot._jsvStyleToPackData(this.style),s=JSON.stringify(e),n=Pt.getTempPack(s);n||(n=i.sTextStyleCache.StyleToPack(e),Pt.putTempPack(s,n)),t=n}this.jsvStore.textStylePack=t;let s=this.style.lineHeight?parseInt(this.style.lineHeight):this.style.fontSize?1.3*this.style.fontSize:14,n=this.style.width,r=!1;if(void 0===n&&(n=this.clientWidth,r=!0),this.jsvTextAlignMinWidth&&n<this.jsvTextAlignMinWidth&&(n=this.jsvTextAlignMinWidth),n>3e3){if(!r)return console.error(`text too long. str=${this.jsvStore.textContent}`),null;console.log(`text too long, start to break down. width(${n})`);let a=new i.LayoutView,o=Math.floor(2048/this.style.fontSize),l=this.jsvStore.textContent.length,h=0,c=0,u={str:null,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};for(;l>0;){let n=o<l?o:l,r=this.jsvStore.textContent.substr(h,n);h+=n,u.str=r;let d=ct.GetTextWidth(u),f=i.sTextUtils.BuildTextView(ct.TextureManager,r,t,0===h?e:null,{width:d,height:this.style.height},this.style.fontSize,s,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect);a.AddView(f,{x:c,y:0,width:d,height:this.style.height}),c+=d,l-=n}return a}return i.sTextUtils.BuildTextView(ct.TextureManager,this.jsvStore.textContent,t,e,{width:n,height:this.style.height},this.style.fontSize,s,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect)}_jsvGetClassNameCache(){if(null===this.style.jsvNamedClassArray)return null;if(Tt.JsvContainsTextMajor(this.style.jsvLockedProps))return null;let e="";for(let t of this.style.jsvNamedClassArray){let i=t.getAttach();0===i.hasTextMajorStyle&&(Tt.JsvContainsTextMajor(t.getStyles())?i.hasTextMajorStyle=2:i.hasTextMajorStyle=1),2===i.hasTextMajorStyle&&(e+=t.getName())}if(e.length>0){let t=Pt.getPersistPack(e);if(!t){let s=Ot._jsvStyleToPackData(this.style);t=i.sTextStyleCache.StyleToPack(s),Pt.putPersistPack(e,t)}return t}return null}static _jsvStyleToPackData(e){let t={textColor:e.color?e.color:"#000000",font:e.fontFamily,italic:"italic"===e.fontStyle,bold:"bold"===e.fontWeight,hAlign:e.textAlign?e.textAlign:"left",vAlign:e.jsvCustomStyles.textLineAlign?e.jsvCustomStyles.textLineAlign:"middle",vAreaAlign:e.jsvCustomStyles.textVerticalAlign?e.jsvCustomStyles.textVerticalAlign:"top",textOverflow:e.textOverflow?e.textOverflow:"clip",wordWrap:"break-word"===e.wordWrap?"break_word":"normal"};"nowrap"===e.whiteSpace&&(t.wordWrap="none");let i=e.textShadow?e.textShadow.split(" "):void 0;i&&(t.shadow={shadowOffsetX:parseInt(i[0]),shadowOffsetY:parseInt(i[1]),shadowBlur:parseFloat(i[2]),shadowColor:i[3]});let s=e.WebkitTextStroke?e.WebkitTextStroke.split(" "):void 0;return s&&(t.stroke={strokeWidth:parseInt(s[0]),strokeColor:s[1]}),t}jsvFlushViewBorder(){if(this.jsvMaskView)if(this.style.clipPath)console.error("BorderImage is conflicting with ClipPath.");else if(this.style.borderImage){if(!(this.jsvMaskView instanceof i.NinePatchView))return void console.error("Error: style.borderImage NOT support dynamic adding");let e=wt.ConvertPx(this.getAttribute("jsv-borderimage-width")),t=wt.ConvertPx(this.getAttribute("jsv-borderimage-height"));if(ct.UnrefImgTexSize(this.jsvRefedImgTex),!this.jsvRefedImgTex||this.jsvRefedImgTex.Source!==this.style.borderImage.source.href){let s=e&&t?{width:e,height:t}:null;if(!this.style.borderImage.source.href)return void this.jsvMaskView.ResetTexture(null);this.jsvRefedImgTex=ct.TextureManager.GetImage2(this.style.borderImage.source.href,!1,s,i.ColorSpace.RGBA_8888)}e&&t&&(console.log("Custom cache image size with: "+e+"/"+t),ct.SetImgTexSize(this.jsvRefedImgTex,{width:e,height:t}));const s=new i.ExternalTextureSetting(this.jsvRefedImgTex);this.jsvMaskView.ResetTexture(s),this.jsvMaskView.WaitTextureToResize(!0),ct.RefImgTexSize(this.jsvRefedImgTex,function(e){if(!this.jsvMaskView)return void console.log("Found border view gone");let t=this.style.borderImageWidth,i=this.style.borderImage.slice,s=Math.floor(e.width*t.top/i.top),n=Math.floor(e.height*t.left/i.left);this.jsvMaskView.SetImageDspSize(s,n);let r=this.style.borderImageOutset?this.style.borderImageOutset:wt.ConvertRect();this.jsvMaskView.SetPadding({start:r.left,width:Math.max(0,s-r.left-r.right)},{start:r.top,width:Math.max(0,n-r.top-r.bottom)}),this.jsvMaskView.SetRepeat([{start:t.left,width:Math.max(0,s-2*t.left)}],[{start:t.top,width:Math.max(0,n-2*t.top)}]),this.jsvMaskView.WaitTextureToResize(!1)}.bind(this))}}setAttribute(e,t){this.jsvTakeTextAttribute(e,t)||super.setAttribute(e,t)}jsvTakeTextAttribute(e,t){return"jsv_text_vertical_align"===e?(this.style.jsvCustomStyles.textVerticalAlign=t,!0):"jsv_text_latex_enable"===e?(this.jsvTextLatexEnable="true"===t,!0):"jsv_text_align_minwidth"===e?(this.jsvTextAlignMinWidth=parseInt(t),!0):"jsv_text_emoji"===e?(this.jsvEmoji="true"===t,!0):("jsv_text_empty_rect"===e&&(this.jsvEmptyRect=JSON.parse(t)),!1)}}class Lt{constructor(e,t){this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new Dt(!1,t))}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t){return this.RouterDelegate.ref.focusBeforeMount(e,t)}printFocusList(){for(let e in this.RouterDelegate.ref._ChildMap)console.log(`branchName[${e}] ${e===this.RouterDelegate.ref._FocusNodeName?"focused":""}`,this.RouterDelegate.ref._ChildMap[e])}printGlobalLastFocus(){console.log("FocusNode:"),console.log(kt.sLastFocus)}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof kt&&t.RouterDelegate.ref===this.RouterDelegate.ref;)e.push({name:t.BranchName}),t=t.GetParentPage()}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}}class Dt{constructor(e,t){this._IsTemp=!!e,this._ChildMap={},this._FocusNameBeforeMount=null,this._FocusNodeName=null,this.NameSpace=t}getCurrentFocusNode(){return this._ChildMap[this._FocusNodeName]}getNodeByName(e,t){let i=e.split(".");return this._FindRouterSearchBase(i,t)._GetNodeFromPathArray(i,e)}_FindRouterSearchBase(e,t){if(0==e[0].length){let t,i;for(let e in this._ChildMap){t=this._ChildMap[e];break}do{i=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),i.RouterDelegate.ref}return t&&t.AsHub&&t.GetParentPage()?t.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(e,t){let i=0,s=this;for(;i<e.length-1;){let n=!1;for(let t in s._ChildMap){let r=s._ChildMap[t].RouterDelegate.ref;if(r!=s&&r.NameSpace==e[i]){s=r,i++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${t}`)}let n=e[i];return s._ChildMap.hasOwnProperty(n)?s._ChildMap[n]:void console.error(`Error: no found fname=${t}`)}add(e,t){e.indexOf(".")>=0?console.error("ERROR: FDiv name can not contains '.'"):this._ChildMap.hasOwnProperty(e)&&this._ChildMap[e]!==t?console.error(`ERROR: FDiv router branch name duplicated:[${e}]`):(this._ChildMap[e]=t,this._FocusNameBeforeMount==e&&(this._FocusNameBeforeMount=null,t.Focus()))}remove(e,t){let i=this._ChildMap[e];i&&i==t&&delete this._ChildMap[e]}rename(e,t){if(!this._ChildMap.hasOwnProperty(e))return void console.error(`ERROR: alter name failed ${e}->${t}`);let i=this._ChildMap[e];delete this._ChildMap[e],this.add(t,i),this._FocusNodeName==e&&(this._FocusNodeName=t)}focusBeforeMount(e,t){if(e.indexOf(".")>=0)return console.error("ERROR: not support name with namespace"),!1;let i=this._ChildMap[e];return this._FocusNodeName=e,i?(i.Focus(!t),!0):(this._FocusNameBeforeMount=e,!1)}focus(e,t){let i=this.focusBeforeMount(e,t);return i||console.log("No found branch:"+e),i}forEach(e){for(let t in this._ChildMap)e(this._ChildMap[t],t,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class kt extends i.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this.BranchName=e,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}updateMountState(){this._Mounted=!0;let e=this.SubPages;for(let t in e)e[t].updateMountState()}getHub(){return this.InterfaceHub||(this.InterfaceHub=new Lt(!0),this.InterfaceHub.RouterDelegate=this.RouterDelegate),this.InterfaceHub}setHub(e){this.RouterDelegate.ref?console.error("Error: hub is already setted."):(this.RouterDelegate.ref=e.RouterDelegate.ref,this.AsHub=!0)}_UseParentRouter(e){this.RouterDelegate=e,this.InterfaceHub&&(this.InterfaceHub.RouterDelegate=e)}routerAdd(e,t){t.RouterDelegate.ref||t._UseParentRouter(this.RouterDelegate),this.RouterDelegate.ref||(this.RouterDelegate.ref=new Dt(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}printFocusList(){this.RouterDelegate.ref?this.RouterDelegate.ref.printFocusList():console.error("Error: no router")}routerUnbind(){let e;this.AsHub?this.GetParentPage()&&(e=this.GetParentPage().RouterDelegate.ref):e=this.RouterDelegate.ref,e&&e.remove(this.BranchName,this)}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}setOnKeyDown(e){this._OnKeyDown=e}setOnKeyUp(e){this._OnKeyUp=e}setOnFocus(e){this._OnFocus=e}setOnBlur(e){this._OnBlur=e}setDispatchKeyUp(e){this._DispatchKeyUp=e}setDispatchKeyDown(e){this._DispatchKeyDown=e}setOnCustomerEvent(e){this._OnCustomerEvent=e}setDispatchKeyProxy(e,t){this._DKeyDownProxy=e,this._DKeyUpProxy=t}requestFocus(e){let t=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(t=this.GetParentPage().RouterDelegate.ref),t?t.focus(this.BranchName,e):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomerEvent(e){return!!this._OnCustomerEvent&&this._OnCustomerEvent(e)}bubbleCustomerEvent(e){this.BubbleCustomerEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return kt.sLastFocus=this,this._DKeyDownProxy?this._DKeyDownProxy(e,this._OriginDispatchKeyDown):this._OriginDispatchKeyDown(e)}_OriginDispatchKeyDown(e){let t=!1;return this._DispatchKeyDown&&(t=this._DispatchKeyDown(e)),!!t||super.DispatchKeyDown(e)}dispatchKeyUp(e){return this.DispatchKeyUp(e)}DispatchKeyUp(e){return this.__DKeyUpProxy?this.__DKeyUpProxy(e,this._OriginDispatchKeyUp):this._OriginDispatchKeyUp(e)}_OriginDispatchKeyUp(e){let t=!1;return this._DispatchKeyUp&&(t=this._DispatchKeyUp(e)),!!t||super.DispatchKeyUp(e)}attachToActivity(e,t){this.AttachToActivity(e,t)}AttachToActivity(e,t){super.SetParent(e,t)}setParent(e){this.SetParent(e)}SetParent(e){if(null!=e&&(super.SetParent(e,null),this._ParentPage._Mounted&&(this.updateMountState(),Mt()),e instanceof kt)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let t=this.RouterDelegate.ref;this.RouterDelegate.ref=null,t.forEach(((t,i)=>{e.routerAdd(i,t)}))}e.routerAdd(this.BranchName,this)}}focus(e){this.Focus(e)}Focus(e){if(!this._Mounted)return kt.sFocusMemos.push({obj:this,bcf:e}),void console.log("page base tree not build, cache focus");super.Focus(e)}OnFocus(){this._OnFocus&&this._OnFocus()}OnBlur(){this._OnBlur&&this._OnBlur()}onUnMount(){let e=this.GetParentPage();e&&e.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind()}getName(){let e=this,t=[this.RouterDelegate.ref.NameSpace];this.AsHub||t.push(this.BranchName);let i=this.RouterDelegate.ref;do{if(e=e.GetParentPage(),"__AppRoot__"==t[0])break;e&&e.RouterDelegate.ref!=i&&(i=e.RouterDelegate.ref,t.unshift(i.NameSpace))}while(e);return"__AppRoot__"==t[0]?t[0]="":console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}printFocusNodeList(){this.getHub().printFocusList()}printGlobalLastFocus(){this.getHub().printGlobalLastFocus()}}kt.sFocusMemos=[],kt.sLastFocus=null,kt.sRootPageNode=null;let Mt=()=>{let e=kt.sFocusMemos.length;if(e>0){let t=kt.sFocusMemos;kt.sFocusMemos=[];for(let i=0;i<e;i++)t[i].obj.Focus(t[i].bcf)}},Ft=1;class Vt extends Et{constructor(){super(),this.FocusNodeRef=new kt(""+Ft++),this.HubRef=void 0}jsvGetTagName(){return Et.TAG.FDIV}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new Lt(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}jsvGetHub(){return this.HubRef}}class jt extends Et{constructor(e){super(e),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){console.log("LinkElement.setAttribute() name="+e+", value=",t),this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var i=new ht(this.href);console.log("Ignore to load link from url="+i.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,t){if(console.log("jsvOnLoadResult isSuccess:"+e+", errCode:"+t),e){if(this.onload){let e=new ut("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+t,target:this})}}class Nt extends Et{constructor(e){super(e),this.src=null,this.onerror=null,this.onload=null,this.charset=null,this.timeout=120}setAttribute(e,t){console.log("ScriptElement.setAttribute() name="+e+", value=",t),this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new ht(this.src);console.log("load script with url="+e.href);var t=this;window.JsView.runJsWithUrl(e.href,!1,((e,i)=>{t.jsvOnLoadResult(e,i)}))}}jsvOnLoadResult(e,t){if(console.log("onLoadResult "+e+" "+t),e){if(this.onload){let e=new ut("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+t,target:this})}}class Gt extends Et{constructor(){super(),console.log("Document header construct")}appendChild(e){"HTMLScriptElement"==e.constructor.name||"HTMLStyleElement"==e.constructor.name||"HTMLLinkElement"==e.constructor.name?window.originDocument.headAppendChild(e):super.appendChild(e),(e instanceof jt||e instanceof Nt)&&e.jsvLoadResource()}removeChild(e){"HTMLScriptElement"==e.constructor.name||"HTMLStyleElement"==e.constructor.name||"HTMLLinkElement"==e.constructor.name?window.originDocument.headRemoveChild(e):super.removeChild(e)}}class Bt extends ut{constructor(e){super("load")}}class Ut extends Et{constructor(e){super(e),this.jsvImageView=new i.LayoutView(null,"img"),this.jsvMainView.AddView(this.jsvImageView),this._ImageInLoading=!1,this.jsvColorSpace=i.ColorSpace.RGBA_8888,this.jsvScaleDownTex=null,this._HasUserOnLoad=!1,this._OnLoadSeq=1}jsvGetTagName(){return Et.TAG.IMAGE}setAttribute(e,t){this.jsvTakeTextureAttribute(e,t)?console.assert(!this._ImageInLoading,`set ${e} after src`):(super.setAttribute(e,t),e===Et.ATTRIBUTE.SRC&&(this._ImageInLoading=!0,this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,this.jsvDrawImage()))}jsvSetElementProp(e){this.jsvImageView.SetElementProp(e,ct.RootActivity)}jsvCallbackOnUnloadForgeView(){return()=>{if(this._HasUserOnLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&e.DisableBackgroundLoad(this)}}}jsvFlushEventHandlers(){if(super.jsvFlushEventHandlers(),this.eventHandlers.onLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&(this._HasUserOnLoad=!0,e.EnableBackgroundLoad(this))}else if(this._HasUserOnLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&e.DisableBackgroundLoad(this),this._HasUserOnLoad=!1}}jsvTakeTextureAttribute(e,t){return"jsv_img_color_space"==e||"jsvImgColorSpace"==e||"jsv-img-color-space"==e?(this.jsvColorSpace=t,!0):("jsv_img_scaledown_tex"==e||"jsvImgScaledownTex"==e||"jsv-img-scaledown-tex"==e)&&(""!==t&&void 0!==t||(t="true"),this.jsvScaleDownTex=t,!0)}jsvFlushViewLayout(){this._ImageInLoading?(this.jsvImageView.WaitTextureToResize(!0),this.jsvImageView.ResetLayoutParams({x:0,y:0,width:this.style.width,height:this.style.height})):this.jsvImageView.WaitTextureToResize(!1),super.jsvFlushViewLayout()}jsvFlushViewBackground(){this.jsvDrawImage();this.getAttribute(Et.ATTRIBUTE.SRC)}jsvOnLoaded(e){if(console.log("ImageElement.jsvOnLoaded() imageSize="+JSON.stringify(e)),this._ImageInLoading=!1,this.jsvStore.textureWidth=e.width,this.jsvStore.textureHeight=e.height,this.style.jsvLazySyncCache.setCacheProperty(Tt.TYPE.LAYOUT_SIZE,!0),this._HasUserOnLoad){let e=new Bt;e.target=this,document.dispatchEvent(e)}}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",Tt.ObjectFit.FILL),super.jsvOnLoadForgeView()}jsvApplyObjectFit(e){return Et.applyObjectFitCommon(this,e,this.jsvImageView)}jsvDrawImage(){if(!this.src)return;let e=null;"true"===this.jsvScaleDownTex&&(this.style&&this.style.width?e={width:this.style.width,height:0}:console.error("set jsvScaleDownTex while style.width is not set")),this._OnLoadSeq++;let t=this._OnLoadSeq;ct.SetBackgroundImage(this.jsvImageView,this.src,this.style.borderRadius,(e=>{t===this._OnLoadSeq&&this.jsvOnLoaded(e)}),e,this.jsvColorSpace)}}class Wt extends Et{constructor(e){super(),this.jsvMainView=new i.JsvElementView(e)}get textContent(){return this.jsvMainView.textContent}set textContent(e){this.jsvMainView.textContent=e}setAttribute(e,t){super.setAttribute(e,t),this.jsvMainView.setAttribute(e,t)}removeAttribute(e){super.removeAttribute(e),this.jsvMainView.removeAttribute(e)}getAttribute(e){return this.jsvMainView.getAttribute(e)}hasAttribute(e){return this.jsvMainView.hasAttribute(e)}jsvOnStyleChanged(e){super.jsvOnStyleChanged(e)}}class Ht{constructor(e){let t=e.indexOf(Ht.KeyFramesFlag)+Ht.KeyFramesFlag.length,i=e.indexOf("{"),s=e.substring(t,i);this.name=s.trim(),this.cssText=e}}Ht.KeyFramesFlag="@keyframes";class $t{constructor(e){this.jsvCssRules=null,this.jsvTextContent=e}get cssRules(){if(this.jsvCssRules)return this.jsvCssRules;this.jsvCssRules=new Array;if(this.jsvTextContent.indexOf(Ht.KeyFramesFlag)<0)return this.jsvCssRules;var e=this.jsvTextContent.split(Ht.KeyFramesFlag);for(let t in e)0!=t&&this.insertRule(Ht.KeyFramesFlag+e[t]);return this.jsvCssRules}insertRule(e,t){if(void 0===t&&(t=this.jsvCssRules.length),e.indexOf(Ht.KeyFramesFlag)<0)throw Error("StyleSheet.insertRule() Rule is not supported except keyframes.");let i=new Ht(e);this.jsvCssRules.splice(t,0,i)}deleteRule(e){this.jsvCssRules.splice(e,1)}}class Kt extends Et{constructor(e){super(e),this.textContent=null}jsvGetTagName(){return Et.TAG.STYLE}appendChild(e){super.appendChild(e);let t=new $t(e.textContent);document.jsvAppendStyleSheet(t)}removeChild(e){throw super.removeChild(e),Error("Failed to removeChild, unimplement!.")}}class Yt extends Et{}class zt extends It{constructor(e){super(e),console.log("VideoElement.constructor()",this),this._EventCache=[],this._UseTexture=!1,this._StartTime=0}jsvGetTagName(){return Et.TAG.VIDEO}setAttribute(e,t){("jsv-media-usetexture"!==e||"true"!==t&&!0!==t&&""!==t)&&("jsv_media_usetexture"!==e||"true"!==t)?super.setAttribute(e,t):this._UseTexture=!0}removeAttribute(e){if("jsv-media-usetexture"===e||"jsv_media_usetexture"===e)return this._UseTexture=!1,void console.log("removeAttribute jsv_media_usetexture");super.removeAttribute(e)}jsvFlushViewLayout(){super.jsvFlushViewLayout();let e=this.style.JsvVideoRotation;isNaN(e)&&(e=0),this.style.objectFit&&this.style.objectFit!=Tt.ObjectFit.CONTAIN&&this.style.objectFit!=Tt.ObjectFit.FILL&&(console.error("Video rotation is not valid on objectFit=",this.style.objectFit),e=0),this.jsvMedia&&this.jsvMedia.setRotation?.(e,this.style.width,this.style.height,this.style.objectFit==Tt.ObjectFit.FILL)}jsvAddMediaListener(e){this.jsvMedia?this.jsvMedia.addEventListener(e,(()=>{let t=new ut(e);t.target=this,this.dispatchEvent(t)})):this._EventCache.push(e)}jsvFlushVideoView(){this.jsvMediaView&&(this.jsvStore.textureWidth=this.jsvMedia.videoWidth,this.jsvStore.textureHeight=this.jsvMedia.videoHeight,this.style.jsvLazySyncCache.setCacheProperty(Tt.TYPE.LAYOUT_SIZE,!0))}jsvApplyObjectFit(e){return Et.applyObjectFitCommon(this,e,this.jsvMediaView)}jsvInit(){console.log("VideoElement jsvInit"),this._UseTexture?this.jsvMedia=new It.HOOKS.OffscreenVideo:this.jsvMedia=new It.HOOKS.Video,this._EventCache.length>0&&(this._EventCache.map((e=>{this.jsvAddMediaListener(e)})),this._EventCache=[]),this.addEventListener("load",this.jsvOnLoaded.bind(this)),super.jsvInit()}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}jsvOnLoaded(){if(!this.jsvMediaView){let e;if(this._UseTexture){this.jsvMediaView=new i.LayoutView;let t,s=ct.TextureManager.GetOffScreenMediaTexture(this.jsvMedia),n=this.style.borderRadius;n&&(t=new i.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight)),e=new i.TextureSetting(s,t)}else{this.jsvMediaView=new i.VideoView(this.jsvMedia);let t=ct.TextureManager.GetColorTexture("rgba(0,0,0,0)");e=new i.TextureSetting(t,null,null,!1)}this.jsvMainView.AddView(this.jsvMediaView),this.jsvMediaView.ResetTexture(e)}this.jsvFlushVideoView()}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",Tt.ObjectFit.CONTAIN),super.jsvOnLoadForgeView()}onJsViewHide(){this._StartTime=this.jsvMedia.currentTime,super.onJsViewHide(),this.jsvMedia.setState("autoPlay",!1,"boolean")}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.jsvMedia.startTime=Math.max(this._StartTime-1,0),this._StartTime=0,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}}zt.PROP={SetOnly:[],GetOnly:["videoHeight","videoWidth"],SetAndGet:["height","poster","width"]};for(let e in zt.PROP){let t=zt.PROP[e];for(let i of t){let t={};"SetOnly"!==e&&"SetAndGet"!==e||(t.set=function(e){this.media[i]=e}),"GetOnly"!==e&&"SetAndGet"!==e||(t.get=function(){return this.media[i]}),zt.prototype[i]=t}}zt.EVENTS=["oncanplay","oncanplaythrough","ondurationchange","onended","onerror","onload","onloadedmetadata","onloadstart","onpause","onplay","onplaying","onprogress","onseeking","onseeked","onstalled","ontimeupdate"];class Xt extends mt{constructor(e){super(mt.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}class Jt extends mt{constructor(e){super(mt.COMMENT_NODE),this.textContent=e}}let qt={};class Zt{constructor(e,t,i){this._Element=i,qt.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),qt[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;if(this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),window.JsView){let e=window.JsView.ForgeExt;t.attachToActivity(e.RootActivity,e.RootView)}else window.addEventListener("keydown",(e=>{var i=document.activeElement.tagName;i&&"input"===i.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var i=document.activeElement.tagName;i&&"input"===i.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())}))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),Mt()}}class Qt extends At{constructor(e){super(e),console.log("AudioElement.constructor()",this)}jsvGetTagName(){return Et.TAG.AUDIOTRACK}jsvInit(){this.jsvMedia=new It.HOOKS.Audio("AudioTrack"),this.jsvOverrideMedia=!0,super.jsvInit()}}class ei extends mt{constructor(){console.log("Document.constructor()"),super(mt.DOCUMENT_NODE),this.location=window.location,this.rootElement=new Ot,this.rootElement.ownerDocument=this,this.rootElement.id="root",this.activeElement=this.rootElement,this.head=new Gt,this.styleSheets=new Array,window.JsView&&this.styleSheets.push(new $t("@keyframes jsv-basic-slot {}")),this.jsvIsReady=!1}createElement(e){switch(e){case ei.FDIV_ELEMENT:return new Vt;case ei.DIV_ELEMENT:return new Ot;case ei.IMG_ELEMENT:case ei.FIMG_ELEMENT:return new Ut;case ei.STYLE_ELEMENT:return new Kt;case ei.AUDIO_ELEMENT:return new At;case ei.AUDIOTRACK_ELEMENT:return new Qt;case ei.VIDEO_ELEMENT:return new zt;case ei.LINK_ELEMENT:return window.JsView?new jt:window.originDocument.createElement(ei.LINK_ELEMENT);case ei.SCRIPT_ELEMENT:return window.JsView?new Nt:window.originDocument.createElement(ei.SCRIPT_ELEMENT);case ei.ANCHOR_ELEMENT:return new xt;case ei.SVG_ELEMENT:return new SVGElement;default:return 0!==e.indexOf("jsv")||window.JsView?(console.warn("Document.createElement() unknown name="+e),new Yt(e)):new Wt(e)}}createTextNode(e){return new Xt(e)}createEvent(e){return new ut(e)}createComment(e){return new Jt(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw Error("Document.getElementById() id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if("head"===e.toLowerCase())return window.JsView?[this.head]:window.originDocument.getElementsByTagName(e);if("link"===e.toLowerCase()||"script"===e.toLowerCase()||"style"===e.toLowerCase())return[];throw Error("Document.getElementsByTagName() name="+e+" is UNIMPLEMENTED.")}querySelector(e){if("root"===e||"#app"===e)return this.rootElement;if("head"===e)return this.head;if("base"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;throw Error("Document.querySelector() selectors="+e+" is UNIMPLEMENTED.")}jsvAppendStyleSheet(e){document.styleSheets.push(e)}jsvGetKeyFrames(e,t){if(window.JsvCode.Dom.StyleSheets){const i=window.JsvCode.Dom.StyleSheets;for(const s of t){const t=i[`${e}-${s.replace("data-v-","")}`];if(t)return t}const s=i[e];if(s)return s}for(let t of this.styleSheets)for(let i of t.cssRules)if(i.name==e)return i.cssText;let i="@keyframes ",s=i+e;for(let e of this.styleSheets){let t=e.jsvTextContent,n=t.indexOf(s);if(n<0)continue;let r=t.indexOf("-keyframes",n+1),a=t.indexOf(i,n+1);a<0&&(a=t.length),r>0&&r<a&&(a=r);let o=t.substring(n,a);return e.insertRule(o,0),o}return null}jsvUpdateRootElement(e){console.log("Document.jsvUpdateRootElement() this.jsvIsReady = true"),this.rootElement.jsvMainView=e,this.jsvIsReady=!0}jsvInitFDivRoot(e,t,i){if(!i){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,i=this.rootElement}return new Zt(e,t,i)}jsvGetFDivRoot(e){return function(e){return qt[e]}(e)}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}ei.ANCHOR_ELEMENT="a",ei.AUDIO_ELEMENT="audio",ei.DIV_ELEMENT="div",ei.IMG_ELEMENT="img",ei.LINK_ELEMENT="link",ei.SCRIPT_ELEMENT="script",ei.STYLE_ELEMENT="style",ei.SVG_ELEMENT="svg",ei.VIDEO_ELEMENT="video",ei.FIMG_ELEMENT="fimg",ei.FDIV_ELEMENT="fdiv",ei.AUDIOTRACK_ELEMENT="audiotrack";class ti extends Et{jsvGetTagName(){return Et.TAG.LINK}}if(window.JsvCode={Dom:{StyleSheets:{}}},window.Audio=At,window.Video=zt,window.MutationObserver=class{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof mt))throw Error("TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type JsView's 'Node'");for(const e of Object.keys(t))"childList"==e||console.warn("JsView: only childList config is supported! ignore "+e);t.childList&&e.jsvObserveChildChanged((()=>{this.callback?.()}))}disconnect(){this.callback=void 0}},window.JsView){console.log("Declare Dom Proxy."),global.SVGElement=ti,global.Element=Et;let e=new ht(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.addEventListener=function(e,t){},window.document=new ei,window.history={},window.navigator={userAgent:"jsview-runtime"},window.HTMLIFrameElement=function(){}}gt.I("Using JsView Runtime");class ii{static _isUndefined(e,t){let i=void 0===t;return i&&console.error(e+" property is undefined!"),i}static _isUndefinedOrNumber(e,t){return!!ii._isUndefined(e,t)||"number"==typeof t}static _keyframesCheck(e,t){ii._isUndefined(e,t)||t.indexOf("transform")<0&&t.indexOf("opacity")<0&&console.error("keyframes property is only support transform and opacity, value:",t)}static _objectFit(e,t){if(ii._isUndefined(e,t))return;const i="fill contain cover none scale-down";i.indexOf(t)<0&&console.error(" objectFit is only support one of string["+i+"]")}static _clipPathCheck(e,t){ii._isUndefined(e,t)||t.startsWith("inset")||console.error("clipPath property is support inset only.")}static _transitionOtherCheck(e,t){ii._isUndefined(e,t)||console.error(e+" property is not support, you can use transition property, e.g. transition='width 2s'")}static _transitionCheck(e,t){ii._isUndefined(e,t)}static _transformCheck(e,t){ii._isUndefined(e,t)||t.length>0&&t.indexOf("translate3d")<0&&t.indexOf("scale3d")<0&&t.indexOf("rotate3d")<0&&t.indexOf("skew")<0&&console.error("transform property's value only support translate3d、scale3d、rotate3d、skew, value:",t)}static _transformOriginCheck(e,t){ii._isUndefined(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("transformOrigin property's value only support XX%、left、top、right, bottom:",t)}static _textOverflowCheck(e,t){if(!ii._isUndefined(e,t))switch(t){case"clip":case"ellipsis":break;default:console.error("textOverflow property's value is not support, value:",t)}}static _whiteSpaceCheck(e,t){if(!ii._isUndefined(e,t))switch(t){case"normal":case"nowrap":case"pre-wrap":break;default:console.error("whiteSpace property's value is not support, value:",t)}}static _textAlignCheck(e,t){if(!ii._isUndefined(e,t))switch(t){case"left":case"right":case"center":break;default:console.error("textAlign property's value is not support, value:",t)}}static _lineHeightCheck(e,t){if(!ii._isUndefinedOrNumber(e,t))switch(t){case"normal":case"inherit":console.error("lineHeight property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("lineHeight property's value is support number only, value:",t)}}static _colorCheck(e,t){ii._isUndefined(e,t)||ii._checkColorFormat("Color()",t)}static _visibilityCheck(e,t){ii._isUndefined(e,t)||"visible"!==t&&"hidden"!==t&&"inherit"!==t&&console.error("visibility property's value is not support, value:",t)}static _displayCheck(e,t){ii._isUndefined(e,t)||"block"!==t&&"inline"!==t&&"none"!==t&&"inline-block"!==t&&"inherit"!==t&&""!==t&&console.error("display property's value is not support, value:",t)}static _overflowCheck(e,t){ii._isUndefined(e,t)||"visible"!==t&&"hidden"!==t&&console.error("overflow property's value is support visible or hidden only, value:",t)}static _topCheck(e,t){if(!ii._isUndefinedOrNumber(e,t))switch(t){case"auto":case"inherit":console.error("top property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("top property's value is support number only, value:",t)}}static _leftCheck(e,t){if(!ii._isUndefinedOrNumber(e,t))switch(t){case"auto":case"inherit":console.error("left property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("left property's value is support number only, value:",t)}}static _heightCheck(e,t){if(!ii._isUndefinedOrNumber(e,t))switch(t){case"auto":case"inherit":console.error("height property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("height property's value is support number only, value:",t)}}static _widthCheck(e,t){if(!ii._isUndefinedOrNumber(e,t))switch(t){case"auto":case"inherit":console.error("width property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("width property's value is support number only, value:",t)}}static _backfaceVisibility(e,t){if(!ii._isUndefined(e,t))switch(t){case"visible":case"hidden":break;default:console.error("backfaceVisibility property's value is support visible/hidden only, value: ",t)}}static _perspectiveCheck(e,t){ii._isUndefined(e,t)}static _WebkitTextStroke(e,t){if(ii._isUndefined(e,t))return;t.split(" ").length<2&&console.error("Error: WebkitTextStroke should format of(width color) such as: '1px rgba(255,255,255,1.0)'")}static _zIndexCheck(e,t){ii._isUndefined(e,t)||isNaN(t)&&console.error("zIndex property's value is support number only, value: ",t)}static _fontSizeCheck(e,t){if(!ii._isUndefined(e,t)&&"number"!=typeof t)switch(t){case"smaller":case"larger":case"inherit":case"x-small":case"xx-small":case"small":case"large":case"medium":case"x-large":case"xx-large":console.error("fontSize property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("fontSize property's value is support number only, value:",t)}}static _fontWeightCheck(e,t){ii._isUndefined(e,t)||"bold"!==t&&console.error("fontWeight property's value is support bold only, value:",t)}static _fontStyleCheck(e,t){ii._isUndefined(e,t)||"italic"!==t&&console.error("fontWeight property's value is support italic only, value:",t)}static _borderRadiusCheck(e,t){if(ii._isUndefined(e,t))return;t.split(" ").length>4&&console.error("borderRadius property's value is not support, value:",t)}static _borderImageWidthCheck(e,t){ii._isUndefinedOrNumber(e,t)}static _borderImageOutsetCheck(e,t){if(ii._isUndefined(e,t))return;t.split(" ").length>4&&console.error("borderImageOutsetCheck property's value is not support, value:",t)}static _borderImageCheck(e,t){ii._isUndefined(e,t)||t.indexOf("fill")<0&&console.error("borderImage property's value is not contain fill, e.g. source slice, but value:",t)}static _backgroundOtherCheck(e,t){console.error(e+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`")}static _backgroundImageCheck(e,t){ii._isUndefined(e,t)||"inherit"==t&&console.error("backgroundImage property's value is not support, value:",t)}static _backgroundColorCheck(e,t){if(!ii._isUndefined(e,t))return ii._checkColorFormat("backgroundColor",t)}static _animationCheck(e,t){}static _animationOtherNotSupport(e,t){console.error(e+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'")}static _transformStyleCheck(e,t){if(!ii._isUndefined(e,t))switch(t){case"flat":case"preserve-3d":break;default:console.error("transformStyle property value is not valid",t)}}static _perspectiveOriginCheck(e,t){ii._isUndefined(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("perspectiveOrigin property's value only support XX%、left、top、right, bottom:",t)}static _textShadowCheck(e,t){if(!ii._isUndefined(e,t)&&t.length>0){if(t.replace(/\(.*\)/g,"").split(",").length>1)return void console.error("textShadow: NOT support more than one part settings");const e=t.split(" ");if(4!==e.length&&(5!==e.length||0!==e[4].length)||isNaN(parseInt(e[0]))||isNaN(parseInt(e[1])))console.error('textShadow: format should be "offsetX offsetY blurSize color"(0 0 1 rgba(100,100,100,1)), !NOT space in rgba()');else{if(!(parseFloat(e[2])>0))return void console.error(`textShadow: blur shadow above 0(now=${t})`);if(!ii._checkColorFormat("textShadow",e[3]))return}}}static _checkColorFormat(e,t){if(0===t.indexOf("rgba(")||0===t.indexOf("rgb("));else{if(0!==t.indexOf("#"))return console.error(`${e} color value is not valid, need startwith rgba or #, value:[${t}]`),!1;if(7!==t.length)return console.error(`${e} color value's length is not valid, value:${t}`),!1}return!0}static _JsvVideoRotationCheck(e,t){return!isNaN(parseInt(t))||(console.error(`${e} value is not valid, value:${t}`),!1)}static get(e){return ii.ValidStyleMap[e]}}ii.ValidStyleMap={animation:{check:ii._animationCheck},animationName:{check:ii._animationOtherNotSupport},animationDuration:{check:ii._animationOtherNotSupport},animationTimingFunction:{check:ii._animationOtherNotSupport},animationDelay:{check:ii._animationOtherNotSupport},animationIterationCount:{check:ii._animationOtherNotSupport},animationDirection:{check:ii._animationOtherNotSupport},animationPlayState:{check:ii._animationOtherNotSupport},animationFillMode:{check:ii._animationOtherNotSupport},background:{check:ii._backgroundOtherCheck},backgroundColor:{check:ii._backgroundColorCheck},backgroundImage:{check:ii._backgroundImageCheck},borderImage:{check:ii._borderImageCheck},borderImageOutset:{check:ii._borderImageOutsetCheck},borderImageWidth:{check:ii._borderImageWidthCheck},borderRadius:{check:ii._borderRadiusCheck},height:{check:ii._heightCheck},width:{check:ii._widthCheck},zIndex:{check:ii._zIndexCheck},fontFamily:{check:null},fontSize:{check:ii._fontSizeCheck},fontStyle:{check:ii._fontStyleCheck},fontWeight:{check:ii._fontWeightCheck},left:{check:ii._leftCheck},overflow:{check:ii._overflowCheck},top:{check:ii._topCheck},visibility:{check:ii._visibilityCheck},display:{check:ii._displayCheck},color:{check:ii._colorCheck},lineHeight:{check:ii._lineHeightCheck},textAlign:{check:ii._textAlignCheck},whiteSpace:{check:ii._whiteSpaceCheck},textOverflow:{check:ii._textOverflowCheck},transform:{check:ii._transformCheck},transformOrigin:{check:ii._transformOriginCheck},transition:{check:ii._transitionCheck},transitionProperty:{check:ii._transitionOtherCheck},transitionDuration:{check:ii._transitionOtherCheck},transitionTimingFunction:{check:ii._transitionOtherCheck},transitionDelay:{check:ii._transitionOtherCheck},clipPath:{check:ii._clipPathCheck},keyframes:{check:ii._keyframesCheck},objectFit:{check:ii._objectFit},perspective:{check:ii._perspectiveCheck},backfaceVisibility:{check:ii._backfaceVisibility},transformStyle:{check:ii._transformStyleCheck},perspectiveOrigin:{check:ii._perspectiveCheck},WebkitTextStroke:{check:ii._WebkitTextStroke},textShadow:{check:ii._textShadowCheck},JsvVideoRotation:{check:ii._JsvVideoRotationCheck}},console.log("Hook Document ...");const si=new ei;window.myHook=si,window.document.head.appendChild=si.head.appendChild.bind(si.head),window.document.head.removeChild=si.head.removeChild.bind(si.head),window.document.createElement=si.createElement.bind(si),window.document.createTextNode=si.createTextNode.bind(si),window.document.createComment=si.createComment.bind(si),window.document.getElementById=si.getElementById.bind(si),window.document.getElementsByTagName=si.getElementsByTagName.bind(si),window.document.querySelector=si.querySelector.bind(si),window.document.createEvent=si.createEvent.bind(si),window.document.dispatchEvent=si.dispatchEvent.bind(si),window.document.jsvInitFDivRoot=si.jsvInitFDivRoot.bind(si),window.document.jsvGetFDivRoot=si.jsvGetFDivRoot.bind(si),window.document.jsvAppendStyleSheet=function(e){let t=window.originDocument.createElement("style");t.type="text/css",t.innerHTML=e.jsvTextContent,this.getElementsByTagName("Head")[0].appendChild(t)},window.document.jsvGetKeyFrames=function(e,t){let i="";var s=document.styleSheets;for(let t=0;t<s.length;++t){const n=s[t];if(n.cssRules)for(let t=0;t<n.cssRules.length;++t){let s=n.cssRules[t];if(s&&s.name===e){i=s.cssText;break}}}if(!i){const s=window.JsvCode.Dom.StyleSheets;for(const n of t){if(i=s[`${e}-${n.replace("data-v-","")}`],i){document.jsvAppendStyleSheet({jsvTextContent:i});break}}i||(i=s[e],i&&document.jsvAppendStyleSheet({jsvTextContent:i}))}return i&&document.jsvCheckStyleFormat&&document.jsvCheckStyleFormat("keyframes",i),i};let ni=window.navigator.userAgent.toLowerCase();window.jsvInAndroidWebView=ni.indexOf("android")>=0,window.jsvInAndroidWebView?window.document.jsvCheckStyleFormat=null:window.document.jsvCheckStyleFormat=function(e,t){if(e.startsWith("--"))return;let i=ii.get(e);i?i.check&&t&&i.check(e,t):console.error(e+" property is not support.")},ct.TextureManager=new i.TextureManager,ct.RootView=new i.RootView,si.jsvUpdateRootElement(ct.RootView),i.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{ft.SyncAllCachedProperty(),ct.ClearUnusedTexSize()})),window.jsvIsBrowserDebug=!0,console.log("Using JsView HTML hook");
|
|
1
|
+
/* eslint-disable */ import{parseGIF as e,decompressFrames as t}from"gifuct-js";void 0===window.Forge&&(window.Forge={});var i=window.Forge;class s{static getTextPixelWith(e,t){null===s.sCanvas&&(s.sCanvas=window.originDocument.createElement("canvas"));const i=s.sCanvas.getContext("2d");i.font=t;const n=i.measureText(e);return Math.ceil(n.width)}static GetTextWidth(e){let t="";e.bold&&(t="bold");let i="";return e.italic&&(i="italic"),this.getTextPixelWith(e.str,`${t} ${i} ${e.size}px ${e.font}`)}static GetTextRect(e,t,i,s,n){let r=Math.ceil(i.size*e.length/t.width)*n;r>t.height&&(r=t.height);return{width:t.width,height:r}}static GetCursorOffset(e,t,i,s,n,r,a){let o="";i.bold&&(o="bold");let l="";i.italic&&(l="italic");let h=0;if("right"===i.alignment){const s=this.getTextPixelWith(e,`${o} ${l} ${i.size}px ${i.font}`);(r-=t.width-s)<0&&(r=0)}let c=0;for(;r>=c&&h!==e.length;)c=this.getTextPixelWith(e.substr(0,h+1),`${o} ${l} ${i.size}px ${i.font}`),r>=c&&h++;return h}static GetCursorPosition(e,t,i,s,n,r){let a="";i.bold&&(a="bold");let o="";i.italic&&(o="italic");let l=0,h=e;if(r<e.length&&(h=h.substr(0,r)),l=this.getTextPixelWith(h,`${a} ${o} ${i.size}px ${i.font}`),"right"===i.alignment){const s=this.getTextPixelWith(e,`${a} ${o} ${i.size}px ${i.font}`);l=t.width-s+l}return{x:l,y:0}}}s.sCanvas=null,window.PlatformUtils=s;class n{constructor(e){this.state={},this.type=e,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(e){void 0!==e&&(this._AutoPlay=!0,this.Ele.paused&&setTimeout((()=>{this.play()}),0))}get currentTime(){return this.Ele.currentTime}set currentTime(e){this.Ele.currentTime=e,this.setState("seek",e,"number")}get duration(){return this.Ele.duration}set loop(e){this.Ele.loop="boolean"==typeof e||void 0!==e}get muted(){return this.getState("muted")}set muted(e){this.setState("muted",e,"boolean")}get paused(){return this.Ele.paused}get playbackRate(){return this.getState("playbackRate")}set playbackRate(e){this.setState("playbackRate",e,"number")}set src(e){this.setState("src",e,"string"),e&&this._AutoPlay&&setTimeout((()=>{this.play()}),0)}get style(){const e=this;return{set bottom(t){e.setState("style",`{"bottom":"${t}"}`,"string")},set left(t){e.setState("style",`{"left":"${t}"}`,"string")},set right(t){e.setState("style",`{"right":"${t}"}`,"string")},set top(t){e.setState("style",`{"top":"${t}"}`,"string")},set height(t){e.setState("style",`{"height":"${t}"}`,"string")},set width(t){e.setState("style",`{"width":"${t}"}`,"string")}}}get volume(){return this.getState("volume")}set volume(e){this.setState("volume",e,"number")}get playableDuration(){return this.Ele.playableDuration}addEventListener(e,t){this[`on${e}`]=t,this.Ele.addEventListener(e,(t=>{this[`on${e}`](t)}))}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(e,t,i){typeof t===i?("playbackRate"==e?this.Ele.playbackRate=t:this.Ele.setAttribute(e,t),this.state[e]=t,console.log(`set ${e} = ${t}`)):console.warn(`invalid paramter type to set ${e}. value is not ${i}`)}getState(e){let t=this.state[e];return console.log(`get ${e} = ${t}`),void 0===t&&(t=this.Ele.getAttribute(e),this.state[e]=t),t}onEnd(e){this.setState("paused",!0,"boolean"),this.hasOwnProperty("onended")&&this.onended()}onError(e){this.hasOwnProperty("onerror")&&this.onerror(e.currentTarget.error.code)}mediaHandler(){return this.Ele}static setDesignMapWidth(e){"number"==typeof e?n.prototype.designMapWidth=e:console.warn(`Invalid paramter type to set ${e}. It is not number.`)}}n.prototype.designMapWidth=0;class r extends n{constructor(e){super(e),super.buildPlatformInstance(e)}}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(e){this.style.height=e,this.state.height=e}get poster(){return console.log("Video.poster() TODO"),null}set poster(e){console.log("Video.poster() TODO")}get videoAspectRatio(){return this.getState("aspectRatio")}set videoAspectRatio(e){this.setState("aspectRatio",e,"string")}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}get width(){return this.getState("width")}set width(e){this.style.width=e,this.state.width=e}onLoad(e){super.onLoad(e)}setRotation(e,t,i,s){let n=function(){let n=`rotate3d(0, 0, 1, ${e}deg)`;if(90==e||-90==e){let e,r;if(s?(e=i/t,r=t/i):(e=this.videoHeight/this.videoWidth,r=this.videoWidth/this.videoHeight),isNaN(e)||isNaN(r))return!1;n+=` scale3d(${e}, ${r}, 1)`}return this.Ele.style.transform=n,this.Ele.parentNode&&(this.Ele.parentNode.style.overflow="hidden"),!0};n=n.bind(this);n()||this.Ele.addEventListener("loadedmetadata",(()=>{n()}))}}window._ExtVideo=o;class l extends n{constructor(){super("video"),this._ReleaseCallbacks=[],this._ResourceTerminater=null,super.buildPlatformInstance()}setResourceTerminator(e){this._ResourceTerminater=e}hasTerminator(){return null!==this._ResourceTerminater}listenToRelease(e){this._ReleaseCallbacks.push(e)}unload(){super.unload(),null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}releaseResource(){for(let e=0;e<this._ReleaseCallbacks.length;e++)this._ReleaseCallbacks[e]();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(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){const t=e.indexOf("(")+1,i=e.lastIndexOf(")");e=e.substring(t,i).trim()}if(!0===e.startsWith("data:"))return void(this.href=e);if(!0===e.startsWith("/")&&(e=document.location.origin+e),!0===e.startsWith("./")){const t=document.location.pathname.lastIndexOf("/");let i="";t>0&&(i=document.location.pathname.substring(0,t)),e=document.location.origin+i+e.substring(1)}if(this.href=e,!t)return;let i=this.href.indexOf("?");const s=i>0?this.href.substring(0,i):this.href;this.search=i>1?this.href.substring(i):"",i=s.indexOf("://"),this.protocol=i>0?s.substring(0,i+1):"";const n=i>1?s.substring(i+3):"";i=n.indexOf("/"),this.host=i>0?n.substring(0,i):"",this.pathname=i>1?n.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(e){this.href=e}}const c=window.AudioContext||window.webkitAudioContext;if(c){const e=new c;let t=0,i=0;class s{constructor(e,t,i){this._Context=e,this._BufferSource=t,this._Gain=i,this._BufferSource.connect(this._Gain),this._Gain.connect(this._Context.destination)}start(e,t,i){this._BufferSource.start(e,t,i)}setVolume(e){this._Gain.gain.setValueAtTime(e,this._Context.currentTime)}stop(e){this._BufferSource.stop(e)}}class n{constructor(){this._SoundBufferMap={},this._StreamMap={}}load(i,s,n,r){const a=new h(i).href,o=t++;return this._requestBuffer(a,((t,i)=>{0===t?e.decodeAudioData(i,(e=>{this._SoundBufferMap[o]=e,r(o,0)})):r(-1,-1)})),o}unload(e){delete this._SoundBufferMap[e]}autoPause(){}autoResume(){}play(t,n,r,a,o,l){if(this._SoundBufferMap[t]){const r=i++,a=e.createBufferSource();a.buffer=this._SoundBufferMap[t],a.playbackRate.value=l,a.onended=e=>{this.stop(r)},o>0&&(a.loop=!0);const h=e.createGain();h.gain.setValueAtTime(n,e.currentTime);const c=new s(e,a,h);return this._StreamMap[r]=c,console.log("loop test",(o+1)*this._SoundBufferMap[t].duration),c.start(0,0,(o+1)*this._SoundBufferMap[t].duration),r}return-1}pause(e){}resume(e){}stop(e){this._StreamMap[e]&&(this._StreamMap[e].stop(),delete this._StreamMap[e])}release(){this._SoundBufferMap={},this._StreamMap={}}setVolume(e,t,i){this._StreamMap[e]&&this._StreamMap[e].setVolume(t)}setPriority(e,t){}setRate(e,t){}setLoop(e,t){}_requestBuffer(e,t){const i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200===i.status?(console.log("http request succeed"),t(0,i.response)):(console.error(`download audio ${e} failed.`,i.status),t(-1,null))},i.send()}}window.SoundPool=n}else window.SoundPool=null;i.LogF=function(e){},i.LogE=function(e){},i.LogW=function(e){},i.LogI=function(e){},i.LogD=function(e){},i.LogM=function(e){},i.ThrowError=function(e){throw new Error(e)},i.Assert=function(e){if(!e)throw new Error("ASSERT!!!!!")},i.EnableLog=function(e){i.LogM=console.log.bind(console),e>0&&(i.LogF=console.error.bind(console)),e>1&&(i.LogE=console.error.bind(console)),e>2&&(i.LogW=console.warn.bind(console)),e>3&&(i.LogI=console.log.bind(console)),e>4&&(i.LogD=console.debug.bind(console))};i.RectArea=class{constructor(e,t,i,s){this.x="number"==typeof e?e:0,this.y="number"==typeof t?t:0,("number"!=typeof i||i<0)&&(i=0),this.width=i,("number"!=typeof s||s<0)&&(s=0),this.height=s}Equals(e){return null!==e&&(e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height)}};i.Coordinate=class{constructor(e,t){this.x=e,this.y=t}};i.Size=class{constructor(e,t){this.width=e,this.height=t}};i.RectUtils=class{FormatRectArea(e){let t=null;if(e instanceof i.RectArea)t=e;else if("object"==typeof e&&null!==e){if(isNaN(e.width)||isNaN(e.height))throw new Error("ERROR: target_size format should be {width:XXXX, height:XXXX}");t=new i.RectArea(0,0,e.width,e.height)}return t}},i.sRectUitls=new i.RectUtils,i.TextShaderType={LinearGradient:0,Image:1};i.TextShader=class{constructor(e,t){this.Type=e,this.Params=t}};class u{constructor(){const e=(new i.LayoutView).GetRenderer();this._Renderer=e,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(e){return this.IsInstantLoad=e,this}SetStringWithFont(e){return this.StringWithFont=e,this}SetLatexMode(e){return this.LatexMode=e,this}SetFontStyle(e,t,s,n,r,a,o,l,h,c){return this.StringWithFont="object"==typeof e?i.sTextUtils.StringWithFont("",void 0!==e.size?e.size:10,void 0!==e.font?e.font:"宋体",void 0!==e.hAlign?e.hAlign:"center",void 0!==e.vAlign?e.vAlign:"middle",void 0!==e.textColor?e.textColor:"#000000",void 0!==e.italic&&e.italic,void 0!==e.bold&&e.bold,void 0!==e.shadow?e.shadow:null,void 0!==e.strokeWidth?e.strokeWidth:null,void 0!==e.vAreaAlign?e.vAreaAlign:"top"):i.sTextUtils.StringWithFont("",e,t,s,n,r,a,o,l,h,c),this}SetRectArea(e){return e instanceof i.RectArea?this.RectArea=e:this.RectArea=new i.RectArea(e.x,e.y,e.width,e.height),this}SetViewSize(e){return e instanceof i.RectArea||(e=new i.RectArea(e.x,e.y,e.width,e.height)),this.SetRectArea(e),0===this.LineHeight&&0!==e.height&&(this.LineHeight=e.height),this}SetTextAttr(e){let t,i;return t=e.hasOwnProperty("textOverflow")?e.textOverflow:e.hasOwnProperty("text_overflow")?e.text_overflow:"clip",i=e.hasOwnProperty("wordWrap")?e.wordWrap:e.hasOwnProperty("word_wrap")?e.word_wrap:"none",this.TextAttr={word_wrap:i,text_overflow:t},this}SetMarquee(e){return e&&(this.Marquee={repetition:"infinite",direction:"left",speed:"normal"},e.repetition&&(this.Marquee.repetition=e.repetition),e.direction&&(this.Marquee.direction=e.direction),e.speed&&(this.Marquee.speed=e.speed)),this}SetShader(e){return this.Shader=e,this}SetLineHeight(e){return this.LineHeight=e,this}EnableDuplicateBuilder(){this.BuildCopyBag=!0}Clone(){const e=new u(null);return e.StringWithFont=this.StringWithFont,e.RectArea=this.RectArea,e.TextAttr=this.TextAttr,e.LineHeight=this.LineHeight,e}}i.TextViewParams=u,window.TextViewParams=i.TextViewParams;class d{constructor(e,t,s,n,r){this._layoutView=null,this._textWidth=0,this._textViewReahHeight=0,this._marqueeRunning=!0,this._marqueePause=!1,this._marqueeCurrentNum=2,this._textView=null,this._TextViewParams=t,this._NeedQuick=void 0!==n&&n,this._marquee=t.Marquee,this._rectArea=t.RectArea,this._DrawCount=0,this._ShowInterval=0,this._TextureManager=e,this._LatexMode=t.LatexMode,this._Shader=t.Shader,this._IsInstantLoad=t.IsInstantLoad?1:0,this._AutoHeight=!1,this._EnableTextureOnloadCallback=!!r,this._DuplicateBag=t.BuildCopyBag?{Set:null,Swf:null,Siz:null}:null;const a=this;let o=null;const l=t.RectArea.width,h=t.RectArea.height;let c=null,u=null;null!==this._marquee?(u=new i.ClipView,u.Init(),u.SetClipRect(0,0,l,h,!0),u.SetId("matrixClipLayoutview"),u.OnDettachFromSystem=function(){a._marqueeRunning=!1,i.ClipView.prototype.OnDettachFromSystem.call(this)}):(u=new i.LayoutView,u.OnDettachFromSystem=function(){this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null)}),o=u.GetRenderer(),this._Renderer=o;let d=s;d||(d=t.StringWithFont.str),d=this._ConvertEscToString(d);let f=!1;t.StringWithFont.italic.length>0&&(f=!0);let g=!1;t.StringWithFont.bold.length>0&&(g=!0),c=i.sTextUtils.StringWithFont(d,t.StringWithFont.size,t.StringWithFont.font,t.StringWithFont.alignment,t.StringWithFont.vertical_align,t.StringWithFont.textColour,f,g,t.StringWithFont.shadow,t.StringWithFont.stroke_width,t.StringWithFont.vertical_area_align),void 0!==t.Marquee&&null!==t.Marquee?this._textWidth=i.sTextUtils.GetTextWidth(c):this._NeedQuick?this._textWidth=t.RectArea.width-2*t.RectArea.x:this._textWidth=i.sTextUtils.GetTextWidth(c),this.addTextView(u,c,t.TextAttr,t.RectArea,t.Marquee,t.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=u,this._TextTexture=null,this._MarqueeTimer=null}_ConvertEscToString(e){let t=`${e}`;return-1!==t.indexOf(""")&&(t=t.replace(/"/gi,'"')),-1!==t.indexOf("&")&&(t=t.replace(/&/gi,"&")),-1!==t.indexOf("<")&&(t=t.replace(/</gi,">")),-1!==t.indexOf(">")&&(t=t.replace(/>/gi,"<")),-1!==t.indexOf(" ")&&(t=t.replace(/ /gi," ")),t}EnableAutoHeight(){this._AutoHeight=!0,this._textView.EnableAutoHeight()}addTextView(e,t,s,n,r,a){const o=n.height;let l;const h=i.Clone(n);let c=null;0!==t.str.length?(l=this._TextureManager.GetTextTextureByMultiRows(t,s,h,a,this._NeedQuick,this._Shader,this._IsInstantLoad,this._LatexMode,this._DuplicateBag),this._TextTexture=l.texture,this._textViewReahHeight=l.real_height,c=new i.LayoutView,c.Init(new i.TextureSetting(l.texture,null,null,!0)),c.SetId(`Text-${t.str}`),"middle"!==t.vertical_area_align&&"bottom"!==t.vertical_area_align||(c.Element.style.display="table-cell",c.Element.style.position="static",e.Element.style.display="table",e.Element.style.position="static"),e.AddView(c,new i.LayoutParams({x:0,y:0,width:h.width,height:o})),this._textView=c):(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(e){e&&null!==this._textView&&this._textView.StartAnimation(e)}}i.TextViewEx=d,i.TextViewControl=d;i.CopiedTextViewEx=class{constructor(e,t,s,n,r){const a={x:0,y:0,width:s.width,height:s.height};this._ContainerView=new i.LayoutView,this._TextView=this._AddTextView(e,t,a,this._ContainerView,n,r)}_AddTextView(e,t,s,n,r,a){let o=null;if(t&&0!==t.length){const l=e.GetCopiedTextTexture(t,s,r,a);o=new i.LayoutView,o.Init(new i.TextureSetting(l,null,null,!0)),t.length<15?o.SetId(`Text-${t}`):o.SetId(`Text-Long${t.length}`),n.AddView(o,new i.LayoutParams({x:0,y:0,width:s.width,height:s.height})),a&&l.RegisterLoadImageCallback(null,a,null)}return o}EnableAutoHeight(){this._TextView&&this._TextView.EnableAutoHeight()}GetLayoutView(){return this._ContainerView}},i.Clone=function(e){return JSON.parse(JSON.stringify(e))},window.Clone=i.Clone;i.PersistTimer=new class{constructor(){this._AlreadyExited=!1,window.PersistTimer&&(this._AlreadyExited=!0)}setTimeout(e,t){return this._AlreadyExited&&window.PersistTimer.setTimeout?window.PersistTimer.setTimeout(e,t):window.setTimeout(e,t)}clearTimeout(e){this._AlreadyExited&&window.PersistTimer.clearTimeout?window.PersistTimer.clearTimeout(e):window.clearTimeout(e)}setInterval(e,t){if(!this._AlreadyExited||!window.PersistTimer.setInterval)return window.setInterval(e,t);window.PersistTimer.setInterval(e,t)}clearInterval(e){this._AlreadyExited&&window.PersistTimer.clearInterval?window.PersistTimer.clearInterval(e):window.clearInterval(e)}};i.ForegroundTimer=new class{setTimeout(e,t){return window.setTimeout(e,t)}clearTimeout(e){window.clearTimeout(e)}setInterval(e,t){return window.setInterval(e,t)}clearInterval(e){window.clearInterval(e)}},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(e){return{T:e,St:null}}};class f extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeIn)}}i.EasingIn=f;class g extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeOut)}}i.EasingOut=g;class m extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeInOut)}}i.EasingInOut=m;class _ extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeDeceleration)}}i.EasingDeceleration=_;class p extends i.EasingBase{Package(){return this._GetBasePackage(i.EasingTypeBlink)}}i.EasingBlink=p;class w extends i.EasingBase{constructor(e,t,i,s,n){super(),this._Inited=!1,this._X1=e,this._X2=i,this._Y1=t,this._Y2=s,this._Duration=n}Package(){const e=this._GetBasePackage(i.EasingTypeBezier);return e.St={X1:this._X1,X2:this._X2,Y1:this._Y1,Y2:this._Y2,Dur:this._Duration},e}}i.BezierEasing=w;class v extends i.EasingBase{constructor(e,t){super(),this._Steps=e,this._Type=t}Package(){const e=this._GetBasePackage(i.EasingTypeSteps);return e.St={S:this._Steps,T:this._Type},e}}i.StepsEasing=v,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 y{constructor(e,t,s){if(this._Manager=e,s){i.sRenderTextureDelegateManager.CreateTextureStatus().SetResourceInfo(s)}this.RenderTexture=i.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(t),this._CallbackIdToken=0,this._OnLoadCallback=[],i.ForgeDebug.EnableTextureTracer&&(e._ImageTextureTracer.push(this),this._TracerDescript="")}get Unloaded(){return null===this.RenderTexture||this.RenderTexture.Unloaded}set Unloaded(e){}get LoadTime(){return null!==this.RenderTexture?this.RenderTexture.LoadTime:0}set LoadTime(e){}get Width(){return null!==this.RenderTexture?this.RenderTexture.Width:0}set Width(e){}get Height(){return null!==this.RenderTexture?this.RenderTexture.Height:0}set Height(e){}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(e,t,s){if(this.IsLoaded()&&null!=t)return this.RenderTexture&&t({width:this.RenderTexture.Width,height:this.RenderTexture.Height},s),null;let n=null;return null!=t&&(n={callback:t,params:s},this._OnLoadCallback.push(n),0===this._CallbackIdToken&&(i.Assert(null!==this.RenderTexture),this._CallbackIdToken=this.RenderTexture.RegisterOnloadCallback(y.prototype._InvokeOnLoadCallbacks.bind(this)))),n}UnregisterLoadImageCallback(e){e&&this._OnLoadCallback.some(((t,i,s)=>{if(t===e)return s.splice(i,1),!0}))}EnableBackgroundLoad(e){}DisableBackgroundLoad(e){}_InvokeOnLoadCallbacks(){const e=this._OnLoadCallback;this._OnLoadCallback=[];for(let t=0;t<e.length;t++){const i=e[t];i.callback(i.params)}this.RenderTexture&&this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}SetTextureTracerDescript(e){this._TracerDescript=e}ReallocRenderTexture(){}}i.ImageTexture=y;class b extends i.ImageTexture{constructor(e,t,s,n,r,a){const o=i.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"IMG");o.Set={URL:t,Siz:n,Clr:r||"",IsF:s?1:0,NtS:a,ILd:0},super(e,o),this.Name="IMG",this.Source=t,this.IsForever=s?1:0,this.TargetSize=n,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=t,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(e){if(this._InstantLoad=e?1:0,this.RenderTexture){const e=this.RenderTexture.GetResourceInfo();null!==e&&(e.Set.ILd=this._InstantLoad,this.RenderTexture.SetResourceInfo(e))}return this}ReallocRenderTexture(){if(this.IsForever)return void i.LogE("ReallocRenderTexture(): NOT need for forever texture");const e=this.Source,t=this.TargetSize,s=this.ColorSpace,n=this.IsForever,r=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Manager.GetId(),this.Name);r.Set={URL:e,Siz:t,Clr:s,IsF:n,ILd:this._InstantLoad},this.RenderTexture=i.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(r),this._Manager.CachedTextureManager.CacheTheTexture(this)}}i.UrlImageTexture=b;class T extends i.ImageTexture{constructor(e,t,s,n,r,a,o,l,h,c,u){const d=i.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"TST");let f=null;u&&(f={x:0,y:0,w:0,h:0},Object.assign(f,u)),d.Set={ST:t,IDS:s.GetIdsPack(),W:Math.floor(r.width+.5),H:Math.floor(r.height+.5),FS:a,LA:h,EM:c,LH:Math.floor(o+.5),ILD:l?1:0,TLC:n?1:0,EA:f},super(e,d),this.Name="TST",this._TextStylePack=s,s.DoRef()}UnloadTex(){this._TextStylePack.UnRef(),super.UnloadTex()}}i.TextStyleTexture=T;i.CachedTextureManager=class{constructor(e){this._TextureManager=e,this._Renderer=e.GetRenderer(),this._CachedTextureStack=[],this._LockedTextureStack=[],this._MemoryLimited=10485760,this._VisibleMark=1}SetMemoryLimited(e){this._MemoryLimited=1024*e*1024}_FindTexture(e,t,i){for(let s=this._CachedTextureStack.length-1;s>=0;s--){const n=this._CachedTextureStack[s];if(n.Source===e&&(t===n.TargetSize||null!==t&&t.Equals(n.TargetSize))&&i===n.ColorSpace){if(null===n.RenderTexture)continue;return n}}return null}CacheTheTexture(e){for(let t=this._CachedTextureStack.length-1;t>=0;t--)if(e===this._CachedTextureStack[t])return;this._CachedTextureStack.push(e)}_MarkVisibleViewTextures(e,t){e.TextureSetting&&e.TextureSetting.Texture&&(e.TextureSetting.Texture.VisibleMark=t);const i=e.ChildViews.length;for(let s=0;s<i;s++){const i=e.ChildViews[s];i&&"VISIBLE"!==i.Visibility||this._MarkVisibleViewTextures(i,t)}}ReduceInvisibleTexture(e){this._MarkVisibleViewTextures(e,++this._VisibleMark);for(let e=0;e<this._CachedTextureStack.length;e++){const t=this._CachedTextureStack[e];t.VisibleMark!==this._VisibleMark&&(t.UnloadTex(),this._CachedTextureStack.splice(e,1),e--)}}GetCacheSize(){return this._CachedTextureStack.length}};const S=new Map;let C=0;const E=new Map;let x=0;class I{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=I.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(e,t,i){return this.GetImage(e,t,i)}GetImage(e,t,s){if(!e)return i.LogI("GetImage, url is null!"),null;return this._GetImageInternal(e,null,i.ColorSpace.RGBA_8888,t,!1,s)}GetImage2(e,t,s,n,r){if(!e)return i.LogI("GetImage2, url is null!"),null;const a=i.sRectUitls.FormatRectArea(s);"string"!=typeof n&&(n=e.indexOf(".pkm")>=0?e.indexOf(".pkma")>=0?i.ColorSpace.RGBA_ETC1:i.ColorSpace.RGB_ETC1:i.ColorSpace.RGB_565);return this._GetImageInternal(e,a,n,t,!1,r)}_GetImageInternal(e,t,s,n,r,a){if(n){const i=this._ForeverCachedTextureManager._FindTexture(e,t,s);if(i)return i}else{const i=this.CachedTextureManager._FindTexture(e,t,s);if(i)return i}const o=new i.UrlImageTexture(this,e,n,t,s,a);return o.IsForever?this._ForeverCachedTextureManager.CacheTheTexture(o):this.CachedTextureManager.CacheTheTexture(o),o}GetRoundCornerMask(e,t){return this.GetCustomCornerMask(e,t,t,t,t)}GetCustomCornerMask(e,t,s,n,r){const a=i.sRectUitls.FormatRectArea(e),o=Math.max(t,s,n,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:t,RT:s,LB:n,RB:r};const h=new i.ImageTexture(this,l);return i.ForgeDebug.EnableTextureTracer&&h.SetTextureTracerDescript("CornerMask"),h}GetOneCornerMask(e){const t=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"OCM");t.Set={Rad:e};const s=new i.ImageTexture(this,t);return i.ForgeDebug.EnableTextureTracer&&s.SetTextureTracerDescript("OneCornerMask"),s}GetTextTextureFromStylePack(e,t,s,n,r,a,o,l,h,c){return e&&0!==e.length?new i.TextStyleTexture(this,e,t,s,n,r,a,o,l,h,c):null}_getParamsId(e,t,i){const s=e.font,n=e.size,r=e.italic,a=e.bold,o=e.alignment,l=e.vertical_align,h=e.vertical_area_align,c=e.textColour,u=e.backgroundColour,d=e.shadow;let f="";e.stroke_width&&(f=e.stroke_width);const g=t.text_overflow,m=t.word_wrap,_=[s,r,a,d,f].join(":"),p=[n,o,l,h,g,m].join(":");let w="",v="";return S.has(_)?w=S.get(_):(w=`TS${C}`,S.set(_,w),C++),E.has(p)?v=E.get(p):(v=`DS${x}`,E.set(p,v),x++),[w,v,c,u]}GetTextTextureByMultiRows(e,t,s,n,r,a,o,l,h){const c=e.str;if(null===c||0===c.length)return null;const u=i.sRenderBridge.GetScreenInfo().scaleRatio,d=Object.assign(s);d.x*=u,d.y*=u,d.width*=u,d.height*=u;const f=Object.assign(e);f.size=Math.ceil(f.size*u),n*=u;const g={ST:e.str,AT:JSON.stringify({TO:t.text_overflow,WW:t.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(n+.5,10),ILD:void 0!==o?o:1};if(a&&(g.SH=JSON.stringify({T:a.Type,P:a.Params})),void 0!==window.JsView&&void 0!==window.JsView.ForgeNativeRevision&&window.JsView.ForgeNativeRevision>0){const e=this._getParamsId(f,t,a);g.PI={FS:e[0],DS:e[1],TC:e[2],BC:e[3]}}const m=this._BuildTextTextureAndSerialStatus(g,f);if(null!==h){const e=Object.assign({},g);e.ST=null,e.TLC=0,h.Set=e,h.Swf=Object.assign({},f)}let _=d.height;if(void 0!==window.PlatformUtils&&!1===r){_=window.PlatformUtils.GetTextRect(c,d,f,t,n).height}if(_=Math.floor(_/u+.5),i.ForgeDebug.EnableTextureTracer){let t=e.str;t.length>8&&(t=`${e.str.substr(0,8)}...`),m.SetTextureTracerDescript(`[${t}]`)}return{texture:m,real_height:_}}GetCopiedTextTexture(e,t,s,n){const r=Object.assign({},s.Set);r.ST=e,r.TLC=void 0!==n&&n?1:0;const a=s.Swf,o=i.sRenderBridge.GetScreenInfo().scaleRatio;r.RA=JSON.stringify({X:parseInt(t.x*o+.5,10),Y:parseInt(t.y*o+.5,10),W:parseInt(t.width*o+.5,10),H:parseInt(t.height*o+.5,10)});const l=this._BuildTextTextureAndSerialStatus(r,a);if(i.ForgeDebug.EnableTextureTracer&&e){let t=e;t.length>8&&(t=`${e.substr(0,8)}...`),l.SetTextureTracerDescript(`[${t}]`)}return l}_BuildTextTextureAndSerialStatus(e,t){i.sRenderTextureDelegateManager.AppendFontStatusIfNeed(e,t);let s=null;e.FO&&(s={STA:{Nam:"T",Sta:e.FO}});const n=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"T");return n.Set=e,new i.ImageTexture(this,n,s)}GetColorTexture(e){const t=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CT");t.Set={Clr:e};const s=new i.ImageTexture(this,t);return i.ForgeDebug.EnableTextureTracer&&s.SetTextureTracerDescript(`Color[${e}]`),s}ScavengerCached(){this.CachedTextureManager.GetCacheSize()>=this._CacheMaxSize&&this.CachedTextureManager.ReduceInvisibleTexture(i.sRootView)}GetOffScreenMediaTexture(e){if(void 0===window.OffscreenVideoPlayer||!(e instanceof window.OffscreenVideoPlayer))return null;if(!e.hasTerminator()){const t=this._BuildVideoTexture(e);e.setResourceTerminator((()=>{t.UnloadTex()}))}return this._BuildVideoTexture(e)}_BuildVideoTexture(e){const t=i.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"VPLY");t.Set={Hdl:e.mediaHandler()};const s=new i.ImageTexture(this,t);return i.ForgeDebug.EnableTextureTracer&&s.SetTextureTracerDescript(`Video[${e.mediaHandler()}]`),s}}I.sTextureManagerToken=100,i.TextureManager=I,window.TextureManager=i.TextureManager;i.LayoutViewDebugClass=class{SetTextureTracer(e){}GetTextureTracer(){return null}},i.ForgeDebug=new i.LayoutViewDebugClass,window.ForgeDebug=i.ForgeDebug;class A{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(e,t,i){this.MarginTop=t,this.MarginLeft=e,i&&(this.Z=i)}SetSize(e,t){this.Width=e,this.Height=t}Clone(){const e=new A(null);return e.Width=this.Width,e.Height=this.Height,e.MarginTop=this.MarginTop,e.MarginLeft=this.MarginLeft,e.MarginRight=this.MarginRight,e.MarginBottom=this.MarginBottom,e.Z=this.Z,e.SizeAdjust=this.SizeAdjust,e}Equals(e){return e.Width===this.Width&&e.Height===this.Height&&e.MarginTop===this.MarginTop&&e.MarginLeft===this.MarginLeft&&e.MarginRight===this.MarginRight&&e.MarginBottom===this.MarginBottom&&e.Z===this.Z}}i.LayoutParamsBase=A;class R extends i.LayoutParamsBase{constructor(e){super(),e instanceof i.RectArea&&(e={x:e.x,y:e.y,width:e.width,height:e.height}),e&&(e.x?this.MarginLeft=e.x:e.marginLeft&&(this.MarginLeft=e.marginLeft),e.y?this.MarginTop=e.y:e.marginTop&&(this.MarginTop=e.marginTop),e.z&&(this.Z=e.z),e.width&&(this.Width=e.width),e.height&&(this.Height=e.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=R,window.LayoutParams=i.LayoutParams;i.RenderTextureDelegateManager=class{constructor(){this._IdTokenGenerator=66,i.sRenderTextureDelegateManager=this,this._CheckExpiredTime=0}CreateTextureHeadStatus(){const e=new i.RenderTextureDelegate(this,0);return e.DoRef(),e}CreateTextureStatus(){const e=new i.RenderTextureDelegate(this,0);return e.DoRef(),e}CreateTexture(){const e=new i.RenderTextureDelegate(this,this._IdTokenGenerator++);return e.DoRef(),e}RecycleTexture(e){}CreateResourceInfo(e,t){return{Id:0,Nam:t,Set:null,TmId:e,NdLd:0}}AppendFontStatusIfNeed(e,t){const i={};i.Fo=t.font,i.Si=t.size,i.It=t.italic,i.Bo=t.bold,i.Al=t.alignment,i.Ve=t.vertical_align,i.Vaa=t.vertical_area_align,i.Tx=t.textColour,i.Ba=t.backgroundColour,i.En=t.enableBlend,i.Sh=t.shadow,t.stroke_width?i.Stk=t.stroke_width:i.Stk=-1,e.FO=JSON.stringify(i)}},i.sRenderTextureDelegateManager=new i.RenderTextureDelegateManager;i.RenderTextureDelegate=class{constructor(e,t){this.IdToken=t,this._Manager=e,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 e=new Error;this.Stack=e.stack}}DoRef(){this._Reference++}UndoRef(){this._Reference--,0===this._Reference&&(this._OnloadCallbacksSize>0&&(this._OnloadCallbacks={}),this._Manager.RecycleTexture(this))}SetResourceInfo(e){e.Id=this.IdToken,this._SyncingResourceInfo=e}GetResourceInfo(){return this._SyncingResourceInfo}ReadSyncInfo(){const e=this._SyncingResourceInfo;return this._SyncingResourceInfo=null,e}RegisterOnloadCallback(e){const t=this._OnloadCallbackIdGenerator++;return this._OnloadCallbacks[`${t}`]=e,this._OnloadCallbacksSize++,null!==this._SyncingResourceInfo&&(this._SyncingResourceInfo.NdLd=1),t}UnregisterOnloadCallback(e){delete this._OnloadCallbacks[`${e}`],this._OnloadCallbacksSize--}InvokeOnloadCallbacks(){if(this._OnloadCallbacksSize>0)for(const e in this._OnloadCallbacks)this._OnloadCallbacks.hasOwnProperty(e)&&this._OnloadCallbacks[e]()}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}};i.DeprecatedRenderer=class{constructor(){i.sDeprecatedRenderer=this,this._SharedTextureManager=this.CreateTextureManager()}SetUserId(e){i.sRenderBridge.UpdateUserId(e)}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(e,t,s,n){return new i.RectArea(e,t,s,n)}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 P={STRING:Symbol("STRING"),FUNCTION:Symbol("FUNCTION"),LINE_FEED:Symbol("LINE_FEED"),LEFT_BRACE:Symbol("LEFT_BRACE"),RIGHT_BRACE:Symbol("RIGHT_BRACE")};const O={},L={BASE:Symbol("BASE"),COLOR:Symbol("COLOR"),BOLD:Symbol("BOLD"),ITALIC:Symbol("ITALIC"),DECORATION:Symbol("DECORATION"),SUPERSCRIPT:Symbol("SUPERSCRIPT"),SUBSCRIPT:Symbol("SUBSCRIPT")};class D{constructor(){this.style,this.styleValue=""}}class k{constructor(){this.textStyle=new D,this.childNodes=[],this.parent}}class M extends k{constructor(){super(),this.styleList=[],this.indexPair,this.lineFeedNode=!1,this.testValue}}function F(e){if(null===e||0===e.length)return null;const t=function(e){const t=[];let i=0;for(;i<e.length;)if("\\"===e[i])if(i<e.length-1)if("\\"===e[i+1]||"{"===e[i+1]||"}"===e[i+1]){const e={type:P.STRING,indexPair:[i+1,i+2]};t.push(e),i+=2}else{++i;const s=i;let n=i,r=!1;for(;i<e.length&&"{"!==e[i]&&"}"!==e[i];)" "!==e[i]&&(r=!0)," "===e[i]&&r?++i:n=++i;const a={type:P.FUNCTION,indexPair:[s,n]};t.push(a)}else console.error("backslash at end.");else if("{"===e[i]){const e={type:P.LEFT_BRACE,indexPair:null};t.push(e),++i}else if("}"===e[i]){const e={type:P.RIGHT_BRACE,indexPair:null};t.push(e),++i}else if("\n"===e[i]){const e={type:P.LINE_FEED,indexPair:null};t.push(e),++i}else{const s=i;let n=i;for(;i<e.length&&"\\"!==e[i]&&"{"!==e[i]&&"}"!==e[i]&&"\n"!==e[i];)++i,n=i;const r={type:P.STRING,indexPair:[s,n]};t.push(r)}for(let i=t.length-1;i>=0;i--){const s=t[i];if(s.type===P.STRING){let n=!0;for(let t=s.indexPair[0];t<s.indexPair[1];t++)if(" "!==e[t]){n=!1;break}!(n&&i>0&&i<t.length-1)||t[i-1].type!==P.LEFT_BRACE&&t[i-1].type!==P.RIGHT_BRACE||t[i+1].type!==P.RIGHT_BRACE&&t[i+1].type!==P.LEFT_BRACE||t.splice(i,1)}}return t}(e),i=[],s=[];let n=0;for(;n<t.length;){const r=t[n];if(r.type===P.STRING){const e=new M;s.push(e),e.indexPair=r.indexPair,e.textStyle.style=L.BASE,i.push(e)}else if(r.type===P.LINE_FEED){const e=new M;s.push(e),e.lineFeedNode=!0}else if(r.type===P.LEFT_BRACE)i.push(O);else if(r.type===P.RIGHT_BRACE)if(i.length>0){const e=[];let t=i.pop();for(;t!==O&&(e.push(t),i.length>0);)t=i.pop();if(i.length>0){const t=i[i.length-1];if(t.textStyle.style===L.BASE)console.error("lack of function");else for(;e.length>0;){const i=e.pop();t.childNodes.push(i),i.parent=t}}else console.error("lack of function")}else console.error("extra }");else if(r.type===P.FUNCTION){const s=e.substring(r.indexPair[0],r.indexPair[1]),a=new k;switch(s){case"textcolor":if(n<t.length-3){a.textStyle.style=L.COLOR;const i=t[n+1],s=t[n+2],r=t[n+3];i.type===P.LEFT_BRACE&&s.type===P.STRING&&r.type===P.RIGHT_BRACE?(a.textStyle.styleValue=e.substring(s.indexPair[0],s.indexPair[1]),n+=3):console.error("textcolor param format error.")}else console.error("textcolor param format error.");break;case"textb":a.textStyle.style=L.BOLD;break;case"texti":a.textStyle.style=L.ITALIC;break;case"textdecoration":if(n<t.length-3){a.textStyle.style=L.DECORATION;const i=t[n+1],s=t[n+2],r=t[n+3];i.type===P.LEFT_BRACE&&s.type===P.STRING&&r.type===P.RIGHT_BRACE?(a.textStyle.styleValue=e.substring(s.indexPair[0],s.indexPair[1]),n+=3):console.error("textdecoration param format error.")}else console.error("textdecoration param format error.");break;case"textsup":a.textStyle.style=L.SUPERSCRIPT;break;case"textsub":a.textStyle.style=L.SUBSCRIPT;break;default:console.error(`undefined style type: ${s}`)}i.push(a)}++n}return s.forEach(((e,t,i)=>{let s=e.parent;for(;s;)e.styleList.push(s.textStyle),s=s.parent})),{nodeList:s,text:e}}function V(){this.positionQueue=[],this.timeQueue=[]}V.prototype.reset=function(){this.positionQueue=[],this.timeQueue=[]},V.prototype.pruneQueue=function(e){for(;this.timeQueue.length&&this.timeQueue[0]<Date.now()-e;)this.timeQueue.shift(),this.positionQueue.shift()},V.prototype.updatePosition=function(e){this.positionQueue.push(e),this.timeQueue.push(Date.now()),this.pruneQueue(50)},V.prototype.getVelocity=function(){this.pruneQueue(1e3);const e=this.timeQueue.length;if(e<2)return 0;const t=(this.timeQueue[e-1]-this.timeQueue[0])/1e3,i=this.positionQueue[e-1]-this.positionQueue[0];return console.log(`getVelocity distance:${i}, time:${t}, velocity:${i/t}, this.timeQueue[length-1]:${this.timeQueue[e-1]}, this.timeQueue[0]:${this.timeQueue[0]}`),i/t};class j{constructor(e,t){this.set(e,t)}add(e,t){return e instanceof j?(this.x+=e.x,this.y+=e.y):(this.x+=e||0,this.y+=t||0),this}angle(e){if(void 0!==e)return this.set(this.length(),0).rotate(e);let t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t}angleDeg(e){return void 0!==e?this.angle(e/180*Math.PI):180*this.angle()/Math.PI}clone(){return new j(this.x,this.y)}cross(e,t){return e instanceof j?this.x*e.y-this.y*e.x:this.x*t-this.y*e}distance(e,t){const i=this.distanceSq(e,t);if(void 0!==i)return Math.sqrt(i)}distanceSq(e,t){let i,s;if(e instanceof j)i=e.x-this.x,s=e.y-this.y;else{if(void 0===t)return;i=e-this.x,s=t-this.y}return i*i+s*s}dot(e,t){return e instanceof j?this.x*e.x+this.y*e.y:this.x*e+this.y*t}equals(e,t,i){return e instanceof j?(t=t||0,Math.abs(this.x-e.x)<=t&&Math.abs(this.y-e.y)<=t):void 0!==t&&(i=i||0,Math.abs(this.x-e)<=i&&Math.abs(this.y-t)<=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(e){const t=Math.cos(e),i=Math.sin(e);return this.set(this.x*t-this.y*i,this.x*i+this.y*t)}rotateDeg(e){return this.rotate(e/180*Math.PI)}scale(e,t){return this.x*=e,this.y*=t||e,this}set(e,t){return e instanceof j?(this.x=e.x,this.y=e.y):(this.x=e||0,this.y=t||0),this}setPolar(e,t){return this.set(t,0).rotate(e)}setPolarDeg(e,t){return this.setPolar(e/180*Math.PI,t)}sub(e,t){return void 0!==t?(this.x-=e,this.y-=t):(this.x-=e.x,this.y-=e.y),this}toString(){return`(${this.x}, ${this.y})`}}function N(e,t,i){return i=i||0,Math.abs(e-t)<Math.abs(i)}const G={isEqual:N,isZero:(e,t)=>N(e,0,t),clamp:(e,t,i)=>e>t?e<i?e:i:t},B=G.isZero,U=G.clamp,W=new j(0,0);function H(e){return"[object Array]"===Object.prototype.toString.call(e)}function $(e){if(!H(e))throw new Error("Polygon must be an array of points");switch(typeof e[0]){case"number":{if(e.length%2!=0)throw new Error("Polygon that contains array of numbers must has even length ([x0, y0, x1, y1, ...., xn, yn])");const t=[];for(let i=0;i<e.length;i+=2)t.push(new j(e[i],e[i+1]));return t}case"object":return e.map(H(e[0])?e=>new j(e[0],e[1]):e=>new j(e.x,e.y));default:throw new Error("Passed polygon is not an array of 2D coordinates")}}function K(e){if(1===e.length)return new j(e[0]);const t=new j(0,0);e.forEach((e=>t.add(e))),t.scale(1/e.length);const i=new j;let s=0;return e.forEach(((n,r)=>{const a=new j(n),o=new j(r+1===e.length?e[0]:e[r+1]);a.add(-t.x,-t.y),o.add(-t.x,-t.y);const l=.5*a.cross(o);s+=l,i.add(a.add(o).scale(.3333333333333333).scale(l))})),B(s,1e-4)?i.set(e[0]):i.scale(1/s).add(t)}function Y(e,t){let i=e[0],s=t.dot(e[0]),n=0;for(let r=1;r<e.length;r++)n=t.dot(e[r]),n>s&&(s=n,i=e[r]);return new j(i)}function z(e,t,i){const s=Y(e,i),n=Y(t,i.negate());return new j(s.sub(n))}function X(e,t){const i=new j(0,0),s=new j(e).negate(),n=new j(t).sub(e),r=n.dot(n);if(B(r,1e-4))return i.set(e);let a=s.dot(n)/r;return a=U(a,0,1),i.set(n.scale(a).add(e))}function J(e,t){e=$(e),t=$(t);const i=K(e),s=K(t).add(i.negate());let n,r,a;n=z(e,t,s),r=z(e,t,s.negate());for(let i=0;i<30;i++){const i=X(n,r);if(B(i.length(),1e-4))return 0;s.set(i.negate().normalize()),a=z(e,t,s);const o=a.dot(s),l=n.dot(s);if(B(o-l,1e-4))return o;n.distanceSq(W)<r.distanceSq(W)?r=a:n=a}return 0}const q={intersect:(e,t)=>B(J(e,t),1e-4),distance:J};class Z{constructor(e,t,i){this.element=i,this.row=e,this.column=t}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(e){if(this.column!==e.row)throw new Error("matrix multiply error");const t=[];for(let i=0;i<this.row;i++)for(let s=0;s<e.column;s++){t[i+s*e.column]=0;for(let n=0;n<this.column;n++)t[i+s*e.column]+=this.element[i+n*this.column]*e.element[n+s*e.column]}return new Z(this.row,e.column,t)}static identity(){return new Z(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static translate(e,t,i){return new Z(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1])}static scale(e,t,i){return new Z(4,4,[e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1])}static rotate(e,t,i,s){const n=Math.cos(s/180*Math.PI),r=Math.sin(s/180*Math.PI),a=Math.sqrt(e*e+t*t+i*i);if(1!==a){const s=1/a;e*=s,t*=s,i*=s}const o=1-n,l=e*t,h=t*i,c=i*e,u=e*r,d=t*r,f=i*r,g=[];return g[0]=e*e*o+n,g[1]=l*o+f,g[2]=c*o-d,g[3]=0,g[4]=l*o-f,g[5]=t*t*o+n,g[6]=h*o+u,g[7]=0,g[8]=c*o+d,g[9]=h*o-u,g[10]=i*i*o+n,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,new Z(4,4,g)}static skew(e,t){const i=new Array(16).fill(0),s=2*Math.PI*(t/360),n=-2*Math.PI*(e/360);return i[0]=1-n*s,i[1]=-Math.tan(s),i[4]=Math.tan(n),i[5]=1,i[10]=1,i[15]=1,new Z(4,4,i)}static transform2d(e,t,i,s,n,r){return new Z(4,4,[e,t,0,0,i,s,0,0,0,0,1,0,n,r,0,1])}}const Q=e=>e>=65&&e<=90||e>=97&&e<=122,ee=e=>e>=48&&e<=57,te=(e,t)=>{switch(e){case"translate3d":return Z.translate(t[0],t[1],t[2]);case"scale3d":return Z.scale(t[0],t[1],t[2]);case"rotate3d":return Z.rotate(t[0],t[1],t[2],t[3]);case"skew":return Z.skew(t[0],t[1]);case"matrix":return Z.transform2d(t[0],t[1],t[2],t[3],t[4],t[5]);case"matrix3d":return new Z(4,4,t);default:throw new Error(`no support type ${e}`)}},ie=e=>{let t=Z.identity();if(!e)return t;let i="",s="",n=[],r=0;for(let a=0;a<e.length;a++){const o=e.charCodeAt(a);0===r?(Q(o)||ee(o))&&(i+=e[a]):(ee(o)||46===o||45===o||101===o)&&(s+=e[a]),40===o?(r=1,s="",n=[]):41===o?(n.push(parseFloat(s)),t=t.multiply(te(i,n)),i="",r=0):44===o&&(n.push(parseFloat(s)),s="")}return t},se=e=>{if(e.indexOf(" ")>=0){return e.split(" ").map((e=>parseInt(e.substr(0,e.length-2),10)))}return parseInt(e.substr(0,e.length-2),10)},ne=e=>{let t=e;const i=se(t.style.width),s=se(t.style.height);let n=Z.identity();for(;t.parentElement;){const e=getComputedStyle(t),i=e.transform?e.transform:e.webkitTransform;if(i){const s=e.transformOrigin?e.transformOrigin:e.webkitTransformOrigin,r=ie(i);if(s){const e=se(s),i=Z.translate(-e[0],-e[1],0),a=Z.translate(e[0],e[1],0);n=Z.translate(t.offsetLeft,t.offsetTop,0).multiply(a.multiply(r.multiply(i.multiply(n))))}else n=r.multiply(n)}t=t.parentElement}const r=new Z(4,4,[0,0,0,1,i,0,0,1,0,s,0,1,i,s,0,1]);n=n.multiply(r);const a=n.element;return[a[0],a[1],a[4],a[5],a[8],a[9],a[12],a[13]]};class re{constructor(e,t,i){this._Id=oe++,this._Element1=e,this._Element2=t,this._Callback=i,this._Contacted=!1,this._Recycled=!1}Recycle(){this._Recycled=!0,this._Callback=null,this._Element1=null,this._Element2=null}TestCollision(){}}class ae extends re{TestCollision(){if(this._Recycled)return;q.intersect(ne(this._Element1),ne(this._Element2))?this._Contacted||(this._Contacted=!0,this._Callback&&this._Callback.OnBeginContact&&this._Callback.OnBeginContact()):this._Contacted&&(this._Callback&&this._Callback.OnEndContact&&this._Callback.OnEndContact(),this._Contacted=!1)}}let oe=0;i.DragImpactSensor=class extends re{TestCollision(){if(this._Recycled)return;const e=ne(this._Element2),t=q.intersect(this._Element1.slice(0,1),e),i=q.intersect(this._Element1.slice(1,2),e),s=q.intersect(this._Element1.slice(2,3),e),n=q.intersect(this._Element1.slice(3,4),e);t&&i&&s&&n?this._Contacted&&(this._Callback&&this._Callback.OnEndContact&&this._Callback.OnEndContact(),this._Contacted=!1):this._Contacted||(this._Contacted=!0,this._Callback&&this._Callback.OnBeginContact&&this._Callback.OnBeginContact({x:e[0],y:e[1]}))}},i.ElementImpactSensor=re,i.sElementImpactSensorManager=new class{constructor(){this._SensorMap={},this._SensorCount=0}TestCollision(){for(const e in this._SensorMap)this._SensorMap[e]._Recycled?(delete this._SensorMap[e],this._SensorCount--):this._SensorMap[e].TestCollision()}HasTrace(){return 0!==this._SensorCount}AddImpactSensor(e){return this._SensorMap[oe]=e,this._SensorCount++,i.sRenderBridge.BeginHtmlFrameLoop(),e}},i.sImpactSensorManager=new class{StartTrace(e,t,s){const n=new ae(e.Element,t.Element,s);return i.sElementImpactSensorManager.AddImpactSensor(n),n}},i.sImpactSensorManager.Callback=class{constructor(e,t){this.OnBeginContact=e,this.OnEndContact=t}},i.sImpactSensorManager.AutoFroze=class{constructor(e,t){this._PreImpactViews=e,this._OnImpactViews=t}UpdatePreImpactList(e){this._PreImpactViews=e}UpdateOnImpactList(e){this._OnImpactViews=e}},window.gRootView=null,i.sRootView=null;i.TextureSetting=class{constructor(e,t,s,n){this.Texture=e,this._IsTextureExternal=!1,t instanceof i.ImageTexture?(t&&t.RenderTexture&&t.RenderTexture.NeedCheckExpired&&(t.RenderTexture.RequireTime=0),this.MaskSetting=new i.ViewTextureMask(t)):this.MaskSetting=t,e&&e.RenderTexture&&e.RenderTexture.NeedCheckExpired&&(e.RenderTexture.RequireTime=0),this._IsMaskTextureExternal=!1,this.TextureBeforeImageLoad=s,this._IsPreloadImageTextureExternal=!1,void 0===n&&(n=!0),this.HasAlpha=n}SetExternal(e,t,i){this._IsTextureExternal=e,this._IsMaskTextureExternal=t,this._IsPreloadImageTextureExternal=i}ReleaseInternalTexture(e,t){!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 le extends i.TextureSetting{constructor(e,t,i,s){super(e,t,i,s),this.SetExternal(!0,!0,!0)}}i.ExternalTextureSetting=le,window.ExternalTextureSetting=i.ExternalTextureSetting;i.PackedLayout=class{constructor(e){const t=e.RectInfo;this.RectInfo={coordX:t.coordX,coordY:t.coordY,width:t.width,height:t.height},this.LayoutParams=JSON.parse(JSON.stringify(e.LayoutParams))}ApplyToView(e){const t=this.RectInfo;e.RectInfo={coordX:t.coordX,coordY:t.coordY,width:t.width,height:t.height},e.LayoutParams=JSON.parse(JSON.stringify(this.LayoutParams))}};i.ViewMask=class{constructor(){this._MaskType="COMMON"}Type(){return this._MaskType}UnLoad(){}};class he extends i.ViewMask{constructor(e){super(),this._MaskType="TEXTURE",this.ImageTexture=e}UnLoad(){this.ImageTexture.UnloadTex()}}i.ViewTextureMask=he;class ce extends i.ViewMask{constructor(e,t,i,s){super(),this._MaskType="CORNER",this._TopLeft=e,this._TopRight=isNaN(t)?e:t,this._BottomLeft=isNaN(i)?e:i,this._BottomRight=isNaN(s)?e:s,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=ce;i.DragSetting=class{constructor(e,t,s,n,r,a){this.DragDirection=e||0,this.TriggerMovedDistance=t||0,this._EnableJsFling=s?1:0,this.SlidePile=n||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(e){this.Listener=e}},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 ue=0;class de{constructor(e,t){this.TextureSetting=e,e&&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=++ue,this.childZIndexCount=0,this._IsChildOfRootView=!1,this._DetachFromSystemCallback=null,this.Element=null,this.InnerChildElement=null,"root"===t?(this.Element=window.originDocument.getElementById(t),this.Element||(this.Element=window.originDocument.getElementById("app"))):"svg"===t||"path"===t?this.Element=document.createElementNS("http://www.w3.org/2000/svg",t):t&&(this.Element=window.originDocument.createElement(t),this.Element.style.position="absolute"),this.TransitionStore={},this.TransformAnimationObj=null,this._TextureAnimationObj=null,this._DragInfo=null,this.DragControl=null,this._Velocity={x:new V,y:new V},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(e){this.ResetTexture(e)}SetElementProp(e,t){e&&Object.keys(e).forEach((t=>{switch(t){case"jsv_enable_fade":case"jsv_poster_on_top":case"jsv_media_usetexture":case"jsv_text_definition":break;case"jsv_innerview":{const s=i.sViewStore.get(e[t]);if(s){const e=s.view,t=s.layout_params;e&&(null===this._ProxyView?this._InsertProxyLayer(e,t):e!==this._ProxyView&&console.error("Error: Can not reset proxy view"))}break}default:i.LogE(`Error: View Unknown prop name=${t}`)}}))}InsertView(e,t,i,s){this._InsertView(e,t,i,s)}AddView(e,t,i){this._InsertView(e,null,t,i)}_InsertView(e,t,s,n){if(s?s instanceof i.LayoutParamsBase?e.LayoutParams=s.Clone():e.LayoutParams=new i.LayoutParams(s):e.LayoutParams||(e.LayoutParams=new i.LayoutParams({x:0,y:0})),null!==e.LayoutParams&&(e.LayoutParams.MarginLeft&&(e.Element.style.left=`${e.LayoutParams.MarginLeft}px`),e.LayoutParams.MarginTop&&(e.Element.style.top=`${e.LayoutParams.MarginTop}px`),e.LayoutParams.Width&&(e.Element.style.width=`${e.LayoutParams.Width}px`),e.LayoutParams.Height?e.Element.style.height=`${e.LayoutParams.Height}px`:e.Element.style.height=""),e.ParentView=this,t){let i=this.ChildViews.indexOf(t);i<0&&(i=this.ChildViews.length),this.ChildViews.splice(i,0,e)}else this.ChildViews.push(e);this._ChildrenListDirty=!0,this._IsChildOfRootView&&e._OnAttachToSystem()}SetZIndex(e){this.Element.style.zIndex=e,this.zIndex=e}SetPerspective(e,t){this.Element.style.perspective=`${e}px`,this.Element.style.webkitPerspective=`${e}px`,this.Element.style.perspectiveOrigin=t,this.Element.style.webkitPerspectiveOrigin=t,this._Perspective=e,this._PerspectiveOrigin=t}SetBackfaceVisibility(e){console.log("set back face",e),this.Element.style.backfaceVisibility=e?"visible":"hidden",this.Element.style.webkitBackfaceVisibility=e?"visible":"hidden",console.log(`back face style ${this.Element.style.backfaceVisibility}`),this._BackfaceVisibility=e?1:0}SetTransformStyle(e){this.Element.style.transformStyle=e,this.Element.style.webkitTransformStyle=e,this._TransformStyle=e}EnableDivTouch(e,t){e.eventHandlers&&e.eventHandlers.onClick&&(this.Element.onclick=t=>{e.eventHandlers.onClick(),t.preventDefault&&t.preventDefault()},this.Element.style.pointerEvents="auto")}_DoDragPause(e){this._DragInfo.Settings.EnableTabMode||this.DragControl&&this.DragControl.pause(((t,i)=>{if(null!==this.Element.style.transform){let s=this.GetLayoutParams();s=this._GetMovedLayoutParams(t-s.MarginLeft,i-s.MarginTop),this.ResetLayoutParams(s),this._DragImactSensorRecycle(),console.log(`_DoDragPause lp.MarginLeft:${s.MarginLeft}, lp.MarginTop:${s.MarginTop}`),this.DragControl=null,this.Element.style.transform=null,e.viewX=t,e.viewY=i,this._DragInfo.Listener.OnFling(e)}}))}TouchEventProcess(e){let t=!1;switch(e.type){case i.DragInfo.EVENT_TYPE.OnDown:console.log("TouchEventProcess OnDown in"),this._DoDragPause(e),this._DragInfo.Listener&&this._DragInfo.Listener.OnDown&&(t=this._DragInfo.Listener.OnDown(e));break;case i.DragInfo.EVENT_TYPE.OnTap:this._DragInfo.Listener&&this._DragInfo.Listener.OnTap&&(t=this._DragInfo.Listener.OnTap(e));break;case i.DragInfo.EVENT_TYPE.OnLongPress:this._DragInfo.Listener&&this._DragInfo.Listener.OnLongPress&&(t=this._DragInfo.Listener.OnLongPress(e));break;case i.DragInfo.EVENT_TYPE.OnDragStart:this._DragMovedDistanceX=0,this._DragMovedDistanceY=0,this._DragInfo.Listener&&this._DragInfo.Listener.OnDragStart&&(t=this._DragInfo.Listener.OnDragStart(e));break;case i.DragInfo.EVENT_TYPE.OnMoved:this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved&&(t=this._DoDragMove(e,!0));break;case i.DragInfo.EVENT_TYPE.OnDragEnd:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnDragEnd){t=!!this._SlideIfEnableTabMod(e,-1)||this._DoDragEnd(e)}break;case i.DragInfo.EVENT_TYPE.OnRelease:this._DragInfo.Listener&&this._DragInfo.Listener.OnRelease&&(t=this._DragInfo.Listener.OnRelease(e));break;case i.DragInfo.EVENT_TYPE.OnFling:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnFling){t=!!this._SlideIfEnableTabMod(e,-1)||this._DoFling(e)}break;default:console.log(`TouchEventProcess:${e}`)}return t}DisableDrag(){this._DragInfo=null}EnableDrag(e,t,s){e instanceof i.DragSetting||i.ThrowError("EnableDrag The setting is not Forge.DragSetting"),null===t&&i.ThrowError("EnableDrag The listener is null");const n=new i.DragInfo;n.Settings=e,n.SetListener(t),n.Formula=s,this._DragInfo=n,this.DragControl=null,this._AddEventListener(),i.sRenderBridge.RequestSwap()}RemoveView(e){for(let t=0;t<this.ChildViews.length;t++)if(this.ChildViews[t]===e){e.IsChildOfRootView()&&e._OnDetachFromSystem(),this.ChildViews.splice(t,1),e.ParentView=null;break}}_OnDetachFromSystem(){this._IsChildOfRootView=!1,this._DetachFromSystemCallback?(this._DetachFromSystemCallback.some(((e,t,i)=>{e()})),this._DetachFromSystemCallback=null):this.OnDettachFromSystem();for(let e=0;e<this.ChildViews.length;e++){this.ChildViews[e]._OnDetachFromSystem()}this.ParentView.Element.removeChild(this.Element),this._releaseViewResources()}RegisterDetachCallback(e){e&&(null==this._DetachFromSystemCallback&&(this._DetachFromSystemCallback=[]),this._DetachFromSystemCallback.push(e))}UnregisterDetachCallback(e){if(e&&this._DetachFromSystemCallback){let t=!1,i=this._DetachFromSystemCallback;for(let s=0;s<i.length;s++)if(i[s]===e){i.splice(s,1),t=!0;break}t?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 e=this.ChildViews.length;if(0!==e){for(let t=0;t<e;t++){const e=this.ChildViews[t];e&&e.IsChildOfRootView()&&e._OnDetachFromSystem()}this.ChildViews=[]}}_ResetTextStyle(e){this.Element.style.overflow="hidden";let t=i.sTextStyleCache.GetDsFromId(e.Set.IDS.DS).Describe,s=i.sTextStyleCache.GetFsFromId(e.Set.IDS.FS).Describe,n=i.sTextStyleCache.GetCsFromId(e.Set.IDS.CS).Describe,r=null;"DISABLE"!==e.Set.IDS.SS&&(r=i.sTextStyleCache.GetSsFromId(e.Set.IDS.SS).Describe),this.Element.style.fontFamily=s.font,this.Element.style.fontSize=`${e.Set.FS}px`,s.italic&&(this.Element.style.fontStyle="italic"),s.bold?this.Element.style.fontWeight="bold":this.Element.style.fontWeight="normal",this.Element.style.textOverflow=t.text_overflow,this.Element.style.wordBreak="normal";let a=t.word_wrap;"none"===a?this.Element.style.whiteSpace="nowrap":a&&(this.Element.style.wordWrap=a.replace("_","-")),this.Element.style.textAlign=t.alignment,this.Element.style.verticalAlign=t.vertical_area_align;let o=n.text_color;o.startsWith("#")&&9===o.length&&(o="#"+o.substr(3,6)),this.Element.style.color=o;let l=n.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=`${e.Set.W}px`,this.Element.style.height=`${e.Set.H}px`,e.Set.LH&&(this.Element.style.lineHeight=`${e.Set.LH}px`),e.Set.EA){let t=e.Set.EA,i=window.originDocument.createElement("div");i.style.float=t.x>0?"right":"left",i.style.width=t.w+"px",i.style.height=t.h-1+"px",i.style.backgroundColor="rgba(0,0,0,0)",i.style.position="relative",this.Element.appendChild(i)}if(e.Set.LA){const t=F(e.Set.ST);!function(e,t){const i=t.text;for(const s of t.nodeList){if(s.lineFeedNode){e.appendChild(window.originDocument.createElement("br"));continue}const t=i.substring(s.indexPair[0],s.indexPair[1]),n=window.originDocument.createElement("span");let r,a=n;for(const e of s.styleList)switch(e.style){case L.BASE:break;case L.BOLD:r=window.originDocument.createElement("b"),a.appendChild(r),a=r;break;case L.ITALIC:r=window.originDocument.createElement("i"),a.appendChild(r),a=r;break;case L.COLOR:n.style.color=e.styleValue;break;case L.DECORATION:n.style.textDecoration=e.styleValue;break;case L.SUPERSCRIPT:r=window.originDocument.createElement("sup"),a.appendChild(r),a=r;break;case L.SUBSCRIPT:r=window.originDocument.createElement("sub"),a.appendChild(r),a=r}a.textContent=t,e.appendChild(n)}}(this.Element,t)}else{let t=window.originDocument.createElement("span");t.textContent=e.Set.ST,this.Element.appendChild(t)}}_SetBorderRadius(e){(this.InnerChildElement?this.InnerChildElement:this.Element).style.borderRadius=`${e._TopLeft}px ${e._TopRight}px ${e._BottomRight}px ${e._BottomLeft}px`}_InsertProxyLayer(e,t){if(e.ParentView=this,this._IsChildOfRootView){for(let e of this.ChildViews)e._AdvanceDepthForProxyLayer();e._OnAttachToSystem()}e.ChildViews=e.ChildViews.concat(this.ChildViews),e._ChildrenListDirty=!0;for(let t=0;t<e.ChildViews.length;t++)e.ChildViews[t].ParentView=e,e._RequestLayoutForAddingView(e.ChildViews[t]);null!==t?t instanceof i.LayoutParamsBase?e.LayoutParams=t.Clone():e.LayoutParams=new i.LayoutParams(t):null===e.LayoutParams&&(e.LayoutParams=new i.LayoutParams({x:0,y:0})),e.ResetLayoutParams(e.LayoutParams),this.ChildViews=[e],this._ChildrenListDirty=!0,this._RequestLayoutForAddingView(e),this._ProxyView=e,this._IsChildOfRootView&&e._OnAttachToSystem()}_RequestLayoutForAddingView(e){this._RequestLayout()}ResetTexture(e){if(this.TextureSetting=e,e){if(e.Texture.Source)"IMG"===this.Element.tagName?this.Element.src=e.Texture.Source:(this.Element.style.backgroundImage=`url(${e.Texture.Source})`,this.Element.style.backgroundSize="100% 100%");else if(e.Texture.RenderTexture&&e.Texture.RenderTexture._SyncingResourceInfo){const t=e.Texture.RenderTexture._SyncingResourceInfo;if("TST"===t.Nam)this._ResetTextStyle(t);else if("CT"===t.Nam)this.Element.style.backgroundColor=t.Set.Clr;else if("VPLY"===t.Nam){const e=t.Set.Hdl;e.style.width="100%",e.style.height="100%",e.style.objectFit="fill",this.Element.appendChild(e),this.InnerChildElement=e}}e.MaskSetting&&"CORNER"===e.MaskSetting._MaskType&&this._SetBorderRadius(e.MaskSetting)}}SetVisibility(e){this.Element.style.visibility="string"==typeof e?e.toLocaleLowerCase():"inherit"}_OnAttachToSystem(){"svg"!==this.Element.id&&"path"!==this.Element.id||console.log("_OnAttachToSystem appendChild");let e=this.ParentView.ChildViews[this.ParentView.ChildViews.indexOf(this)+1];e&&this.ParentView.Element.contains(e.Element)?this.ParentView.Element.insertBefore(this.Element,e.Element):this.ParentView.Element.appendChild(this.Element),this._IsChildOfRootView=!0;const t=this.ChildViews;let i;for(let e=0;e<t.length;e++)i=t[e],i._OnAttachToSystem()}IsChildOfRootView(){return this._IsChildOfRootView}StartAnimation(e,t,i){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(e),this.TransformAnimationObj=null,window.jsvInAndroidWebView?this.Element.style.webkitAnimation=null:this.Element.style.animation=null),this.TransformAnimationObj=e,!isNaN(i)&&i>0&&e.EnableDelay(i),e.Start(this)}ApplyStyleTransition(e){this.TransitionStore={...this.TransitionStore,...e};let t="";Object.values(this.TransitionStore).forEach((e=>{t&&(t+=","),t+=e})),window.jsvInAndroidWebView?this.Element.style.webkitTransition=t:this.Element.style.transition=t}StopAnimation(){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(),this.TransformAnimationObj=null)}StartTextureAnimation(e){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(e),this._TextureAnimationObj=null),this._TextureAnimationObj=e,e.AsTextureAnimation(),e.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 e=0;e<this.ChildViews.length;e++)this.ChildViews[e].StopAllAnimations()}GetAnimation(){return this.TransformAnimationObj}DetachAnimation(e){this.TransformAnimationObj===e&&(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(e,t){e===this._CssTransform&&t===this._CssTransformOrigin||(window.jsvInAndroidWebView?(this.Element.style.webkitTransform=e,this.Element.style.webkitTransformOrigin=t):(this.Element.style.transform=e,this.Element.style.transformOrigin=t),this._CssTransform=e,this._CssTransformOrigin=t)}ResetTextureCssTransform(e,t){this.ResetCssTransform(e,t)}SetId(e){this.Id=e}ResetLayoutParams(e){null!==e?(e instanceof i.LayoutParamsBase?this.LayoutParams=e.Clone():this.LayoutParams=new i.LayoutParams(e),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")}GetRenderer(){return i.LayoutViewBase.sRenderer}GetLayoutParams(){return this.LayoutParams?this.LayoutParams.Clone():new i.LayoutParams}EnableAutoHeight(){this._AutoHeight=!0}WaitTextureToResize(e){}ApplyObjectFit(e,t,i,s,n,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===e&&a.objectFit===n&&a.frameHeight===t&&a.textureWidth===i&&a.textureHeight===s)return a.clipLayout;const o={x:0,y:0,width:e,height:t,overflow:!1};a.frameWidth=e,a.frameHeight=t,a.textureWidth=i,a.textureHeight=s,a.objectFit=n,a.clipLayout=o;let l={width:0,height:0},h=e/t;const c=i/s;if(!c)return console.warn("Warning:Texture size is 0!"),o;if(0===e||0===t){if(0===e&&0===t)return o;0===e?e=t*c:t=e/c,h=e/t}let u="";switch(n){case r.FILL:l.width=e,l.height=t,u="fill";break;case r.NONE:l.width=i,l.height=s,u="none";break;case r.COVER:l=this._StretchSize(e,t,c,c<h),u="cover";break;case r.SCALEDOWN:{let n=c>h;e>i&&t>s&&(n=c<h),l=this._StretchSize(e,t,c,n),u="scaledown";break}case r.CONTAIN:l=this._StretchSize(e,t,c,c>h),u="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,e),o.height=Math.min(l.height,t),o.x=Math.floor((e-o.width)/2),o.y=Math.floor((t-o.height)/2),o.overflow=l.width>e||l.height>t;const d=this.InnerChildElement?this.InnerChildElement:this.Element;return d.style.width=`${e}px`,d.style.height=`${t}px`,d.style.objectFit=u,o}_StretchSize(e,t,i,s){const n={width:0,height:0};return s?(n.width=e,n.height=e/i):(n.height=t,n.width=t*i),n}GetPositionOffset(e){let t=this,s=0,n=0;for(;e!==t;)s+=t.LayoutParams?t.LayoutParams.MarginLeft:0,n+=t.LayoutParams?t.LayoutParams.MarginTop:0,t=t.ParentView,t||i.ThrowError("ERROR: Target parent layoutview is not found in LayoutView tree");return new i.Coordinate(s,n)}_dispatchLongPress(){this._LongPressDelayRequestTaskId=0,this._InLongPress=!0;const e={type:i.DragInfo.EVENT_TYPE.OnLongPress,x:this._CurrentDownEvent.designX,y:this._CurrentDownEvent.designY};this.TouchEventProcess(e)}_onMouseDown(e,t,s){this._Velocity.x.reset(),this._Velocity.y.reset(),this._Velocity.x.updatePosition(e),this._Velocity.y.updatePosition(t),this._LastFocusX=e,this._DownFocusX=this._LastFocusX,this._LastFocusY=t,this._DownFocusY=this._LastFocusY,this._CurrentDownEvent={designX:e,designY:t,timeStamp:s},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:e,y:t,deltaX:0,deltaY:0}}_onMouseMove(e,t,s){if(!this._CurrentDownEvent)return null;this._Velocity.x.updatePosition(e),this._Velocity.y.updatePosition(t);const n=parseInt(e-this._LastFocusX,10),r=parseInt(t-this._LastFocusY,10),a=parseInt(e-this._DownFocusX,10),o=parseInt(t-this._DownFocusY,10);let l=null;if(this._AlwaysInTapRegion){a*a+o*o>this._TouchSlopSquare&&(l={type:i.DragInfo.EVENT_TYPE.OnDragStart,x:e,y:t},this._LastFocusX=e,this._LastFocusY=t,this._LastTimeStamp=s,this._AlwaysInTapRegion=!1,this._InLongPress=!1,this._InDragging=!0,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0))}else this._InDragging&&(Math.abs(n)>=1||Math.abs(r)>=1)&&(l={type:i.DragInfo.EVENT_TYPE.OnMoved,x:e,y:t,deltaX:a,deltaY:o,_deltaX:n,_deltaY:r,timeStamp:parseInt((this._LastTimeStamp-s)/1e3,10)},this._LastFocusX=e,this._LastFocusY=t,this._LastTimeStamp=s);return l}_onMouseUp(e,t,s){let n=null;if(this._CurrentDownEvent){const s=window.Forge.DesignMap(),r=Math.floor(s.displayScale*s.width),a=window.innerWidth/r,o=this._Velocity.x.getVelocity()/a,l=this._Velocity.y.getVelocity()/a;let h=e-this._CurrentDownEvent.designX,c=t-this._CurrentDownEvent.designY;const u=e-this._LastFocusX,d=t-this._LastFocusY;this._InLongPress||(this._AlwaysInTapRegion?n={type:i.DragInfo.EVENT_TYPE.OnTap,x:e,y:t,velocityX:0,velocityY:0,deltaX:h,deltaY:c,_deltaX:u,_deltaY:d}:(Math.abs(l)>70||Math.abs(o)>70?(h=this._GetSplineFlingDistance(o),c=this._GetSplineFlingDistance(l),n={type:i.DragInfo.EVENT_TYPE.OnFling,x:e,y:t,velocityX:o,velocityY:l,deltaX:o<0?-h:h,deltaY:l<0?-c:c,_deltaX:u,_deltaY:d}):n={type:i.DragInfo.EVENT_TYPE.OnDragEnd,x:e,y:t,deltaX:h,deltaY:c,_deltaX:u,_deltaY:d},this.TouchEventProcess(n),n={type:i.DragInfo.EVENT_TYPE.OnRelease,x:e,y:t,deltaX:h,deltaY:c,_deltaX:u,_deltaY:d},this._CurrentDownEvent=null)),this._InLongPress=!1,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0)}return n}_onTouchEvent(e){const t=window.Forge.DesignMap(),i=Math.floor(t.displayScale*t.width),s=window.innerWidth/i,n=e.clientX/s,r=e.clientY/s;let a=null;switch(e.type){case"touchstart":case"mousedown":a=this._onMouseDown(n,r,e.timeStamp);break;case"touchmove":case"mousemove":a=this._onMouseMove(n,r,e.timeStamp);break;case"touchend":case"touchcancel":case"mouseup":a=this._onMouseUp(n,r,e.timeStamp)}return!!a&&this.TouchEventProcess(a)}_AddEventListener(){this.Element.style.pointerEvents="auto",this._ValidTouch=!1;"ontouchstart"in window?(this.Element.addEventListener("touchstart",(e=>{if(console.log("touchstart",e),this._ValidTouch=!0,e.touches&&e.touches.length>0){console.log(`touchstart event.touches[0].clientX:${e.touches[0].clientX}, event.touches[0].clientY:${e.touches[0].clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchmove",(e=>{if(this._ValidTouch&&(console.log("touchmove",e),e.touches&&e.touches.length>0)){console.log(`touchmove event.touches[0].clientX:${e.touches[0].clientX}, event.touches[0].clientY:${e.touches[0].clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchend",(e=>{if(console.log(`touchend event.touches.length:${e.touches.length}, event.clientX:${e.clientX}, event.pageX:${e.pageX}`),this._ValidTouch=!1,e.changedTouches&&e.changedTouches.length>0){console.log(`touchend event.changedTouches[0].clientX:${e.changedTouches[0].clientX}, event.changedTouches[0].pageX:${e.changedTouches[0].pageX}`);this._onTouchEvent({type:e.type,clientX:e.changedTouches[0].clientX,clientY:e.changedTouches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchcancel",(e=>{if(this._ValidTouch=!1,console.log("touchcancel",e),e.changedTouches&&e.changedTouches.length>0){console.log(`touchcancel event.clientX:${e.clientX}, event.clientY:${e.clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0)):(this.Element.addEventListener("mousedown",(e=>{console.log("mousedown",e),this._ValidTouch=!0;this._onTouchEvent(e)&&e.stopPropagation()}),!0),this.Element.addEventListener("mousemove",(e=>{if(this._ValidTouch){this._onTouchEvent(e)&&e.stopPropagation()}}),!0),this.Element.addEventListener("mouseup",(e=>{console.log("mouseup",e),this._ValidTouch=!1;this._onTouchEvent(e)&&e.stopPropagation()}),!0))}_GetSplineDeceleration(e){return Math.log(i.DragInfo.INFLEXION*Math.abs(e)/(i.DragInfo.SCROLL_FRICTION*i.DragInfo.PHYSICAL_COEF))}_GetSplineFlingDistance(e){const t=this._GetSplineDeceleration(e),s=i.DragInfo.DECELERATION_RATE-1;return i.DragInfo.SCROLL_FRICTION*i.DragInfo.PHYSICAL_COEF*Math.exp(i.DragInfo.DECELERATION_RATE/s*t)}_DoDragMove(e,t){let s=e._deltaX,n=e._deltaY;this._DragMovedDistanceX+=s,this._DragMovedDistanceY+=n,t||(s=e.deltaX,n=e.deltaY);const r=e.timeStamp/1e3;let a=`left ${r}s, top ${r}s`;this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_VERTICAL?(s=0,a=`top ${r}s`):this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_HORIZONTAL?(n=0,a=`left ${r}s`):this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_DISABLE&&(s=0,n=0);let o=this.GetLayoutParams();return o=this._GetMovedLayoutParams(s,n),t&&(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)&&(e.viewX=o.MarginLeft,e.viewY=o.MarginTop,this._DragInfo.Listener.OnMoved(e))}_GetMovedLayoutParams(e,t){const i=this.GetLayoutParams();let s=i.MarginLeft+e,n=i.MarginTop+t;return s>this._DragInfo.Settings.SlidePile.x?s=this._DragInfo.Settings.SlidePile.x:s+i.Width<this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width&&(s=this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width-i.Width),n>this._DragInfo.Settings.SlidePile.y?n=this._DragInfo.Settings.SlidePile.y:n+i.Height<this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height&&(n=this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height-i.Height),i.SetPosition(s,n),i}_SlideIfEnableTabMod(e,t){if(!this._DragInfo.Settings.EnableTabMode)return!1;const s=e._deltaX,n=e._deltaY;let r=e.deltaX,a=e.deltaY,o=this._DragInfo.Settings.PageWidth*this._DragInfo.Settings.PageEdge;const l=this.GetLayoutParams(),h=l.MarginLeft+s,c=l.MarginTop+n;switch(e.type===i.DragInfo.EVENT_TYPE.OnFling&&(o=0),this._DragInfo.Settings.DragDirection){case i.DragSetting.DIRECTION_VERTICAL:if(r=0,a>=0){const e=this._DragInfo.Settings.PageWidth-Math.abs(c)%this._DragInfo.Settings.PageWidth;a=e>=o?this._DragInfo.Settings.PageWidth-e:-e}else{const e=Math.abs(c)%this._DragInfo.Settings.PageWidth;a=e>=o?-(this._DragInfo.Settings.PageWidth-e):e}break;case i.DragSetting.DIRECTION_HORIZONTAL:if(a=0,r>=0){const e=this._DragInfo.Settings.PageWidth-Math.abs(h)%this._DragInfo.Settings.PageWidth;r=e>=o?this._DragInfo.Settings.PageWidth-e:-e,console.log(`right, left_width:${e}, distance_x:${r}`)}else{const e=Math.abs(h)%this._DragInfo.Settings.PageWidth;r=e>=o?-(this._DragInfo.Settings.PageWidth-e):e,console.log(`left, left_width:${e}, 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 u=Math.sqrt(r*r+a*a)/.3;return e.deltaX=r,e.deltaY=a,this._DonFlingAnim(e,u),!0}_DoDragEnd(e){let t=e._deltaX,s=e._deltaY;this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_VERTICAL?t=0:this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_HORIZONTAL?s=0:this._DragInfo.Settings.DragDirection===i.DragSetting.DIRECTION_DISABLE&&(t=0,s=0),console.log("_DoDragEnd event:",e,this.Element.style);let n=this.GetLayoutParams();return n=this._GetMovedLayoutParams(t,s),this.ResetLayoutParams(n),e.viewX=n.MarginLeft,e.viewY=n.MarginTop,this._DragInfo.Listener.OnDragEnd(e)}_DragImactSensorRecycle(){console.log("_DragImactSensorRecycle this._DragImactSensor:",this._DragImactSensor),this._DragImactSensor&&this._DragImactSensor.Recycle()}_DonFlingAnim(e,t){const s=e.deltaX,n=e.deltaY,r=this.GetLayoutParams(),a=r.MarginLeft,o=r.MarginTop,l=r.MarginLeft+s,h=r.MarginTop+n,c=this._GetMovedLayoutParams(s,n);if(c.MarginLeft===r.MarginLeft&&c.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(t),console.log(`OnFling speed:${t}`);const u=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(((t,i)=>{this.DragControl=null,r.SetPosition(t,i),this.ResetLayoutParams(r),this.Element.style.transform=null,this._DragImactSensorRecycle(),e.viewX=t,e.viewY=i,this._DragInfo.Listener.OnFling(e),console.log(`_DonFlingAnim end view_x:${t}, view_y:${i}, distance_x:${s}, distance_y:${n}`)}),(e=>{const t=s*e,i=n*e;if(console.log(`_DonFlingAnim progress:${e}, deltaX:${t}, deltaY:${i}`),Math.abs(t)>this._DragInfo.Settings.TriggerMovedDistance||Math.abs(i)>this._DragInfo.Settings.TriggerMovedDistance){const e={deltaX:a+t,deltaY:o+i,_deltaX:t,_deltaY:i,timeStamp:parseInt((Date.now()-d)/1e3,10)};this._DoDragMove(e,!1),d=Date.now()}}));const f=this.GetPositionOffset(this.ParentView);this._DragImactSensor=i.sElementImpactSensorManager.AddImpactSensor(new i.DragImpactSensor([{x:u.SlidePile.x+f.x,y:u.SlidePile.y+f.y},{x:u.SlidePile.x+f.x+u.SlidePile.width,y:u.SlidePile.y+f.y},{x:u.SlidePile.x+f.x,y:u.SlidePile.y+f.y+u.SlidePile.height},{x:u.SlidePile.x+f.x+u.SlidePile.width,y:u.SlidePile.y+f.y+u.SlidePile.height}],this.Element,new i.sImpactSensorManager.Callback((t=>{this._DoDragPause(e),this._DragImactSensorRecycle()}),null)))}_DoFling(e){let t=e.deltaX,s=e.deltaY,n=!0,r=0;switch(this._DragInfo.Settings.DragDirection){case i.DragSetting.DIRECTION_VERTICAL:t=0,0===s&&(n=!1),r=Math.abs(e.velocityY);break;case i.DragSetting.DIRECTION_HORIZONTAL:s=0,0===t&&(n=!1),r=Math.abs(e.velocityX);break;case i.DragSetting.DIRECTION_DISABLE:n=!1;break;default:r=Math.sqrt(e.velocityX**2,e.velocityY**2)}return n&&(e.deltaX=t,e.deltaY=s,this._DonFlingAnim(e,r)),!0}}de.DivId=0,i.LayoutViewBase=de;class fe extends i.LayoutViewBase{constructor(e,t){!e||e instanceof i.TextureSetting||i.ThrowError("ERROR:LayoutView need TextureSetting as parameter"),super(e,t=t||"div")}}i.LayoutView=fe,window.LayoutView=i.LayoutView;class ge extends i.LayoutView{constructor(){super(void 0,"root"),this._ViewType=1,this._IsChildOfRootView=!0,window.gRootView=this,i.sRootView=this}Init(e,t,i,s,n){this.InitLayoutViewStaticValues(e),this.ResetLayoutParams({x:0,y:0,width:1280,height:720})}InitLayoutViewStaticValues(e){i.LayoutViewBase.sRenderer=e,i.LayoutViewBase.sInternalTextureManager=e.GetSharedTextureManager(),i.LayoutViewBase.sIdentityMat4=new i.Mat4,i.LayoutViewBase.sNullDirectParentMat4=new i.Mat4,i.LayoutViewBase.sBakeFlipYMat4=(new i.Mat4).rotatex(180)}}i.RootView=ge,window.RootView=i.RootView;class me{constructor(e,t,i,s,n){this.coordX=e,this.coordY=t,this.width=i,this.height=s,this.useScissors=n,this.maskStencil=null}updateInfo(e,t,i,s,n){this.coordX=e,this.coordY=t,this.width=i,this.height=s,this.useScissors=n}setMaskStencil(e){this.maskStencil=e}}class _e extends i.LayoutView{constructor(e){super(e,"div"),this._ClipRectInfo=null,this.Id="ClipView",this.TextureSetting=null}SetId(e){this.Id=`${e}_ClipView`}SetClipRect(e,t,i,s,n){null===this._ClipRectInfo?this._ClipRectInfo=new me(e,t,i,s,n):this._ClipRectInfo.updateInfo(e,t,i,s,n);const r=e,a=t,o=this.LayoutParams.Width-r-i,l=this.LayoutParams.Height-a-s;n?(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=_e,window.ClipView=i.ClipView;class pe extends i.LayoutView{constructor(e){super(e,"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(e){this.TextureSetting=e,this._ApplyChanges()}SetRepeat(e,t){i.Assert(e.length<=2),i.Assert(t.length<=2);for(let i=0;i<2;i++)i<e.length?(this._HorizontalRepeats[2*i]=e[i].start,this._HorizontalRepeats[2*i+1]=e[i].width):(this._HorizontalRepeats[2*i]=0,this._HorizontalRepeats[2*i+1]=0),i<t.length?(this._VerticalRepeats[2*i]=t[i].start,this._VerticalRepeats[2*i+1]=t[i].width):(this._VerticalRepeats[2*i]=0,this._VerticalRepeats[2*i+1]=0);return this._ApplyChanges(),this}SetPadding(e,t){return i.Assert(null!==e),i.Assert(null!==t),this._VerticalPadding[0]=t.start,this._VerticalPadding[1]=t.width,this._HorizontalPadding[0]=e.start,this._HorizontalPadding[1]=e.width,this._ApplyChanges(),this}SetImageDspSize(e,t){this._ImageDspWidth=e,this._ImageDspHeight=t}_ApplyChanges(){let e=this.TextureSetting;if(e){if(e.MaskSetting&&"CORNER"===e.MaskSetting._MaskType&&this._SetBorderRadius(e.MaskSetting),e.Texture.Source){const t=e.Texture.RenderTexture.Width,i=e.Texture.RenderTexture.Height,s=t/this._ImageDspWidth,n=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]*s),c=t-Math.floor(this._HorizontalRepeats[1]*s)-h,u=Math.floor(this._VerticalRepeats[0]*n),d=i-Math.floor(this._VerticalRepeats[1]*n)-u;h+c>=t&&(h-=1,c-=1),u+d>=i&&(u-=1,d-=1);const f=`${u} ${c} ${d} ${h}`;this.Element.style.borderImage=`url(${e.Texture.Source}) ${f} fill`;const g=this._HorizontalPadding[0],m=this._ImageDspWidth-this._HorizontalPadding[1]-g,_=this._VerticalPadding[0],p=this._ImageDspHeight-this._VerticalPadding[1]-_;this.Element.style.borderImageWidth=`${o}px ${a}px ${l}px ${r}px`,this.Element.style.borderImageOutset=`${_}px ${m}px ${p}px ${g}px`}}else this.Element.style.borderRadius="",this.Element.style.borderImage=""}}i.NinePatchView=pe;class we extends i.LayoutView{constructor(e){let t;t=e.startsWith("jsve-")?e.substr(5):e.substr(3),super(void 0,t)}setAttribute(e,t){this.Element.setAttribute(e,t)}removeAttribute(e){this.Element.removeAttribute(e)}getAttribute(e){return this.Element.getAttribute(e)}hasAttribute(e){return this.Element.hasAttribute(e)}get textContent(){return this.Element.textContent}set textContent(e){this.Element.textContent=e}}i.JsvElementView=we;class ve extends i.LayoutView{constructor(e,t){super(t),this._ViewType=8,this.Element=e.Ele,this.Id="VideoView"}SetId(e){this.Id=`${e}_VideoView`}ResetLayoutParams(e){null!==e?(e instanceof i.LayoutParamsBase?this.LayoutParams=e.Clone():this.LayoutParams=new i.LayoutParams(e),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=ve;class ye 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",(e=>{e=e||window.event;let t=this.Element.selectionStart;console.log(`keydown cur_offset:${t}`),37===e.keyCode?(--t,t<0&&(t=0),t!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,t,!0),e.stopPropagation&&e.stopPropagation()):this.Element.blur()):39===e.keyCode?(++t,t>this.Element.value.length&&(t=this.Element.value.length),t!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,t,!0),e.stopPropagation&&e.stopPropagation()):this.Element.blur()):38!==e.keyCode&&40!==e.keyCode||this.Element.blur()})),this.Element.onfocus=e=>{console.log("onfocus in"),this.OnStatusChanged(1)},this.Element.onblur=e=>{console.log("onblur in"),this.OnStatusChanged(0)};this.Element.oninput=e=>{if(console.log("oninput:",e),e.target.value.length>0&&e.target.selectionStart>0){const s=e.target.selectionStart-1,n=e.target.selectionStart,r=e.target.value.slice(s,n);t=r,"0".charCodeAt()<=t.charCodeAt()&&t.charCodeAt()<="9".charCodeAt()||this._InputType!==i.TextInputType.NUMBER||(e.target.value=e.target.value.substr(0,s)+e.target.value.substr(n),e.target.selectionStart=s)}var t;const s=e.target.value,n=e.target.selectionStart;this.OnTextChanged(decodeURIComponent(s),n)}}SetId(e){this.Id=`${e}_EditControlView`}showIme(e,t,s){this.Element?e!==i.TextInputType.NONE?(null==s&&(s=t.length>0?t.length:0),s<0?s=0:s>t.length&&(s=t.length>0?t.length:0),this._InputType=e,this.Element.type="text",this.Element.value=t,this.Element.focus(),this.Element.selectionStart=s,this.Element.selectionEnd=s):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(e,t){this.Element?(this.Element.selectionStart=t,this.Element.selectionEnd=t,this.Element.value=e):console.log("updateCursorOffset, but ele is null!")}OnTextChanged(e,t,i){console.log(`OnTextChanged value:${e}`)}OnStatusChanged(e){}OnEditAction(e){}}class be extends i.LayoutView{constructor(e,t=1){super(e),this._ViewType=10,this._FilterType=t,this.Id="FilterView",this.Element.style.filter="grayscale(100%)"}FilterSwitch(e){this.Element&&(this.Element.style.filter=e?"grayscale(100%)":"")}SetId(e){this.Id=e+"_FilterView"}}i.FilterView=be,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=ye;i.DragTranslateControl=class extends class{constructor(e){this._Current=new Array(e).fill(0),this._Target=new Array(e).fill(0),this._RepeatStart=new Array(e).fill(0),this._JumpTarget=null,this._Jumping=!1,this._ParameterCount=e,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(e,t){return this._Repeat=e,this._OnRepeatCallback=e?t:null,this}start(e,t){this._NextEndCallback=e,this._EndCallback=null,this._AdvanceCallback=t,this._StartSwitcher=!0,this._Jumping=!1,this._StateMachineNext()}pause(e){this._AdvanceCallback=null,null===this._EndCallback&&null===this._NextEndCallback||(this._EndCallback=null,this._NextEndCallback=null),0===this._StateIndex?e&&this._CallbackWithCatch(this._Current,e):(e&&(this._PausedCallback=e),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(e,t,i,s){console.warn("Should Override")}_WrapCallback(e,t){console.warn("Should Override")}_CallbackWithCatch(e,t){try{this._WrapCallback(e,t)}catch(e){console.error("Error:in callback"),console.error(e)}}_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 e=this._JumpTarget?[...this._JumpTarget]:[...this._Current],t=this._Target,s=this._Repeat?[...this._RepeatStart]:null,n=this._WrapBuildAnimation(s,e,t,this._Jumping);if(this._JumpTarget=null,this._Jumping=!1,null===n)return;const r=[...t],a=this,o=(new i.AnimationListener).OnFinalProgress((t=>{a._OnPaused(null!==s?s:e,r,t)})).OnAdvance((e=>{this._AdvanceCallback&&this._AdvanceCallback(e)}));return this._OnRepeatCallback&&o.OnRepeat((e=>{a._OnRepeatCallback&&a._OnRepeatCallback(e)})),n.AddAnimationListener(o),n.Enable(i.AnimationEnable.KeepTransform),this._Repeat&&n.EnableInfinite(),this._SpriteView.StartAnimation(n),!0}_StopAnimation(){this._SpriteView.StopAnimation()}_OnPaused(e,t,i){for(let s=0;s<this._ParameterCount;s++)this._Current[s]=Math.floor((t[s]-e[s])*i+e[s]);this._StateLocked=!0;const s=this._PausedCallback,n=this._EndCallback;this._PausedCallback=null,s&&this._CallbackWithCatch(this._Current,s),n&&1===i&&(this._EndCallback=null,this._CallbackWithCatch(this._Current,n)),this._StateLocked=!1,this._StateIndex=0;this._StateMachineNext()}_SetView(e){this._SpriteView=e}}{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(e){return this._AllowFrameStep=e,this}selectMode(e){switch(e){case"UniformMotion":this._Mode=0;break;case"AcceleratedMotion":this._Mode=1,this.setRepeat(!1);break;default:console.error(`Unsupported input=${e}`)}return this}targetX(e){return this._Target[0]=e,this}targetY(e){return this._Target[1]=e,this}target(e,t){return this._Target[0]=e,this._Target[1]=t,this}enableRepeatFrom(e,t,i){if(this._ComfirmMode(0))return this.setRepeat(!0,i),this._RepeatStart[0]=e,this._RepeatStart[1]=t,this}speed(e){if(console.log(`speed, pixel_per_second:${e}`),this._ComfirmMode(0))return this._Speed=e,this}accelerateX(e,t){if(this._ComfirmMode(1))return this._Target[0]=t,this._VerlocityAcc=e,this._VerlocityInit=0,this._AccAlongX=!0,this}accelerateY(e,t){if(this._ComfirmMode(1))return this._Target[1]=t,this._VerlocityAcc=e,this._VerlocityInit=0,this._AccAlongX=!1,this}decelerateX(e,t){if(this._ComfirmMode(1))return this._VerlocityAcc=e,this._VerlocityInit=t,this._AccAlongX=!0,this}decelerateY(e,t){if(this._ComfirmMode(1))return this._VerlocityAcc=e,this._VerlocityInit=t,this._AccAlongX=!1,this}decelerate(e,t,i,s){if(1===this._Mode)return this._VerlocityAcc[0]=e,this._VerlocityAcc[1]=t,this._VerlocityInit[0]=i,this._VerlocityInit[1]=s,this;console.error("Error: mode error")}_ComfirmMode(e){return this._Mode===e||(console.error("Error: mode error"),!1)}_WrapBuildAnimation(e,t,i,s){return s?this._AnimationRef=this._UniformMove(null,t,i,s):0===this._Mode?this._AnimationRef=this._UniformMove(e,t,i,!1):1===this._Mode&&(this._AnimationRef=this._AccelerMove(t,i)),this._AnimationRef}_UniformMove(e,t,s,n){let r=0,a=0,o=0,l=1;const h=t[0],c=t[1],u=s[0],d=s[1];if(null!==e){r=e[0],a=e[1];const t=this._Distance(h,c,u,d),i=this._Distance(r,a,u,d);o=(i-t)/i,n||(l=1e3*i/this._Speed)}else r=h,a=c,o=0,n||(l=1e3*this._Distance(h,c,u,d)/this._Speed);n||0!==l||console.warn("Discard starting request for no distance");let f=null;if(r!==u&&a!==d||n||!this._AllowFrameStep||!window.JsView)f=new i.TranslateAnimation(r,u,a,d,l,null);else{console.log("Using frame translate animation");let e=0,t=0,s=!0;r!==u?(e=r,t=u,s=!0):(e=a,t=d,s=!1),f=new i.TranslateFrameAnimation(e,t,this._Speed,s)}return 0!==o&&(o<0?console.warn("Warning: start position out of repeating range"):f.SetStartPos(o)),f}_AccelerMove(e,t){const s=this._AccAlongX?e[0]:e[1],n=this._VerlocityInit,r=this._VerlocityAcc;let a,o,l,h,c=!0;if(0!==r)return 0===n?(a=this._AccAlongX?t[0]:t[1],o=Math.floor(1e3*Math.sqrt(2*Math.abs(a-s)/r)),c=!0):(o=Math.floor(1e3*Math.abs(n)/r),a=s+Math.floor(5e-4*n*o),c=!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(e[0],l,e[1],h,o,c?i.Easing.Circular.In:i.Easing.Circular.Out);console.error("Error: no found acceleration")}_Distance(e,t,i,s){const n=i-e,r=s-t;return Math.sqrt(n*n+r*r)}_WrapCallback(e,t){this._AnimationRef=null,t&&t(e[0],e[1])}};class Te extends i.LayoutView{constructor(){super(),this._ChildTextView=null}PutChildTextView(e){this._ChildTextView=e,this.AddView(e)}EnableAutoHeight(){this._ChildTextView.EnableAutoHeight()}}class Se{StringWithFont(e,t,i,s,n,r,a,o,l,h,c){t||(t=Se._sDefaultFontSize),i||(i=Se._sDefaultFont);let u="";!0===a&&(u="italic");let d="";return!0===o&&(d="bold"),s||(s="left"),n||(n="middle"),r||(r=Se._sDefaultFontColor),l||(l=null),c||(c="top"),h||(h=-1),{str:`${e}`,font:i,size:t,italic:u,bold:d,stroke_width:h,alignment:s,vertical_align:n,textColour:r,backgroundColour:Se._sDefaultBackgroundColor,enableBlend:!0,shadow:l,vertical_area_align:c}}TextAttr(e,t){return e||(e="none"),t||(t="none"),{text_overflow:e,word_wrap:t}}GetTextWidth(...e){if(e.length<=1){let t=e[0];return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextWidth(t):t.str.length*t.size+1}{let t=e[0];if(void 0!==window.PlatformUtils){let i={str:t,font:e[1]?e[1]:"黑体",size:e[2],bold:e[3],italic:e[4]};return window.PlatformUtils.GetTextWidth(i)}return t.length*t.size+1}}GetTextRect(e,t,i,s,n){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextRect(e,t,i,s,n):{width:t.width,height:t.height}}GetTextInfo(e,t,i,s,n){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextInfo(e,t,i,s,n):{start:0,end:e.length,width:t.width,height:t.height}}GetCursorOffset(e,t,i,s,n,r,a){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorOffset(e,t,i,s,n,r,a):0}GetCursorPosition(e,t,i,s,n,r){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorPosition(e,t,i,s,n,r):{x:0,y:0}}BuildTextView(e,t,s,n,r,a,o,l,h,c,u){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 f=e.GetTextTextureFromStylePack(t,s,!!n,r,a,o,l,h,c,u);if(n&&setTimeout((()=>{n({width:d.Element.clientWidth,height:d.Element.clientHeight})})),null===f)return console.error("Error: Build text texture failed!"),null;d.ResetTexture(new i.TextureSetting(f,null,null,!0)),t.length<10?d.SetId("Text-"+t):d.SetId("Text-Long-"+t.length),d.ResetLayoutParams({x:0,y:0,width:r.width,height:r.height});const g=s.DS.Describe;if("middle"===g.vertical_area_align||"bottom"===g.vertical_area_align){const e=new Te;e.PutChildTextView(d),d.Element.style.display="table-cell",d.Element.style.position="static",e.Element.style.display="table",e.Element.style.position="static",d=e}return d}}Se._sDefaultFont="黑体",Se._sDefaultFontSize=30,Se._sDefaultFontColor="#FFFFFF",Se._sDefaultBackgroundColor="rgba(0, 0, 0, 0)",i.TextUtils=Se,i.sTextUtils=new i.TextUtils;class Ce{constructor(){this._InnerViews={},this._ViewToken=1}add(e){const t=++this._ViewToken;return this._InnerViews[`${t}`]=e,t}remove(e){this._InnerViews[e]&&delete this._InnerViews[e]}get(e){return this._InnerViews[e]}clear(){this._InnerViews={},this._ViewToken=1}}i.ViewStore=Ce,i.sViewStore=new Ce;i.ViewInfo=class{constructor(e,t){this.view=e,this.layout_params=t}};let Ee=0;i.AnimationBase=class{constructor(){this.IdToken=Ee++,this._AttachedGroup=null,this.AnimationListenerObj=null,this._AnimationClose=!1,this._LayoutViewRef=null,this._IsTextureAnim=!1}SetAnimationListener(e){this.AnimationListenerObj=e,this.OnNewListener(e)}AddAnimationListener(e){this.AnimationListenerObj&&e.AddInherit(this.AnimationListenerObj),this.AnimationListenerObj=e,this.OnNewListener(e)}OnNewListener(e){}GetAnimationListener(){return this.AnimationListenerObj}Cancel(e){this._LayoutViewRef&&this._LayoutViewRef.DetachAnimation(this);const t=this.AnimationListenerObj;if(t&&t.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,t.OnAnimationEnd(!1)),this._AttachedGroup){let t=!0;e&&(t=e._AttachedGroup!==this._AttachedGroup),t&&(this._AttachedGroup.CancelFromInternalAnimation(this),this._AttachedGroup=null)}}AttachToGroup(e){null!==this._AttachedGroup&&i.ThrowError("ERROR: In TransformAnimation.AttachToGroup(), animation already attached to other group"),this._AttachedGroup=e}RemoveFromGroup(){this._AttachedGroup=null}AsTextureAnimation(){this._IsTextureAnim=!0}Start(e){this._LayoutViewRef=e}SetCannotDisable(e){}OnStart(){const e=this.AnimationListenerObj;e&&e.OnAnimationStart&&e.OnAnimationStart()}OnEnd(e){this._LayoutViewRef&&!e&&(this._LayoutViewRef.DetachAnimation(this),this._LayoutViewRef=null);const t=this.AnimationListenerObj;t&&t.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,t.OnAnimationEnd(!0))}OnRepeatEvent(){const e=this.AnimationListenerObj;e&&e.OnAnimRepeat&&e.OnAnimRepeat()}OnViewHide(){const e=this.AnimationListenerObj;e&&e.OnViewNoVisible&&e.OnViewNoVisible()}OnFinalProgress(e){const t=this.AnimationListenerObj;t&&t.OnAnimFinal&&t.OnAnimFinal(e)}OnAnimAdvance(e){const t=this.AnimationListenerObj;t&&t.OnAnimAdvance&&t.OnAnimAdvance(e)}};i.AnimationListener=class{constructor(e,t,i){this.OnAnimationStart=e,this._OnAnimationStart=e,this.OnAnimationEnd=t,this._OnAnimationEnd=t,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(e){return this._OnAnimationStart=e,this.OnAnimationStart=e,this}OnEnd(e){return this._OnAnimationEnd=e,this.OnAnimationEnd=e,this}OnAdvance(e){return this._OnAnimAdvance=e,this.OnAnimAdvance=e,this}OnFinalProgress(e){return this._OnAnimFinal=e,this.OnAnimFinal=e,this}OnRepeat(e){return this._OnAnimRepeat=e,this.OnAnimRepeat=e,this}AddInherit(e){if(e){if(0===this._InheritListener.length){const e=this;this.OnAnimationStart=function(){e._OnAnimationStart&&e._OnAnimationStart();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimationStart&&e._InheritListener[t].OnAnimationStart()},this.OnAnimationEnd=function(t){e._OnAnimationEnd&&e._OnAnimationEnd(t);for(let i=0;i<e._InheritListener.length;i++)e._InheritListener[i].OnAnimationEnd&&e._InheritListener[i].OnAnimationEnd(t)},this.OnViewNoVisible=function(){e._OnViewNoVisible&&e._OnViewNoVisible();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnViewNoVisible&&e._InheritListener[t].OnViewNoVisible()},this.OnAnimFinal=function(t){e._OnAnimFinal&&e._OnAnimFinal(t);for(let i=0;i<e._InheritListener.length;i++)e._InheritListener[i].OnAnimFinal&&e._InheritListener[i].OnAnimFinal(t)},this.OnAnimRepeat=function(){e._OnAnimRepeat&&e._OnAnimRepeat();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimRepeat&&e._InheritListener[t].OnAnimRepeat()},this.OnAnimAdvance=function(){e._OnAnimAdvance&&e._OnAnimAdvance();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimAdvance&&e._InheritListener[t].OnAnimAdvance()}}this._InheritListener.push(e)}}};class xe{constructor(e){this._SS=e}insertRule(e){window.jsvInAndroidWebView&&(e=(e=e.replace(/@keyframes/,"@-webkit-keyframes")).replace(/transform/g,"-webkit-transform"));const t=this._SS.cssRules.length;this._SS.insertRule(e,t)}removeRule(e){this.removeMultiRules([e])}hasRule(e){const t=this._SS.cssRules;for(let i=t.length-1;i>=0;i--)if(t[i].name===e)return!0;return!1}removeMultiRules(e){const t=this._SS,i=this._SS.cssRules;for(let s=i.length-1;s>=0;s--)for(const n in e)if(i[s].name===e[n]){e.splice(n,1),t.deleteRule(s);break}}}let Ie=null;function Ae(){return null===Ie&&(Ie=function(e){let t=null;const i=document.styleSheets;if(!i||0===i.length)return console.error("Error: styleSheet empty"),null;if(e){for(let s=0;s<i.length;++s){const n=i[s];if(n.cssRules[0]&&n.cssRules[0].name&&n.cssRules[0].name===e){t=n;break}}if(null===t)return console.error(`Error: no found tag=${e}`),null}else t=i[0];return new xe(t)}()),Ie}function Re(e){let t="linear";if(e&&void 0!==e.T)switch(e.T){case i.EasingTypeIn:t="ease-in";break;case i.EasingTypeOut:t="ease-out";break;case i.EasingTypeInOut:t="ease-in-out";break;case i.EasingTypeBezier:t=`cubic-bezier(${e.St.X1},${e.St.Y1},${e.St.X2},${e.St.Y2})`;break;case i.EasingTypeSteps:t=`steps(${e.St.S},${0===e.St.T?"start":"end"})`;case i.EasingTypeBlink:case i.EasingTypeDeceleration:}return t}function Pe(e,t){const i=-1===e.repeatTimes?"infinite":e.repeatTimes;let s="linear";e.easing&&(s=Re(e.easing));return`${t} ${e.duration/1e3}s ${s} ${e.delayedTime/1e3}s ${i}`}const Oe=e=>e>=65&&e<=90||e>=97&&e<=122,Le=e=>e>=48&&e<=57,De=e=>{if(!e)return null;let t="",i="",s=[],n=0;for(let r=0;r<e.length;r++){const a=e.charCodeAt(r);if(0===n?(Oe(a)||Le(a))&&(t+=e[r]):(Le(a)||46===a||45===a||101===a)&&(i+=e[r]),40===a)n=1,i="",s=[];else{if(41===a)return s.push(parseFloat(i)),{name:t,params:s};44===a&&(s.push(parseFloat(i)),i="")}}return console.error("transform error",e),null};function ke(e){const t=e.Element.children;let i=null;for(let e=0;e<t.length;e++)if("_AnimateProgressTracer"===t[e].id){i=t[e];break}return null===i&&(i=window.originDocument.createElement("div"),i.id="_AnimateProgressTracer",e.Element.appendChild(i)),i}let Me=0;class Fe{constructor(e){this._TracerDiv=ke(e),this._IdToken=Me++,this._KeyFrameName=null,this._AdvanceTimer=null,this._AdvanceListener=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=e=>{e.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 e=this.GetProgress();this._AdvanceListener(e),1===e&&this._ClearAdvanceTimer()}),100))}Start(e,t,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(t,this._IdToken,this._TracerDiv._ForgeProgressToken),this._TracerDiv.style.animation=Pe(e,this._KeyFrameName),this._TracerDiv.addEventListener("animationend",this._OnEndListener),this._NotifyAdvance()}Stop(){const e=this.GetProgress();return this._TracerDiv.style.animation=null,this._KeyFrameName&&(this._RemoveTraceKeyFrame(this._KeyFrameName),this._KeyFrameName=null),this._AdvanceListener&&(this._ClearAdvanceTimer(),this._AdvanceListener(e),this._AdvanceListener=null),e}GetProgress(){const e=window.getComputedStyle(this._TracerDiv);if(0===e.transform.length);else if(e.transform.length>0&&"none"!==e.transform){const t=De(e.transform);return null!==t?t.params[4]/1e3:(console.error("Error:internal error"),0)}return 1}_BuildTraceKeyFrame(e,t,i){const s=`_AnimateProgress_${t}_${i}`,n=Ae(),r=`@keyframes ${s}\n {0%{transform:translate3d(${Math.floor(1e3*e)}px,0,0)}\n 100%{transform:translate3d(1000px,0,0)}}`;return n.insertRule(r),s}_RemoveTraceKeyFrame(e){Ae().removeRule(e)}}class Ve{constructor(e,t){this._TracerDiv=ke(e),this._IdToken=Me++,this._KeyFrameNameArray=null,this._StepsTotal=t,this._RunAnimList=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=e=>{e.stopPropagation()},this._TracerDiv.addEventListener("animationend",this._OnEndListener)}Start(e){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(e),this._TracerDiv.style.animation=this._RunAnimList[0]}TriggerNextStep(e){this._TracerDiv.style.animation=this._RunAnimList[e]}Stop(){const e=this.GetProgress();return this._TracerDiv.style.animation=null,null!==this._KeyFrameNameArray&&(this._RemoveTraceKeyFrameGroup(),this._KeyFrameNameArray=null),e}GetProgress(){const e=window.getComputedStyle(this._TracerDiv);if(0===e.transform.length);else if("none"!==e.transform){const t=De(e.transform);if(null!==t){return t.params[4]/(100*this._StepsTotal)}return console.error("Error:internal error"),0}return 1}_BuildTraceKeyFrameGroup(e,t){this._KeyFrameNameArray=new Array(this._StepsTotal);const i=Ae();for(let s=0;s<this._KeyFrameNameArray.length;s++){const n=`_AnimateGroupProgress_${e}_${t}_Cnt_${s===this._KeyFrameNameArray.length-1?"finalStep":`${s}`}`,r=`@keyframes ${n}\n {0%{transform:translate3d(${100*s}px,0,0)}\n 100%{transform:translate3d(${100+100*s}px,0,0)}}`;i.insertRule(r),this._KeyFrameNameArray[s]=n}}_RemoveTraceKeyFrameGroup(){const e=Ae();this._KeyFrameNameArray.forEach((t=>{e.removeRule(t)}))}_ConvertToAnimationStyle(e){const t=[];for(let i=0;i<e.length;i++){let s="linear";const n=e[i];n.easing&&(s=Re(n.easing)),t.push(`${this._KeyFrameNameArray[i]} ${n.duration/1e3}s ${s}`)}return t}}let je=0;i.AnimationDelegate=class extends i.AnimationBase{constructor(e,t,i){super();let s=null;i&&(s=i.Package()),this.typeName=e,this.duration=t,this.easing=s,this.repeatTimes=1,this.delayedTime=0,this.enableFlags=-1,this.enableStartPos=0,this._Progress=null}EnableDelay(e){return this.delayedTime=e,this}SetStartPos(e){this.enableStartPos=e}EnableInfinite(){return this.repeatTimes=-1,this}SetRepeat(e){return this.repeatTimes=e,this}Enable(e){return this._EnableFlagsInner(e),this}OnNewListener(e){let t=0;e.OnAnimFinal&&(t|=i.AnimationEnable.AckFinalProgress),e.OnAnimRepeat&&(t|=i.AnimationEnable.AckRepeat),0!==t&&this._EnableFlagsInner(t)}_EnableFlagsInner(e){-1!==this.enableFlags?this.enableFlags|=e:this.enableFlags=e}_GetCSSKeyframesRule(e){let t=null;const i=document.styleSheets;for(let s=0;s<i.length;++s)if(i[s]&&i[s].cssRules){for(const n in i[s].cssRules)if(i[s].cssRules[n].name===e){t=i[s].cssRules[n];break}if(t)break}return t}CheckCssAnimationFormat(e){const t=this._GetCSSKeyframesRule(e);if(t&&t.cssRules)for(const i in t.cssRules){if(!t.cssRules[i]||!t.cssRules[i].style)continue;if(!t.cssRules[i].style.opacity&&!t.cssRules[i].style.transform)continue;const s=t.cssRules[i].style.transform;s&&(-1!==s.indexOf("rotate(")?console.error(`@keyframe ${e}, only support rotate3d, current transform:${s}`):-1!==s.indexOf("translate(")?console.error(`@keyframe ${e}, only support translate3d, current transform:${s}`):-1!==s.indexOf("scale(")&&console.error(`@keyframe ${e}, only support scale3d, current transform:${s}`))}}},i.KeyFrameAnimation=class extends i.AnimationDelegate{constructor(e,t,i){super(e,t,i),this._KeyFrameNameToRecycle=null,this._TestRepeat=this._TestRepeat.bind(this),this._LatestProgressValue=0;const s=this;this._OnEndEvent=e=>{e.stopPropagation(),s._PerformAnimationEnd(!0)},this._CurrentEndEventFunc=null}Start(e){super.Start(e),e.ResetCssTransform(null,null),e.Element&&(e.Element.style.pointerEvents="auto"),this.enableStartPos>0?this._EnableStarterAnimation():this._EnableCssAnimation(this._BuildKeyFrame(),this._OnEndEvent,0)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableStarterAnimation(){let e=this._OnEndEvent;if(1!==this.repeatTimes){const t=this;e=e=>{e.stopPropagation(),null!==t._Progress&&t._Progress.Stop(),t.delayedTime=0,t.repeatTimes>0&&(t.repeatTimes-=1),this.OnRepeatEvent(),t._EnableCssAnimation(t._BuildKeyFrame(),t._OnEndEvent,0)}}const t=this.repeatTimes,i=this.duration;this.repeatTimes=1,this.duration*=1-this.enableStartPos,this._EnableCssAnimation(this._BuildStarterKeyFrame(),e,this.enableStartPos),this.repeatTimes=t,this.duration=i}_EnableCssAnimation(e,t,s){if(null===e)return;null!==e.keyFrameString&&(Ae().insertRule(e.keyFrameString),this._KeyFrameNameToRecycle=e.name);const n=e.name;this.CheckCssAnimationFormat(n);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 Fe(this._LayoutViewRef),this._Progress.Start(this,s,(e=>{this.OnAnimAdvance(e)})),0!=(this.enableFlags&i.AnimationEnable.AckRepeat)&&(this._LatestProgressValue=0,i.sRenderBridge.RegisterPerFrameCallback(this._TestRepeat)));const a=Pe(this,n);window.jsvInAndroidWebView?(r.style.webkitAnimation=a,r.addEventListener("webkitAnimationEnd",t)):(r.style.animation=a,r.addEventListener("animationend",t)),this._CurrentEndEventFunc=t}_PerformAnimationEnd(e){if(null!==this._CurrentEndEventFunc){const e=this._LayoutViewRef.Element,t=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?e.removeEventListener("webkitAnimationEnd",t):e.removeEventListener("animationend",t)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(e&&this.OnEnd());0!=(this.enableFlags&i.AnimationEnable.AckRepeat)&&i.sRenderBridge.UnregisterPerFrameCallback(this._TestRepeat);let t=this._Progress.Stop();if(e&&(t=1),0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(t);this._LayoutViewRef.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),0!=(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(t)}),0),null!==this._KeyFrameNameToRecycle&&(Ae().removeRule(this._KeyFrameNameToRecycle),this._KeyFrameNameToRecycle=null)}_TestRepeat(){const e=this._Progress.GetProgress();this._LatestProgressValue>e&&this.OnRepeatEvent(),this._LatestProgressValue=e}_BuildStarterKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_BuildKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}},i.TranslateAnimation=class extends i.KeyFrameAnimation{constructor(e,t,i,s,n,r){super("TL",n,r),this.startX=e,this.startY=i,this.endX=t,this.endY=s}_BuildStarterKeyFrame(){if(this.enableStartPos>0){const e=(this.endX-this.startX)*this.enableStartPos+this.startX,t=(this.endY-this.startY)*this.enableStartPos+this.startY,i="_ForgeAnim_TL_"+je++;return{name:i,keyFrameString:`@keyframes ${i} {0%{transform:translate3d(${e}px,${t}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}console.error("Error: no enabled starter position")}_BuildKeyFrame(){const e="_ForgeAnim_TL_"+je++;return{name:e,keyFrameString:`@keyframes ${e} {0%{transform:translate3d(${this.startX}px,${this.startY}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}_GetFrozenTransform(e){return{transform:`translate3d(${Math.floor((this.endX-this.startX)*e+this.startX)}px,${Math.floor((this.endY-this.startY)*e+this.startY)}px,0)`,transformOrigin:null}}},i.FuncAnimation=class extends i.AnimationDelegate{constructor(e,t,i){super("FC2",t,i),this.formula=e,console.warn("NO implemented")}},i.RotateAnimation=class extends i.AnimationDelegate{constructor(e,t,s,n,r,a){super("RO",r,a),s instanceof i.Vec3||(s=new i.Vec3(s)),n instanceof i.Vec3||(n=new i.Vec3(n)),this.startAngle=e,this.offsetAngle=t,this.anchorVec3=s,this.axisVec3=n,console.warn("NO implemented")}},i.BasicScaleAnimation=class extends i.AnimationDelegate{constructor(e,t,i,s,n,r,a,o,l,h){super("SC",a,o),console.warn("NO implemented")}},i.ScaleAnimation=class extends i.BasicScaleAnimation{constructor(e,t,i,s,n,r){const a=200;super(e*a,e*a,t*a,t*a,i,s,n,r,200,200)}},i.OpacityAnimation=class extends i.AnimationDelegate{constructor(e,t,i,s){super("OP",i,s),console.warn("NO implemented")}},i.CssKeyframeAnimation=class extends i.KeyFrameAnimation{constructor(e,t,i,s,n){super("CK",t,i),this._keyFramesSet=e}_BuildKeyFrame(){const e=this._keyFramesSet;if(e.indexOf("@keyframes")<0&&e.indexOf("@-webkit-keyframes")<0)return console.warn("Warning:keyframes array empty"),null;let t=e.split(" ")[1];return t.indexOf("{")>=0&&(t=t.substr(0,t.indexOf("{"))),{name:t,keyFrameString:null}}_GetLastKeyframeTransform(e){let t=e.indexOf("to");if(t<0&&(t=e.indexOf("100%")),t<0)return"";{let i=e.indexOf("transform:",t);return i<0?"":e.substring(i+10,e.indexOf(";",i))}}_GetFrozenTransform(e){let t={transform:"",transformOrigin:null};return 1===e?t={transform:this._GetLastKeyframeTransform(this._keyFramesSet),transformOrigin:null}:console.warn("CssKeyframeAnimation can not get transform whill progress is not 1"),t}},i.CssTransitionAnimation=class extends i.AnimationDelegate{constructor(e){super("CT",null,null),this._transArray=e}Start(e){super.Start(e);const t=this,i=this._transArray,s={};if(0===i.length)return void console.warn("Warning:transition empty");let n="";for(let e=0;e<i.length;e++){let t="linear";const r=i[e];r.tf&&(t=Re(r.tf)),n=`${r.name} ${r.dur/1e3}s ${t} ${r.dly/1e3}s`,s[r.name]=n}e.ApplyStyleTransition(s),n&&(e.Element.addEventListener("transitionend",(e=>{e.stopPropagation(),t.OnEnd(!0)})),e.Element.addEventListener("webkitTransitionEnd",(e=>{e.stopPropagation(),t.OnEnd(!0)})))}},i.KeyFrameGroupAnimation=class extends i.AnimationDelegate{constructor(e){super(e,0,null),this._KeyFrameArray=null,this._LatestProgressValue=0,this._CurrentEndEventFunc=null,this._Progress=null,this._AnimRunList=null,this._AnimationRunIndex=0;const t=this;this._OnEndEvent=e=>{e.stopPropagation(),this._TestFinalKeyFrame(e)?t._PerformAnimationEnd(!0):(this._AnimationRunIndex++,this._LayoutViewRef.Element.style.animation=this._AnimRunList[this._AnimationRunIndex],this._Progress.TriggerNextStep(this._AnimationRunIndex),t._OnSubKeyFrameDone(e))}}Start(e){super.Start(e),e.ResetCssTransform(null,null),e.Element&&(e.Element.style.pointerEvents="auto"),this._EnableCssAnimation(this._BuildKeyFrameGroup(),this._OnEndEvent)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableCssAnimation(e,t){if(null===e)return;this._KeyFrameArray=new Array(e.length);const s=Ae();for(let t=0;t<e.length;t++){const i=e[t];this.CheckCssAnimationFormat(i.name),this._KeyFrameArray[t]={name:i.name,easing:i.ease.Package(),duration:i.duration,needRecycle:!1},null!==i.keyFrameString&&(s.insertRule(i.keyFrameString),this._KeyFrameArray.needRecycle=!0)}const n=this._LayoutViewRef.Element;0==(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&i.AnimationEnable.KeepTransform)||(this._Progress=new Ve(this._LayoutViewRef,this._KeyFrameArray.length),this._Progress.Start(this._KeyFrameArray)),this._AnimRunList=this._ConvertToAnimationStyle(this._KeyFrameArray),this._AnimationRunIndex=0,window.jsvInAndroidWebView?(n.style.webkitAnimation=this._AnimRunList[0],n.addEventListener("webkitAnimationEnd",t)):(n.style.animation=this._AnimRunList[0],n.addEventListener("animationend",t)),this._CurrentEndEventFunc=t}_PerformAnimationEnd(e){if(null!==this._CurrentEndEventFunc){const e=this._LayoutViewRef.Element,t=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?e.removeEventListener("webkitAnimationEnd",t):e.removeEventListener("animationend",t)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(e&&this.OnEnd());let t=this._Progress.Stop();if(e&&(t=1),0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(t);this._LayoutViewRef.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),0!=(this.enableFlags&i.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(t)}),0);const s=Ae();for(const e of this._KeyFrameArray)e.needRecycle&&s.removeRule(e.name);this._KeyFrameArray=null}_ConvertToAnimationStyle(e){const t=[];for(let i=0;i<e.length;i++){let s="linear";const n=e[i];n.easing&&(s=Re(n.easing)),t.push(`${n.name} ${n.duration/1e3}s ${s}`)}return t}_BuildKeyFrameGroup(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_TestFinalKeyFrame(e){console.warn("Warning:Should override")}_OnSubKeyFrameDone(e){console.warn("Warning:Should override")}},i.TranslateFrameAnimation=class extends i.TranslateAnimation{constructor(e,t,i,s,n,r){let a=n,o=r,l=n,h=r;s?(a=e,l=t):(o=e,h=t);super(a,l,o,h,Math.abs(Math.floor((t-e)/i*1e3)),null)}},i.ThrowAnimation=class extends i.KeyFrameGroupAnimation{constructor(e,t,i,s,n,r,a,o){super("Thr"),this._FromX=e,this._FromY=t,this._XorY=i,this._InitV=s,this._Acc=n,this._To=r,this._HasPole=a,this._PoleCallback=null,this._PolePosition=o,this._IsPositiveMove=this._InitV>0||0===this._InitV&&this._Acc>0}SetPoleCallback(e){this._PoleCallback=e}_MakeTranslateString(e,t,i){return`@keyframes ${e} {0%{transform:translate3d(${t.x.value}px,${t.y.value}px,0);}100%{transform:translate3d(${i.x.value}px,${i.y.value}px,0);}}`}_BuildKeyFrameGroup(){const e=""+je++,t=[],s={x:{value:this._FromX},y:{value:this._FromY}},n={x:{value:this._FromX},y:{value:this._FromY}},r=0===this._XorY?s.x:s.y,a=0===this._XorY?n.x:n.y;if(this._HasPole){let o=`_ForgeAnim_Thr_Forw_${e}`;a.value=this._PolePosition;let l=this._MakeTranslateString(o,s,n);t.push({name:o,keyFrameString:l,ease:i.Easing.Circular.Out,duration:Math.floor(-this._InitV/this._Acc*1e3)}),o=`_ForgeAnim_Thr_Backw_${e}`,r.value=this._PolePosition,a.value=this._To,l=this._MakeTranslateString(o,s,n),t.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_${e}`;a.value=this._To;const l=this._MakeTranslateString(o,s,n),h=this._IsPositiveMove?this._InitV:-this._InitV,c=this._IsPositiveMove?this._Acc:-this._Acc,u=this._IsPositiveMove?a.value-r.value:r.value-a.value;t.push({name:o,keyFrameString:l,ease:c>0?i.Easing.Circular.In:i.Easing.Circular.Out,duration:Math.floor((Math.sqrt(h*h+2*c*u)-h)/c*1e3)})}return t}_GetFrozenTransform(e){const t={x:{value:this._FromX},y:{value:this._FromY}};let i=0===this._XorY?t.x.value:t.y.value;const s=0===this._XorY?t.x:t.y;let n=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 t=(2*a-i-r)*e;n=t>a-i?a-(t-(a-i)):i+t}else n=i+(r-i)*e;s.value=Math.floor(this._IsPositiveMove?n:-n);return{transform:`translate3d(${t.x.value}px,${t.y.value}px,0)`,transformOrigin:null}}_TestFinalKeyFrame(e){return this._HasPole?e.animationName.indexOf("_ForgeAnim_Thr_Backw_")>=0:e.animationName.indexOf("_ForgeAnim_Thr_Forw_")>=0}_OnSubKeyFrameDone(e){this._HasPole&&this._PoleCallback&&this._PoleCallback()}},i.AnimationEnable={ReleaseAfterEndCallback:1,KeepTransform:2,AckFinalProgress:4,AckRepeat:8};let Ne=0;class Ge extends i.AnimationDelegate{constructor(e,t){super(e,t,null),this._StepsCount=1,this._Running=!1,this._NextStepIndex=0;const i=this;this._OnStepEnd=()=>{i._NextStep()}}SetStepsCount(e){this._StepsCount=e,this._SplitSteps()}Start(e){super.Start(e),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&&(Ae().removeRule(this._KeyFrameName),this._KeyFrameName=null);const e=this._NextStepIndex===this._StepsCount;if(!this._Running||e)return void this._PerformAnimationEnd(e);const t=this._CreateOneStepKeyFrame(this._NextStepIndex);this._KeyFrameName=t.name,Ae().insertRule(t.keyFrameString);const i=Pe({repeatTimes:this.repeatTimes,easing:this.easing,delayedTime:0,duration:this.duration/this._StepsCount},this._KeyFrameName),s=this._LayoutViewRef.Element;window.jsvInAndroidWebView?s.style.webkitAnimation=i:s.style.animation=i,this._NextStepIndex++}_PerformAnimationEnd(e){window.jsvInAndroidWebView?this._LayoutViewRef.Element.removeEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.removeEventListener("animationend",this._OnStepEnd);const t=this._NextStepIndex/this._StepsCount;if(0!=(this.enableFlags&i.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(this._NextStepIndex-1);this._LayoutViewRef.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),window.setTimeout((()=>{this.OnFinalProgress(t)}),0)}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_SplitSteps(){console.warn("Warning: should be override by child class")}_CreateOneStepKeyFrame(e){console.warn("Warning: should be override by child class")}}i.TranslateStepAnimation=class extends Ge{constructor(e,t,i,s,n){super("TL-S",n),this.startX=e,this.startY=i,this.endX=t,this.endY=s,this._StepsArray=null}_SplitSteps(){const e=this._StepsCount,t=(this.endX-this.startX)/e,i=(this.endY-this.startY)/e;this._StepsArray=new Array(e);let s=this.startX,n=this.startY;for(let r=0;r<e-1;r++)s+=t,n+=i,this._StepsArray[r]={targetX:Math.floor(s),targetY:Math.floor(n)};this._StepsArray[e-1]={targetX:this.endX,targetY:this.endY}}_CreateOneStepKeyFrame(e){let t=0,i=0;0===e?(t=this.startX,i=this.startY):(t=this._StepsArray[e-1].targetX,i=this._StepsArray[e-1].targetY);const s=this._StepsArray[e].targetX,n=this._StepsArray[e].targetY,r="_ForgeStepAnim_TL_"+Ne++;return{name:r,keyFrameString:`@keyframes ${r} {\n 0%{transform:translate3d(${t}px,${i}px,0);}\n 100%{transform:translate3d(${s}px,${n}px,0);}}`}}_GetFrozenTransform(e){return{transform:`translate3d(${this._StepsArray[e].targetX}px,${this._StepsArray[e].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 e=!1;if(i.sElementImpactSensorManager.HasTrace()&&(i.sElementImpactSensorManager.TestCollision(),i.sElementImpactSensorManager.HasTrace()&&(e=!0)),this._CallbacksPerFrame.size>0){for(const e of this._CallbacksPerFrame)e();this._CallbacksPerFrame.size>0&&(e=!0)}e?window.requestAnimationFrame(this._FrameLoopFunc):this._FrameLoopFunc=null}GetScreenInfo(){return this._ScreenInfo}InitScreenBuffer(e,t){isNaN(e)&&(e=1),isNaN(t)&&(t=1280);const i=t*e,s=i/16*9;this._ScreenInfo.width=Math.floor(i),this._ScreenInfo.height=Math.floor(s),this._ScreenInfo.x=2/this._ScreenInfo.width,this._ScreenInfo.y=2/this._ScreenInfo.height,this._ScreenInfo.perspective=this._ScreenInfo.x,this._ScreenInfo.scaleRatio=e,this._ScreenInfo.designedWidth=t}RequestSwap(){this._OnRequesting||(this._OnRequesting=!0,Promise.resolve().then(this._DoRequestSwap.bind(this)))}SetGlobalConfig(e){}AddWillSwapListener(e,t){this._WillSwapCallbacks.set(e,t)}_DoRequestSwap(){this._WillSwapCallbacks.size>0&&this._WillSwapCallbacks.forEach(this._DoWillSwapCallback),this._OnRequesting=!1}InstantPerformSwap(){this._OnRequesting&&(this._OnRequesting=!1,this._DoRequestSwap(!1))}_OnWillSwap(e){e()}RegisterPerFrameCallback(e){this._CallbacksPerFrame.add(e)}UnregisterPerFrameCallback(e){this._CallbacksPerFrame.delete(e)}},i.sRenderBridge=new i.RenderBridge;class Be{constructor(e,t,i){this._TextureManager=e,this._GL=t,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)}}Be.IMAGE=Symbol("Texture.IMAGE"),Be.COLOR=Symbol("Texture.COLOR");class Ue extends Be{constructor(e,t,i,s){if(super(e,t,i),s){const e=s.trim();if(0===e.indexOf("http"))this.Url=e;else if(0===e.indexOf("url")){const t=e.indexOf("("),i=e.indexOf(")");this.Url=e.substring(t+1,i)}else this.Url=s;this._TextureSource=new Image,this._TextureSource.onload=()=>{this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()},this._TextureSource.src=this.Url}}}class We{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(e,t,i,s){const n=this._GL.createImageData(1,1);return n.data[0]=e,n.data[1]=t,n.data[2]=i,n.data[3]=s,n}}let He=null;class $e extends Be{constructor(e,t,i,s){super(e,t,i),null===He&&(He=new We),this.Color=s;const n=(e=>{if(!e)return null;if(0===(e=e.trim()).indexOf("rgba")){const t=e.indexOf("("),i=e.indexOf(")");return e.substr(t+1,i-t-1).split(",").map(((e,t)=>3===t?Math.ceil(255*parseFloat(e)):parseInt(e,10)))}if(0===e.indexOf("#")){let t=e.substr(1);const i=t.length;if(6===i||8===i){6===i&&(t+="FF");const e=parseInt(`0x${t}`,10);return[e>>24&255,e>>16&255,e>>8&255,255&e]}return null}return null})(this.Color);this._TextureSource=He.getColorImageData(...n),this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()}}const Ke=new class{constructor(){this._TextureMap={}}getTexture(e,t,i,s){let n;if(this._TextureMap[s])n=this._TextureMap[s].texture,this._TextureMap[s].useCount++;else{switch(e){case Be.IMAGE:n=new Ue(this,t,i,s);break;case Be.COLOR:n=new $e(this,t,i,s);break;default:console.log(`getTexture type is error:${e}`)}this._TextureMap[s]={texture:n,useCount:1}}return n}recycle(e){this._TextureMap[e]&&(this._TextureMap[e].useCount--,this._TextureMap[e].useCount<0&&delete this._TextureMap[e])}},Ye=(e,t)=>Math.random()*(t-e)+e;class ze{constructor(e,t,i,s,n){this._ViewId=e,this._Type=t.type,this._ParticleNum=t.particleNum,this._DeltaAngle=t.deltaAngle/180*Math.PI,this._DeltaWidthFact=t.deltaWidth/s.width,this._DeltaHeightFact=t.deltaHeight/s.height,this._PointSizeMin=t.pointSizeMin,this._PointSizeMax=t.pointSizeMax,this._SpeedMin=t.speedMin,this._SpeedMax=t.speedMax,this._LifeMin=t.lifeMin/1e3,this._LifeMax=t.lifeMax/1e3,this._AddNumSpeed=t.addNumSpeed,this._AcceletateX=t.accelerateX,this._AcceletateY=t.accelerateY,this._EnableFade=t.enableFade,this._EnableShrink=t.enableShrink,this._Texture=i,this._Buffer=new Float32Array(7*this._ParticleNum),this._AddedParticleNum=0,this._Element=n,this._StartTime=-1,this._LastFrameTime=-1,this._Stopped=!1,this._getTransform=this._getTransform.bind(this)}_getTransform(){let e=this._Element.jsvMainView.Element;const t=qe(e.style.width),i=qe(e.style.height);let s=new window.WebKitCSSMatrix;for(;e.parentElement;){const t=getComputedStyle(e);if(t.transform){const i=t.transformOrigin?t.transformOrigin:t.webkitTransformOrigin;if(i){const n=qe(i),r=new window.WebKitCSSMatrix(`translate(-${n[0]}px,-${n[1]}px)`),a=new window.WebKitCSSMatrix(`translate(${n[0]}px,${n[1]}px)`),o=new window.WebKitCSSMatrix(`translate(${e.offsetLeft}px,${e.offsetTop}px)`),l=new window.WebKitCSSMatrix(t.transform);s=o.multiply(a.multiply(l.multiply(r.multiply(s))))}else s=new window.WebKitCSSMatrix(t.transform).multiply(s)}e=e.parentElement}const n=new window.WebKitCSSMatrix;n.m11=0,n.m12=0,n.m14=1,n.m21=t,n.m22=0,n.m24=1,n.m31=0,n.m32=i,n.m34=1,n.m41=t,n.m42=i,n.m44=1,s=s.multiply(n);return[s.m11,s.m12,s.m21,s.m22,s.m31,s.m32,s.m41,s.m42]}_updateParticleInfo(e,t,i,s,n,r){const a=Ye(0,2*this._DeltaWidthFact),o=Ye(0,2*this._DeltaHeightFact);this._Buffer[7*e]=a*i[0]+o*s[0]+t[0],this._Buffer[7*e+1]=a*i[1]+o*s[1]+t[1],this._Buffer[7*e+2]=n+Ye(-this._DeltaAngle,this._DeltaAngle),this._Buffer[7*e+3]=Ye(this._SpeedMin,this._SpeedMax),this._Buffer[7*e+4]=r,this._Buffer[7*e+5]=Ye(this._LifeMin,this._LifeMax),this._Buffer[7*e+6]=Ye(this._PointSizeMin,this._PointSizeMax)}onDrawFrame(e,t,i){if(!this._Texture.loaded()||this._Stopped)return;this._StartTime<0&&(this._StartTime=Date.now()),this._LastFrameTime<0&&(this._LastFrameTime=this._StartTime);const s=this._getTransform();for(let e=0;e<s.length;e++)s[e]=e%2==0?2*s[e]/window.innerWidth-1:1-2*s[e]/window.innerHeight;const n=(Date.now()-this._StartTime)/1e3,r=[s[0],s[1]],a=[s[2]-s[0],s[3]-s[1]],o=[s[4]-s[0],s[5]-s[1]],l=Math.sqrt(a[0]*a[0]+a[1]*a[1]),h=-a[1]/l,c=a[0]/l>0?Math.acos(h):2*Math.PI-Math.acos(h);if(0===this._Type)if(this._AddedParticleNum<this._ParticleNum){for(let e=0;e<this._ParticleNum;e++)this._updateParticleInfo(e,r,a,o,c,n);this._AddedParticleNum=this._ParticleNum}else{let e=!0;for(let t=0;t<this._ParticleNum;t++)if(this._Buffer[7*t+4]+this._Buffer[7*t+5]>n){e=!1;break}e&&(this._Stopped=!0)}else if(this._AddedParticleNum<this._ParticleNum){let e=Math.round((Date.now()-this._LastFrameTime)*this._AddNumSpeed);this._AddedParticleNum+e>this._ParticleNum&&(e=this._ParticleNum-this._AddedParticleNum);for(let t=0;t<e;t++)this._updateParticleInfo(this._AddedParticleNum+t,r,a,o,c,n);this._AddedParticleNum+=e}else for(let e=0;e<this._ParticleNum;e++)this._Buffer[7*e+4]+this._Buffer[7*e+5]<n&&this._updateParticleInfo(e,r,a,o,c,n);const u=e.getUniformLocation(t,"uTime");e.uniform1f(u,n);const d=e.getUniformLocation(t,"uAccelerate");e.uniform2f(d,this._AcceletateX,this._AcceletateY);const f=e.getUniformLocation(t,"uEnableFade");e.uniform1i(f,this._EnableFade?1:0);const g=e.getUniformLocation(t,"uEnableShrink");e.uniform1i(g,this._EnableShrink?1:0),e.bindBuffer(e.ARRAY_BUFFER,i),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._Texture.TextureId),e.bufferSubData(e.ARRAY_BUFFER,0,this._Buffer);const m=this._Buffer.BYTES_PER_ELEMENT,_=e.getAttribLocation(t,"aPosition");e.vertexAttribPointer(_,2,e.FLOAT,!1,7*m,0),e.enableVertexAttribArray(_);const p=e.getAttribLocation(t,"aSpeed");e.vertexAttribPointer(p,2,e.FLOAT,!1,7*m,2*m),e.enableVertexAttribArray(p);const w=e.getAttribLocation(t,"aLife");e.vertexAttribPointer(w,2,e.FLOAT,!1,7*m,4*m),e.enableVertexAttribArray(w);const v=e.getAttribLocation(t,"aPointSize");e.vertexAttribPointer(v,1,e.FLOAT,!1,7*m,6*m),e.enableVertexAttribArray(v),e.drawArrays(e.POINTS,0,this._AddedParticleNum)}recycle(){this._Buffer=null,this._Texture.recycle(),this._Stopped=!0}}let Xe=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 e=this._GL.createShader(this._GL.VERTEX_SHADER);this._GL.shaderSource(e,"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(e);const t=this._GL.createShader(this._GL.FRAGMENT_SHADER);this._GL.shaderSource(t,"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(t),this._GLProgram=this._GL.createProgram(),this._GL.attachShader(this._GLProgram,e),this._GL.attachShader(this._GLProgram,t),this._GL.linkProgram(this._GLProgram);const i=new Float32Array(3500),s=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 n=this._GL.getAttribLocation(this._GLProgram,"aPosition");this._GL.vertexAttribPointer(n,2,this._GL.FLOAT,!1,7*s,0),this._GL.enableVertexAttribArray(n);const r=this._GL.getAttribLocation(this._GLProgram,"aSpeed");this._GL.vertexAttribPointer(r,2,this._GL.FLOAT,!1,7*s,2*s),this._GL.enableVertexAttribArray(r);const a=this._GL.getAttribLocation(this._GLProgram,"aLife");this._GL.vertexAttribPointer(a,2,this._GL.FLOAT,!1,7*s,4*s),this._GL.enableVertexAttribArray(a);const o=this._GL.getAttribLocation(this._GLProgram,"aPointSize");this._GL.vertexAttribPointer(o,1,this._GL.FLOAT,!1,7*s,6*s),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 e in this._ParticleViewMap)this._ParticleViewMap.hasOwnProperty(e)&&this._ParticleViewMap[e].onDrawFrame(this._GL,this._GLProgram,this._VBO);window.requestAnimationFrame(this._onDrawFrame)}addParticle(e,t,i,s){this._Inited||this._initCanvas();const n=Xe++;let r;return r=0===t.indexOf("rgba")||0===t.indexOf("#")?Ke.getTexture(Be.COLOR,this._GL,null,t):Ke.getTexture(Be.IMAGE,this._GL,null,t),this._ParticleViewMap[n]=new ze(n,e,r,i,s),this._LoopStarted||(this._LoopStarted=!0,window.requestAnimationFrame(this._onDrawFrame)),n}recycleView(e){this._ParticleViewMap[e]&&(this._ParticleViewMap[e].recycle(),delete this._ParticleViewMap[e])}};let Je,qe=e=>{if(e.indexOf(" ")>=0){return e.split(" ").map((e=>parseInt(e.substr(0,e.length-2),10)))}return parseInt(e.substr(0,e.length-2),10)};i.ReactUtils={StyleClassMap:{}};{let e=0;class t{constructor(t,i){this._ID=i||t+e++,this.Describe={},this._RefCount=0,this._Recycled=!1}ManualSetId(e){this._ID=e}GetId(){return this._ID}DoRef(){this._RefCount++}UnRef(){this._RefCount>0?this._RefCount--:console.warn("Already 0...")}}class s extends t{constructor(e){super(null,e)}}const n=new s("DISABLE"),r={alignment:"left",vertical_align:"top",vertical_area_align:"top",text_overflow:"clip",word_wrap:"normal"},a=["alignment","vertical_align","vertical_area_align","text_overflow","word_wrap"];class o extends t{constructor(e,t,i,s,n){super("DS",null),this.Describe.alignment=e,this.Describe.vertical_align=t,this.Describe.vertical_area_align=i,this.Describe.text_overflow=s,this.Describe.word_wrap=n}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}}}const l={font:"黑体",italic:!1,bold:!1},h=["font","italic","bold"];class c extends t{constructor(e,t,i){super("FS",null),this.Describe.font=e,this.Describe.italic=t,this.Describe.bold=i}GetSyncData(){return{T:1,ID:this._ID,F:this.Describe.font,I:this.Describe.italic,B:this.Describe.bold}}}const u={text_color:"#000000",bg_color:"#00FFFFFF"},d=["text_color","bg_color"];class f extends t{constructor(e,t){super("CS",null),this.Describe.text_color=e,this.Describe.bg_color=t}GetSyncData(){return{T:2,ID:this._ID,TC:this.Describe.text_color,BC:this.Describe.bg_color}}}const g=["shadow_offset_x","shadow_offset_y","shadow_blur","shadow_color","stroke_width","stroke_color"];class m extends t{constructor(e,t,i,s,n,r){super("SS",null),this.Describe.shadow_offset_x=e,this.Describe.shadow_offset_y=t,this.Describe.shadow_blur=i,this.Describe.shadow_color=s,this.Describe.stroke_width=n,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 _{constructor(e){this.DS=i.sTextStyleCache.GetDisplayStyle(e),this.FS=i.sTextStyleCache.GetFontStyle(e),this.CS=i.sTextStyleCache.GetColorStyle(e),this.SS=i.sTextStyleCache.GetSpecialStyle(e),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(e){let t={alignment:void 0!==e.hAlign?e.hAlign:r.alignment,vertical_align:void 0!==e.vAlign?e.vAlign:r.vertical_align,vertical_area_align:void 0!==e.vAreaAlign?e.vAreaAlign:r.vertical_area_align,text_overflow:void 0!==e.textOverflow?e.textOverflow:r.text_overflow,word_wrap:void 0!==e.wordWrap?e.wordWrap:r.word_wrap,font:void 0!==e.font?e.font:l.font,italic:void 0!==e.italic?e.italic:l.italic,bold:void 0!==e.bold?e.bold:l.bold,text_color:void 0!==e.textColor?e.textColor:u.text_color,bg_color:void 0!==e.backgroundColor?e.backgroundColor:u.bg_color,shadow_offset_x:0,shadow_offset_y:0,shadow_blur:0,shadow_color:null,stroke_width:0,stroke_color:null};if(e.shadow){const i=e.shadow;t.shadow_offset_x=i.shadowOffsetX,t.shadow_offset_y=i.shadowOffsetY,t.shadow_blur=i.shadowBlur,t.shadow_color=i.shadowColor}if(e.stroke){const i=e.stroke;t.stroke_width=i.strokeWidth,t.stroke_color=i.strokeColor}return new _(t)}PrepareSyncNewStyles(){if(this._NewStyleList.length>0){let e=[];for(let t of this._NewStyleList)e.push(t.GetSyncData());i.sRenderTextureDelegateManager.CreateTextureHeadStatus().SetResourceInfo({STA:{Nam:"TST",Sta:e}}),this._NewStyleList=[]}}GetDisplayStyle(e){return this._GetStyle(e,a,o,this._DisplayStyleMap,this._DisplayStyleIds)}GetFontStyle(e){return this._GetStyle(e,h,c,this._FontStyleMap,this._FontStyleIds)}GetColorStyle(e){return this._GetStyle(e,d,f,this._ColorStyleMap,this._ColorStyleIds)}GetSpecialStyle(e){return 0===e.shadow_blur&&0===e.stroke_width?n:this._GetStyle(e,g,m,this._SpecialStyleMap,this._SpecialStyleIds)}GetDsFromId(e){return this._DisplayStyleIds.get(e)}GetFsFromId(e){return this._FontStyleIds.get(e)}GetCsFromId(e){return this._ColorStyleIds.get(e)}GetSsFromId(e){return this._SpecialStyleIds.get(e)}_GetStyle(e,t,i,s,n){let r=[];for(let i of t)r.push(e[i]);let a=r.join(":"),o=null;return s.has(a)?o=s.get(a):(o=new i(...r),s.set(a,o),n.set(o.GetId(),o),window.JsView&&this._NewStyleList.push(o)),o}}i.TextStyleObjectBase=t,i.TextStylePack=_,i.sTextStyleCache=new p}Je="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:e=>{throw new Error(e)},Assert:e=>{if(!e)throw new Error("ASSERT!!!!!")},BaseActivity:class{}};class Ze{constructor(e,t,i){this.PageName=e,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,t&&this.SetContentView(t)}OnRenderFrame(){Je.LogE("OnRenderFrame() MUST override")}OnKeyDown(e){return!1}OnKeyUp(e){return!1}DispatchKeyDown(e){if(this._KeyLock)return!0;let t=!1;return Ze.LastFocusPage=this,this._FocusChild&&(t=this._FocusChild.DispatchKeyDown(e)),t||(t=this.OnKeyDown(e)),t}DispatchKeyUp(e){if(this._KeyLock)return!0;let t=!1;return this._FocusChild&&(t=this._FocusChild.DispatchKeyUp(e)),t||(t=this.OnKeyUp(e)),t}OnCustomerEvent(e){return!1}BubbleCustomerEvent(e){this.OnCustomerEvent(e)||this._ParentPage&&this._ParentPage.BubbleCustomerEvent(e)}PrintLastFocusPage(){let e="------"+this.PageName+"\n",t=this._ParentPage;return t&&(e+=t.PrintLastFocusPage()),e}OnMouseDown(e){return!1}EnableTouchDispatcher(){this.TouchDispatcher=new i.TouchDispatcher(this)}DisableTouchDispatcher(){this.TouchDispatcher=null}GetTouchView(){return null}GetSwipeParams(e,t,i){let s=void 0===i||0===i?this._Acc:i,n=e*e/2/s;e<0&&(n=-n);let r=t*t/2/s;return t<0&&(r=-r),{durationX:Math.floor(Math.abs(e/s)),durationY:Math.floor(Math.abs(t/s)),distanceX:n,distanceY:r}}OnTouch(e){return!1}DispatchTouch(e){let t=!1;return this.TouchDispatcher&&(t=this.TouchDispatcher.OnTouch(e)),t}LostTouchFocus(e){}OnJavaKey(e,t){return!0}OnPlatformKey(e,t){return!0}PassPlatformKey(e,t){if(this._KeyLock)return!1;let i=this.OnPlatformKey(e,t);return i&&(i=this.OnJavaKey(e,t)),i}DispatchJavaKey(e,t){if(e===this._ConsumeKeycodeUntilUp)return 1===t&&(this._ConsumeKeycodeUntilUp=-1),i.LogM("Consume Javakey until up keycode="+e+" keyaction="+t),!1;if(this._KeyLock)return!1;-1!==this._ConsumeKeycodeUntilUp&&(i.LogE("ERROR: Other key pressed before locked key release"),this._ConsumeKeycodeUntilUp=-1);let s=this._FocusChild,n=!0;return s&&(n=s.DispatchJavaKey(e,t)),n&&(n=this.PassPlatformKey(e,t)),s!==this._FocusChild&&0===t&&this.CosumeAllKeyUnitlUpForFocusChange(e),n}CosumeAllKeyUnitlUpForFocusChange(e){this._ParentPage?this._ParentPage.CosumeAllKeyUnitlUpForFocusChange(e):this._ConsumeKeycodeUntilUp=e}OnHostActivityGetFocus(){this._ConsumeKeycodeUntilUp=-1}IsFocus(){return!this._ParentPage||this._ParentPage._FocusChild===this}_IsLeafInChain(){return this.IsFocus()&&!this._FocusChild}SetParent(e,t){null!==e?(null!==t&&this.SetContentView(t),e instanceof Je.BaseActivity&&(e=e.GetRootPageBase()),this._ParentPage=e,e.SubPages.push(this),this._HostActivity=e._HostActivity,e._IsShowing&&this._AutoShow&&this._OnShowInternal()):Je.ThrowError("ERROR: parent is null")}SetParentPage(e){this.SetParent(e)}RemoveSubPage(e){e===this._FocusChild&&(this._FocusChild=null),e===this._LatestFocusChild&&(this._LatestFocusChild=null);for(let t=0;t<this.SubPages.length;t++)if(e===this.SubPages[t]){e._OnHideInternal(),this.SubPages.splice(t,1);break}}ClearSubPages(){this.SubPages=[],this._FocusChild=null,this._LatestFocusChild=null}GetParentPage(){return this._ParentPage}Focus(e){if(this.IsFocus()){if(!e)return void Je.LogI("Already focused page_name="+this.PageName);if(this._IsLeafInChain())return void Je.LogI("Already focused page_name="+this.PageName)}if(Ze.sChangingFocusLock)return void Ze.sDelayedFocusChanges.push(this);if(Ze.sChangingFocusLock=!0,this._ParentPage){let t,i=[],s=this;for(;s._ParentPage&&!s.IsFocus();)i.push(s),s=s._ParentPage;t=e&&0===i.length?this._FocusChild:i[i.length-1]._ParentPage._FocusChild;let n=[];for(;t;)n.push(t),t=t._FocusChild;for(let e=n.length-1;e>=0;e--)n[e]._BlurInternal();for(let e=i.length-1;e>=0;e--)i[e]._FocusInternal();if(!e){let e=i[0];for(;e._LatestFocusChild&&null===e._FocusChild;)e._LatestFocusChild._FocusInternal(),e=e._FocusChild,e||Je.ThrowError("ERROR: focus chain is broken")}}Ze.sChangingFocusLock=!1;let t=Ze.sDelayedFocusChanges.length;if(t>0){let e=Ze.sDelayedFocusChanges;Ze.sDelayedFocusChanges=[];for(let i=0;i<t;i++)e[i].Focus()}}_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()):Je.LogW("Not focus yet, page name="+this.PageName)}GetFocusChild(){return this._FocusChild}Hide(){this._AutoShow=!1,this._OnHideInternal()}Show(e){this._OnShowInternal(),e&&this.Focus()}OnFocus(){Je.LogW("No overrided Page OnFocus event, page name="+this.PageName)}OnBlur(){Je.LogW("No overrided Page OnBlur event, page name="+this.PageName)}OnShow(){Je.LogW("No overrided Page OnShow event, page name="+this.PageName)}OnHide(){Je.LogW("No overrided Page OnHide event, page name="+this.PageName)}_OnShowInternal(){let e;for(let t=0;t<this.SubPages.length;t++)e=this.SubPages[t],e._AutoShow&&e._OnShowInternal();this._IsShowing||(this._IsShowing=!0,this.OnShow())}_OnHideInternal(){let e;for(let t=0;t<this.SubPages.length;t++)e=this.SubPages[t],e._IsShowing&&e._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(e){null!==e&&(null!==this._CVSet&&this._CVSet.View.BindedPageBase(null),this._CVSet=new i.MainViewSetting(e,null),e.BindedPageBase(this))}OnContentViewLostInternal(){this.OnContentViewLost()}OnContentViewLost(){}GetHostActivity(){return this._HostActivity}SetHostActivity(e){this._HostActivity=e}GetTextureManager(){return null!==this._HostActivity?this._HostActivity.GetTextureManager():null}SetAutoShow(e){this._AutoShow=e}KeyLock(){this._KeyLock=!0}UnKeyLock(){this._KeyLock=!1}}function Qe(e){if(!e)throw Error("assert :P")}function et(e,t,i){for(var s=0;4>s;s++)if(e[t+s]!=i.charCodeAt(s))return!0;return!1}function tt(e,t,i,s,n){for(var r=0;r<n;r++)e[t+r]=i[s+r]}function it(e,t,i,s){for(var n=0;n<s;n++)e[t+n]=i}function st(e){return new Int32Array(e)}function nt(e,t){for(var i=[],s=0;s<e;s++)i.push(new t);return i}function rt(e,t){var i=[];return function e(i,s,n){for(var r=n[s],a=0;a<r&&(i.push(n.length>s+1?[]:new t),!(n.length<s+1));a++)e(i[a],s+1,n)}(i,0,e),i}function at(e,t){for(var i="",s=0;s<4;s++)i+=String.fromCharCode(e[t++]);return i}function ot(e,t){return(e[t+0]<<0|e[t+1]<<8|e[t+2]<<16)>>>0}function lt(e,t){return(e[t+0]<<0|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}Ze.LastFocusPage=null,Ze.sChangingFocusLock=!1,Ze.sDelayedFocusChanges=[],i.PageBase=Ze,console.log("Using JsView HTML Forge"),window.WebPDecoder=function(){function e(e,t){for(var i=1<<t-1>>>0;e&i;)i>>>=1;return i?(e&i-1)+i:e}function t(e,t,i,s,n){Qe(!(s%i));do{e[t+(s-=i)]=n}while(0<s)}function i(i,n,r,a,o){if(Qe(2328>=o),512>=o)var l=st(512);else if(null==(l=st(o)))return 0;return function(i,n,r,a,o,l){var h,c,u=n,d=1<<r,f=st(16),g=st(16);for(Qe(0!=o),Qe(null!=a),Qe(null!=i),Qe(0<r),c=0;c<o;++c){if(15<a[c])return 0;++f[a[c]]}if(f[0]==o)return 0;for(g[1]=0,h=1;15>h;++h){if(f[h]>1<<h)return 0;g[h+1]=g[h]+f[h]}for(c=0;c<o;++c)h=a[c],0<a[c]&&(l[g[h]++]=c);if(1==g[15])return(a=new s).g=0,a.value=l[0],t(i,u,1,d,a),d;var m,_=-1,p=d-1,w=0,v=1,y=1,b=1<<r;for(c=0,h=1,o=2;h<=r;++h,o<<=1){if(v+=y<<=1,0>(y-=f[h]))return 0;for(;0<f[h];--f[h])(a=new s).g=h,a.value=l[c++],t(i,u+w,o,b,a),w=e(w,h)}for(h=r+1,o=2;15>=h;++h,o<<=1){if(v+=y<<=1,0>(y-=f[h]))return 0;for(;0<f[h];--f[h]){if(a=new s,(w&p)!=_){for(u+=b,m=1<<(_=h)-r;15>_&&!(0>=(m-=f[_]));)++_,m<<=1;d+=b=1<<(m=_-r),i[n+(_=w&p)].g=m+r,i[n+_].value=u-n-_}a.g=h-r,a.value=l[c++],t(i,u+(w>>r),o,b,a),w=e(w,h)}}return v!=2*g[15]-1?0:d}(i,n,r,a,o,l)}function s(){this.value=this.g=0}function n(){this.value=this.g=0}function r(){this.G=nt(5,s),this.H=st(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=nt(Vi,n)}function a(e,t,i,s){Qe(null!=e),Qe(null!=t),Qe(2147483648>s),e.Ca=254,e.I=0,e.b=-8,e.Ka=0,e.oa=t,e.pa=i,e.Jd=t,e.Yc=i+s,e.Zc=4<=s?i+s-4+1:i,w(e)}function o(e,t){for(var i=0;0<t--;)i|=y(e,128)<<t;return i}function l(e,t){var i=o(e,t);return v(e)?-i:i}function h(e,t,i,s){var n,r=0;for(Qe(null!=e),Qe(null!=t),Qe(4294967288>s),e.Sb=s,e.Ra=0,e.u=0,e.h=0,4<s&&(s=4),n=0;n<s;++n)r+=t[i+n]<<8*n;e.Ra=r,e.bb=s,e.oa=t,e.pa=i}function c(e){for(;8<=e.u&&e.bb<e.Sb;)e.Ra>>>=8,e.Ra+=e.oa[e.pa+e.bb]<<Gi-8>>>0,++e.bb,e.u-=8;m(e)&&(e.h=1,e.u=0)}function u(e,t){if(Qe(0<=t),!e.h&&t<=Ni){var i=g(e)&ji[t];return e.u+=t,c(e),i}return e.h=1,e.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 f(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function g(e){return e.Ra>>>(e.u&Gi-1)>>>0}function m(e){return Qe(e.bb<=e.Sb),e.h||e.bb==e.Sb&&e.u>Gi}function _(e,t){e.u=t,e.h=m(e)}function p(e){e.u>=Bi&&(Qe(e.u>=Bi),c(e))}function w(e){Qe(null!=e&&null!=e.oa),e.pa<e.Zc?(e.I=(e.oa[e.pa++]|e.I<<8)>>>0,e.b+=8):(Qe(null!=e&&null!=e.oa),e.pa<e.Yc?(e.b+=8,e.I=e.oa[e.pa++]|e.I<<8):e.Ka?e.b=0:(e.I<<=8,e.b+=8,e.Ka=1))}function v(e){return o(e,1)}function y(e,t){var i=e.Ca;0>e.b&&w(e);var s=e.b,n=i*t>>>8,r=(e.I>>>s>n)+0;for(r?(i-=n,e.I-=n+1<<s>>>0):i=n+1,s=i,n=0;256<=s;)n+=8,s>>=8;return s=7^n+Ui[s],e.b-=s,e.Ca=(i<<s)-1,r}function b(e,t,i){e[t+0]=i>>24&255,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=i>>0&255}function T(e,t){return e[t+0]<<0|e[t+1]<<8}function S(e,t){return T(e,t)|e[t+2]<<16}function C(e,t){return T(e,t)|T(e,t+2)<<16}function E(e,t){var i=1<<t;return Qe(null!=e),Qe(0<t),e.X=st(i),null==e.X?0:(e.Mb=32-t,e.Xa=t,1)}function x(e,t){Qe(null!=e),Qe(null!=t),Qe(e.Xa==t.Xa),tt(t.X,0,e.X,0,1<<t.Xa)}function I(){this.X=[],this.Xa=this.Mb=0}function A(e,t,i,s){Qe(null!=i),Qe(null!=s);var n=i[0],r=s[0];return 0==n&&(n=(e*r+t/2)/t),0==r&&(r=(t*n+e/2)/e),0>=n||0>=r?0:(i[0]=n,s[0]=r,1)}function R(e,t){return e+(1<<t)-1>>>t}function P(e,t){return((4278255360&e)+(4278255360&t)>>>0&4278255360)+((16711935&e)+(16711935&t)>>>0&16711935)>>>0}function O(e,t){self[t]=function(t,i,s,n,r,a,o){var l;for(l=0;l<r;++l){var h=self[e](a[o+l-1],s,n+l);a[o+l]=P(t[i+l],h)}}}function L(){this.ud=this.hd=this.jd=0}function D(e,t){return((4278124286&(e^t))>>>1)+(e&t)>>>0}function k(e){return 0<=e&&256>e?e:0>e?0:255<e?255:void 0}function M(e,t){return k(e+(e-t+.5>>1))}function F(e,t,i){return Math.abs(t-i)-Math.abs(e-i)}function V(e,t,i,s,n,r,a){for(s=r[a-1],i=0;i<n;++i)r[a+i]=s=P(e[t+i],s)}function j(e,t,i,s,n){var r;for(r=0;r<i;++r){var a=e[t+r],o=a>>8&255,l=16711935&(l=(l=16711935&a)+((o<<16)+o));s[n+r]=(4278255360&a)+l>>>0}}function N(e,t){t.jd=e>>0&255,t.hd=e>>8&255,t.ud=e>>16&255}function G(e,t,i,s,n,r){var a;for(a=0;a<s;++a){var o=t[i+a],l=o>>>8,h=o,c=255&(c=(c=o>>>16)+((e.jd<<24>>24)*(l<<24>>24)>>>5));h=255&(h=(h=h+((e.hd<<24>>24)*(l<<24>>24)>>>5))+((e.ud<<24>>24)*(c<<24>>24)>>>5));n[r+a]=(4278255360&o)+(c<<16)+h}}function B(e,t,i,s,n){self[t]=function(e,t,i,r,a,o,l,h,c){for(r=l;r<h;++r)for(l=0;l<c;++l)a[o++]=n(i[s(e[t++])])},self[e]=function(e,t,r,a,o,l,h){var c=8>>e.b,u=e.Ea,d=e.K[0],f=e.w;if(8>c)for(e=(1<<e.b)-1,f=(1<<c)-1;t<r;++t){var g,m=0;for(g=0;g<u;++g)g&e||(m=s(a[o++])),l[h++]=n(d[m&f]),m>>=c}else self["VP8LMapColor"+i](a,o,d,f,l,h,t,r,u)}}function U(e,t,i,s,n){for(i=t+i;t<i;){var r=e[t++];s[n++]=r>>16&255,s[n++]=r>>8&255,s[n++]=r>>0&255}}function W(e,t,i,s,n){for(i=t+i;t<i;){var r=e[t++];s[n++]=r>>16&255,s[n++]=r>>8&255,s[n++]=r>>0&255,s[n++]=r>>24&255}}function H(e,t,i,s,n){for(i=t+i;t<i;){var r=(a=e[t++])>>16&240|a>>12&15,a=a>>0&240|a>>28&15;s[n++]=r,s[n++]=a}}function $(e,t,i,s,n){for(i=t+i;t<i;){var r=(a=e[t++])>>16&248|a>>13&7,a=a>>5&224|a>>3&31;s[n++]=r,s[n++]=a}}function K(e,t,i,s,n){for(i=t+i;t<i;){var r=e[t++];s[n++]=r>>0&255,s[n++]=r>>8&255,s[n++]=r>>16&255}}function Y(e,t,i,s,n,r){if(0==r)for(i=t+i;t<i;)b(s,((r=e[t++])[0]>>24|r[1]>>8&65280|r[2]<<8&16711680|r[3]<<24)>>>0),n+=32;else tt(s,n,e,t,i)}function z(e,t){self[t][0]=self[e+"0"],self[t][1]=self[e+"1"],self[t][2]=self[e+"2"],self[t][3]=self[e+"3"],self[t][4]=self[e+"4"],self[t][5]=self[e+"5"],self[t][6]=self[e+"6"],self[t][7]=self[e+"7"],self[t][8]=self[e+"8"],self[t][9]=self[e+"9"],self[t][10]=self[e+"10"],self[t][11]=self[e+"11"],self[t][12]=self[e+"12"],self[t][13]=self[e+"13"],self[t][14]=self[e+"0"],self[t][15]=self[e+"0"]}function X(e){return e==Bs||e==Us||e==Ws||e==Hs}function J(){this.eb=[],this.size=this.A=this.fb=0}function q(){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 J,this.f.kb=new q,this.sd=null}function Q(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function ee(){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 te(e){return alert("todo:WebPSamplerProcessPlane"),e.T}function ie(e,t){var i=e.T,s=t.ba.f.RGBA,n=s.eb,r=s.fb+e.ka*s.A,a=_n[t.ba.S],o=e.y,l=e.O,h=e.f,c=e.N,u=e.ea,d=e.W,f=t.cc,g=t.dc,m=t.Mc,_=t.Nc,p=e.ka,w=e.ka+e.T,v=e.U,y=v+1>>1;for(0==p?a(o,l,null,null,h,c,u,d,h,c,u,d,n,r,null,null,v):(a(t.ec,t.fc,o,l,f,g,m,_,h,c,u,d,n,r-s.A,n,r,v),++i);p+2<w;p+=2)f=h,g=c,m=u,_=d,c+=e.Rc,d+=e.Rc,r+=2*s.A,a(o,(l+=2*e.fa)-e.fa,o,l,f,g,m,_,h,c,u,d,n,r-s.A,n,r,v);return l+=e.fa,e.j+w<e.o?(tt(t.ec,t.fc,o,l,v),tt(t.cc,t.dc,h,c,y),tt(t.Mc,t.Nc,u,d,y),i--):1&w||a(o,l,null,null,h,c,u,d,h,c,u,d,n,r+s.A,null,null,v),i}function se(e,t,i){var s=e.F,n=[e.J];if(null!=s){var r=e.U,a=t.ba.S,o=a==js||a==Ws;t=t.ba.f.RGBA;var l=[0],h=e.ka;l[0]=e.T,e.Kb&&(0==h?--l[0]:(--h,n[0]-=e.width),e.j+e.ka+e.T==e.o&&(l[0]=e.o-e.j-h));var c=t.eb;h=t.fb+h*t.A;e=Ss(s,n[0],e.width,r,l,c,h+(o?0:3),t.A),Qe(i==l),e&&X(a)&&bs(c,h,o,r,l,t.A)}return 0}function ne(e){var t=e.ma,i=t.ba.S,s=11>i,n=i==Ms||i==Vs||i==js||i==Ns||12==i||X(i);if(t.memory=null,t.Ib=null,t.Jb=null,t.Nd=null,!ki(t.Oa,e,n?11:12))return 0;if(n&&X(i)&&pi(),e.da)alert("todo:use_scaling");else{if(s){if(t.Ib=te,e.Kb){if(i=e.U+1>>1,t.memory=st(e.U+2*i),null==t.memory)return 0;t.ec=t.memory,t.fc=0,t.cc=t.ec,t.dc=t.fc+e.U,t.Mc=t.cc,t.Nc=t.dc+i,t.Ib=ie,pi()}}else alert("todo:EmitYUV");n&&(t.Jb=se,s&&mi())}if(s&&!Pn){for(e=0;256>e;++e)On[e]=89858*(e-128)+En>>Cn,kn[e]=-22014*(e-128)+En,Dn[e]=-45773*(e-128),Ln[e]=113618*(e-128)+En>>Cn;for(e=xn;e<In;++e)t=76283*(e-16)+En>>Cn,Mn[e-xn]=Ve(t,255),Fn[e-xn]=Ve(t+8>>4,15);Pn=1}return 1}function re(e){var t=e.ma,i=e.U,s=e.T;return Qe(!(1&e.ka)),0>=i||0>=s?0:(i=t.Ib(e,t),null!=t.Jb&&t.Jb(e,t,i),t.Dc+=i,1)}function ae(e){e.ma.memory=null}function oe(e,t,i,s){return 47!=u(e,8)?0:(t[0]=u(e,14)+1,i[0]=u(e,14)+1,s[0]=u(e,1),0!=u(e,3)?0:!e.h)}function le(e,t){if(4>e)return e+1;var i=e-2>>1;return(2+(1&e)<<i)+u(t,i)+1}function he(e,t){return 120<t?t-120:1<=(i=((i=Js[t-1])>>4)*e+(8-(15&i)))?i:1;var i}function ce(e,t,i){var s=g(i),n=e[t+=255&s].g-8;return 0<n&&(_(i,i.u+8),s=g(i),t+=e[t].value,t+=s&(1<<n)-1),_(i,i.u+e[t].g),e[t].value}function ue(e,t,i){return i.g+=e.g,i.value+=e.value<<t>>>0,Qe(8>=i.g),e.g}function de(e,t,i){var s=e.xc;return Qe((t=0==s?0:e.vc[e.md*(i>>s)+(t>>s)])<e.Wb),e.Ya[t]}function fe(e,t,i,s){var n=e.ab,r=e.c*t,a=e.C;t=a+t;var o=i,l=s;for(s=e.Ta,i=e.Ua;0<n--;){var h=e.gc[n],c=a,u=t,d=o,f=l,g=(l=s,o=i,h.Ea);switch(Qe(c<u),Qe(u<=h.nc),h.hc){case 2:$i(d,f,(u-c)*g,l,o);break;case 0:var m=c,_=u,p=l,w=o,v=(C=h).Ea;0==m&&(Wi(d,f,null,null,1,p,w),V(d,f+1,0,0,v-1,p,w+1),f+=v,w+=v,++m);for(var y=1<<C.b,b=y-1,T=R(v,C.b),S=C.K,C=C.w+(m>>C.b)*T;m<_;){var E=S,x=C,I=1;for(Hi(d,f,p,w-v,1,p,w);I<v;){var A=(I&~b)+y;A>v&&(A=v),(0,Ji[E[x++]>>8&15])(d,f+ +I,p,w+I-v,A-I,p,w+I),I=A}f+=v,w+=v,++m&b||(C+=T)}u!=h.nc&&tt(l,o-g,l,o+(u-c-1)*g,g);break;case 1:for(g=d,_=f,v=(d=h.Ea)-(w=d&~(p=(f=1<<h.b)-1)),m=R(d,h.b),y=h.K,h=h.w+(c>>h.b)*m;c<u;){for(b=y,T=h,S=new L,C=_+w,E=_+d;_<C;)N(b[T++],S),qi(S,g,_,f,l,o),_+=f,o+=f;_<E&&(N(b[T++],S),qi(S,g,_,v,l,o),_+=v,o+=v),++c&p||(h+=m)}break;case 3:if(d==l&&f==o&&0<h.b){for(_=l,d=g=o+(u-c)*g-(w=(u-c)*R(h.Ea,h.b)),f=l,p=o,m=[],w=(v=w)-1;0<=w;--w)m[w]=f[p+w];for(w=v-1;0<=w;--w)_[d+w]=m[w];Ki(h,c,u,l,g,l,o)}else Ki(h,c,u,d,f,l,o)}o=s,l=i}l!=i&&tt(s,i,o,l,r)}function ge(e,t){var i=e.V,s=e.Ba+e.c*e.C,n=t-e.C;if(Qe(t<=e.l.o),Qe(16>=n),0<n){var r=e.l,a=e.Ta,o=e.Ua,l=r.width;if(fe(e,n,i,s),n=o=[o],Qe((i=e.C)<(s=t)),Qe(r.v<r.va),s>r.o&&(s=r.o),i<r.j){var h=r.j-i;i=r.j;n[0]+=h*l}if(i>=s?i=0:(n[0]+=4*r.v,r.ka=i-r.j,r.U=r.va-r.v,r.T=s-i,i=1),i){if(o=o[0],11>(i=e.ca).S){var c=i.f.RGBA,u=(s=i.S,n=r.U,r=r.T,h=c.eb,c.A),d=r;for(c=c.fb+e.Ma*c.A;0<d--;){var f=a,g=o,m=n,_=h,p=c;switch(s){case ks:Zi(f,g,m,_,p);break;case Ms:Qi(f,g,m,_,p);break;case Bs:Qi(f,g,m,_,p),bs(_,p,0,m,1,0);break;case Fs:is(f,g,m,_,p);break;case Vs:Y(f,g,m,_,p,1);break;case Us:Y(f,g,m,_,p,1),bs(_,p,0,m,1,0);break;case js:Y(f,g,m,_,p,0);break;case Ws:Y(f,g,m,_,p,0),bs(_,p,1,m,1,0);break;case Ns:es(f,g,m,_,p);break;case Hs:es(f,g,m,_,p),Ts(_,p,m,1,0);break;case Gs:ts(f,g,m,_,p);break;default:Qe(0)}o+=l,c+=u}e.Ma+=r}else alert("todo:EmitRescaledRowsYUVA");Qe(e.Ma<=i.height)}}e.C=t,Qe(e.C<=e.i)}function me(e){var t;if(0<e.ua)return 0;for(t=0;t<e.Wb;++t){var i=e.Ya[t].G,s=e.Ya[t].H;if(0<i[1][s[1]+0].g||0<i[2][s[2]+0].g||0<i[3][s[3]+0].g)return 0}return 1}function _e(e,t,i,s,n,r){if(0!=e.Z){var a=e.qd,o=e.rd;for(Qe(null!=mn[e.Z]);t<i;++t)mn[e.Z](a,o,s,n,s,n,r),a=s,o=n,n+=r;e.qd=a,e.rd=o}}function pe(e,t){var i=e.l.ma,s=0==i.Z||1==i.Z?e.l.j:e.C;s=e.C<s?s:e.C;if(Qe(t<=e.l.o),t>s){var n=e.l.width,r=i.ca,a=i.tb+n*s,o=e.V,l=e.Ba+e.c*s,h=e.gc;Qe(1==e.ab),Qe(3==h[0].hc),zi(h[0],s,t,o,l,r,a),_e(i,s,t,r,a,n)}e.C=e.Ma=t}function we(e,t,i,s,n,r,a){var o=e.$/s,l=e.$%s,h=e.m,c=e.s,u=i+e.$,d=u;n=i+s*n;var f=i+s*r,w=280+c.ua,v=e.Pb?o:16777216,y=0<c.ua?c.Wa:null,b=c.wc,T=u<f?de(c,l,o):null;Qe(e.C<r),Qe(f<=n);var S=!1;e:for(;;){for(;S||u<f;){var C=0;if(o>=v){var E=u-i;Qe((v=e).Pb),v.wd=v.m,v.xd=E,0<v.s.ua&&x(v.s.Wa,v.s.vb),v=o+Zs}if(l&b||(T=de(c,l,o)),Qe(null!=T),T.Qb&&(t[u]=T.qb,S=!0),!S)if(p(h),T.jc){C=h,E=t;var I=u,A=T.pd[g(C)&Vi-1];Qe(T.jc),256>A.g?(_(C,C.u+A.g),E[I]=A.value,C=0):(_(C,C.u+A.g-256),Qe(256<=A.value),C=A.value),0==C&&(S=!0)}else C=ce(T.G[0],T.H[0],h);if(h.h)break;if(S||256>C){if(!S)if(T.nd)t[u]=(T.qb|C<<8)>>>0;else{if(p(h),S=ce(T.G[1],T.H[1],h),p(h),E=ce(T.G[2],T.H[2],h),I=ce(T.G[3],T.H[3],h),h.h)break;t[u]=(I<<24|S<<16|C<<8|E)>>>0}if(S=!1,++u,++l>=s&&(l=0,++o,null!=a&&o<=r&&!(o%16)&&a(e,o),null!=y))for(;d<u;)C=t[d++],y.X[(506832829*C&4294967295)>>>y.Mb]=C}else if(280>C){if(C=le(C-256,h),E=ce(T.G[4],T.H[4],h),p(h),E=he(s,E=le(E,h)),h.h)break;if(u-i<E||n-u<C)break e;for(I=0;I<C;++I)t[u+I]=t[u+I-E];for(u+=C,l+=C;l>=s;)l-=s,++o,null!=a&&o<=r&&!(o%16)&&a(e,o);if(Qe(u<=n),l&b&&(T=de(c,l,o)),null!=y)for(;d<u;)C=t[d++],y.X[(506832829*C&4294967295)>>>y.Mb]=C}else{if(!(C<w))break e;for(S=C-280,Qe(null!=y);d<u;)C=t[d++],y.X[(506832829*C&4294967295)>>>y.Mb]=C;C=u,Qe(!(S>>>(E=y).Xa)),t[C]=E.X[S],S=!0}S||Qe(h.h==m(h))}if(e.Pb&&h.h&&u<n)Qe(e.m.h),e.a=5,e.m=e.wd,e.$=e.xd,0<e.s.ua&&x(e.s.vb,e.s.Wa);else{if(h.h)break e;null!=a&&a(e,o>r?r:o),e.a=0,e.$=u-i}return 1}return e.a=3,0}function ve(e){Qe(null!=e),e.vc=null,e.yc=null,e.Ya=null;var t=e.Wa;null!=t&&(t.X=null),e.vb=null,Qe(null!=e)}function ye(){var e=new ri;return null==e?null:(e.a=0,e.xb=gn,z("Predictor","VP8LPredictors"),z("Predictor","VP8LPredictors_C"),z("PredictorAdd","VP8LPredictorsAdd"),z("PredictorAdd","VP8LPredictorsAdd_C"),$i=j,qi=G,Zi=U,Qi=W,es=H,ts=$,is=K,self.VP8LMapColor32b=Yi,self.VP8LMapColor8b=Xi,e)}function be(e,t,n,a,o){var l=1,h=[e],c=[t],d=a.m,f=a.s,m=null,w=0;e:for(;;){if(n)for(;l&&u(d,1);){var v=h,y=c,b=a,T=1,S=b.m,C=b.gc[b.ab],x=u(S,2);if(b.Oc&1<<x)l=0;else{switch(b.Oc|=1<<x,C.hc=x,C.Ea=v[0],C.nc=y[0],C.K=[null],++b.ab,Qe(4>=b.ab),x){case 0:case 1:C.b=u(S,3)+2,T=be(R(C.Ea,C.b),R(C.nc,C.b),0,b,C.K),C.K=C.K[0];break;case 3:var I,A=u(S,8)+1,O=16<A?0:4<A?1:2<A?2:3;if(v[0]=R(C.Ea,O),C.b=O,I=T=be(A,1,0,b,C.K)){var L,D=A,k=C,M=1<<(8>>k.b),F=st(M);if(null==F)I=0;else{var V=k.K[0],j=k.w;for(F[0]=k.K[0][0],L=1;L<1*D;++L)F[L]=P(V[j+L],F[L-1]);for(;L<4*M;++L)F[L]=0;k.K[0]=null,k.K[0]=F,I=1}}T=I;break;case 2:break;default:Qe(0)}l=T}}if(h=h[0],c=c[0],l&&u(d,1)&&!(l=1<=(w=u(d,4))&&11>=w)){a.a=3;break e}var N;if(N=l)t:{var G,B,U,W=a,H=h,$=c,K=w,Y=n,z=W.m,X=W.s,J=[null],q=1,Z=0,Q=qs[K];i:for(;;){if(Y&&u(z,1)){var ee=u(z,3)+2,te=R(H,ee),ie=R($,ee),se=te*ie;if(!be(te,ie,0,W,J))break i;for(J=J[0],X.xc=ee,G=0;G<se;++G){var ne=J[G]>>8&65535;J[G]=ne,ne>=q&&(q=ne+1)}}if(z.h)break i;for(B=0;5>B;++B){var re=Ys[B];!B&&0<K&&(re+=1<<K),Z<re&&(Z=re)}var ae=nt(q*Q,s),oe=q,le=nt(oe,r);if(null==le)var he=null;else Qe(65536>=oe),he=le;var ce=st(Z);if(null==he||null==ce||null==ae){W.a=1;break i}var de=ae;for(G=U=0;G<q;++G){var fe=he[G],ge=fe.G,me=fe.H,_e=0,pe=1,ye=0;for(B=0;5>B;++B){re=Ys[B],ge[B]=de,me[B]=U,!B&&0<K&&(re+=1<<K);s:{var Te,Se=re,Ce=W,Ee=ce,xe=de,Ie=U,Ae=0,Re=Ce.m,Pe=u(Re,1);if(it(Ee,0,0,Se),Pe){var Oe=u(Re,1)+1,Le=u(Re,1),De=u(Re,0==Le?1:8);Ee[De]=1,2==Oe&&(Ee[De=u(Re,8)]=1);var ke=1}else{var Me=st(19),Fe=u(Re,4)+4;if(19<Fe){Ce.a=3;var Ve=0;break s}for(Te=0;Te<Fe;++Te)Me[Xs[Te]]=u(Re,3);var je=void 0,Ne=void 0,Ge=Ce,Be=Me,Ue=Se,We=Ee,He=0,$e=Ge.m,Ke=8,Ye=nt(128,s);n:for(;i(Ye,0,7,Be,19);){if(u($e,1)){var ze=2+2*u($e,3);if((je=2+u($e,ze))>Ue)break n}else je=Ue;for(Ne=0;Ne<Ue&&je--;){p($e);var Xe=Ye[0+(127&g($e))];_($e,$e.u+Xe.g);var Je=Xe.value;if(16>Je)We[Ne++]=Je,0!=Je&&(Ke=Je);else{var qe=16==Je,Ze=Je-16,et=Ks[Ze],tt=u($e,$s[Ze])+et;if(Ne+tt>Ue)break n;for(var rt=qe?Ke:0;0<tt--;)We[Ne++]=rt}}He=1;break n}He||(Ge.a=3),ke=He}(ke=ke&&!Re.h)&&(Ae=i(xe,Ie,8,Ee,Se)),ke&&0!=Ae?Ve=Ae:(Ce.a=3,Ve=0)}if(0==Ve)break i;if(pe&&1==zs[B]&&(pe=0==de[U].g),_e+=de[U].g,U+=Ve,3>=B){var at,ot=ce[0];for(at=1;at<re;++at)ce[at]>ot&&(ot=ce[at]);ye+=ot}}if(fe.nd=pe,fe.Qb=0,pe&&(fe.qb=(ge[3][me[3]+0].value<<24|ge[1][me[1]+0].value<<16|ge[2][me[2]+0].value)>>>0,0==_e&&256>ge[0][me[0]+0].value&&(fe.Qb=1,fe.qb+=ge[0][me[0]+0].value<<8)),fe.jc=!fe.Qb&&6>ye,fe.jc){var lt,ht=fe;for(lt=0;lt<Vi;++lt){var ct=lt,ut=ht.pd[ct],dt=ht.G[0][ht.H[0]+ct];256<=dt.value?(ut.g=dt.g+256,ut.value=dt.value):(ut.g=0,ut.value=0,ct>>=ue(dt,8,ut),ct>>=ue(ht.G[1][ht.H[1]+ct],16,ut),ct>>=ue(ht.G[2][ht.H[2]+ct],0,ut),ue(ht.G[3][ht.H[3]+ct],24,ut))}}}X.vc=J,X.Wb=q,X.Ya=he,X.yc=ae,N=1;break t}N=0}if(!(l=N)){a.a=3;break e}if(0<w){if(f.ua=1<<w,!E(f.Wa,w)){a.a=1,l=0;break e}}else f.ua=0;var ft=a,gt=h,mt=c,_t=ft.s,pt=_t.xc;if(ft.c=gt,ft.i=mt,_t.md=R(gt,pt),_t.wc=0==pt?-1:(1<<pt)-1,n){a.xb=fn;break e}if(null==(m=st(h*c))){a.a=1,l=0;break e}l=(l=we(a,m,0,h,c,c,null))&&!d.h;break e}return l?(null!=o?o[0]=m:(Qe(null==m),Qe(n)),a.$=0,n||ve(f)):ve(f),l}function Te(e,t){var i=e.c*e.i,s=i+t+16*t;return Qe(e.c<=t),e.V=st(s),null==e.V?(e.Ta=null,e.Ua=0,e.a=1,0):(e.Ta=e.V,e.Ua=e.Ba+i+t,1)}function Se(e,t){var i=e.C,s=t-i,n=e.V,r=e.Ba+e.c*i;for(Qe(t<=e.l.o);0<s;){var a=16<s?16:s,o=e.l.ma,l=e.l.width,h=l*a,c=o.ca,u=o.tb+l*i,d=e.Ta,f=e.Ua;fe(e,a,n,r),Cs(d,f,c,u,h),_e(o,i,i+a,c,u,l),s-=a,n+=a*e.c,i+=a}Qe(i==t),e.C=e.Ma=t}function Ce(){this.ub=this.yd=this.td=this.Rb=0}function Ee(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function xe(){this.Fb=this.Bb=this.Cb=0,this.Zb=st(4),this.Lb=st(4)}function Ie(){this.Yb=function(){var e=[];return function e(t,i,s){for(var n=s[i],r=0;r<n&&(t.push(s.length>i+1?[]:0),!(s.length<i+1));r++)e(t[r],i+1,s)}(e,0,[3,11]),e}()}function Ae(){this.jb=st(3),this.Wc=rt([4,8],Ie),this.Xc=rt([4,17],Ie)}function Re(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new st(4),this.od=new st(4)}function Pe(){this.ld=this.La=this.dd=this.tc=0}function Oe(){this.Na=this.la=0}function Le(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function De(){this.ad=st(384),this.Za=0,this.Ob=st(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function ke(){this.uc=this.M=this.Nb=0,this.wa=Array(new Pe),this.Y=0,this.ya=Array(new De),this.aa=0,this.l=new je}function Me(){this.y=st(16),this.f=st(8),this.ea=st(8)}function Fe(){this.cb=this.a=0,this.sc="",this.m=new d,this.Od=new Ce,this.Kc=new Ee,this.ed=new Re,this.Qa=new xe,this.Ic=this.$c=this.Aa=0,this.D=new ke,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=nt(8,d),this.ia=0,this.pb=nt(4,Le),this.Pa=new Ae,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Me),this.Hd=0,this.rb=Array(new Oe),this.sb=0,this.wa=Array(new Pe),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 De),this.L=this.aa=0,this.gd=rt([4,2],Pe),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 Ve(e,t){return 0>e?0:e>t?t:e}function je(){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 Ne(){var e=new Fe;return null!=e&&(e.a=0,e.sc="OK",e.cb=0,e.Xb=0,tn||(tn=We)),e}function Ge(e,t,i){return 0==e.a&&(e.a=t,e.sc=i,e.cb=0),0}function Be(e,t,i){return 3<=i&&157==e[t+0]&&1==e[t+1]&&42==e[t+2]}function Ue(e,t){if(null==e)return 0;if(e.a=0,e.sc="OK",null==t)return Ge(e,2,"null VP8Io passed to VP8GetHeaders()");var i=t.data,s=t.w,n=t.ha;if(4>n)return Ge(e,7,"Truncated header.");var r=i[s+0]|i[s+1]<<8|i[s+2]<<16,h=e.Od;if(h.Rb=!(1&r),h.td=r>>1&7,h.yd=r>>4&1,h.ub=r>>5,3<h.td)return Ge(e,3,"Incorrect keyframe parameters.");if(!h.yd)return Ge(e,4,"Frame not displayable.");s+=3,n-=3;var c=e.Kc;if(h.Rb){if(7>n)return Ge(e,7,"cannot parse picture header");if(!Be(i,s,n))return Ge(e,3,"Bad code word");c.c=16383&(i[s+4]<<8|i[s+3]),c.Td=i[s+4]>>6,c.i=16383&(i[s+6]<<8|i[s+5]),c.Ud=i[s+6]>>6,s+=7,n-=7,e.za=c.c+15>>4,e.Ub=c.i+15>>4,t.width=c.c,t.height=c.i,t.Da=0,t.j=0,t.v=0,t.va=t.width,t.o=t.height,t.da=0,t.ib=t.width,t.hb=t.height,t.U=t.width,t.T=t.height,it((r=e.Pa).jb,0,255,r.jb.length),Qe(null!=(r=e.Qa)),r.Cb=0,r.Bb=0,r.Fb=1,it(r.Zb,0,0,r.Zb.length),it(r.Lb,0,0,r.Lb)}if(h.ub>n)return Ge(e,7,"bad partition length");a(r=e.m,i,s,h.ub),s+=h.ub,n-=h.ub,h.Rb&&(c.Ld=v(r),c.Kd=v(r)),c=e.Qa;var u,d=e.Pa;if(Qe(null!=r),Qe(null!=c),c.Cb=v(r),c.Cb){if(c.Bb=v(r),v(r)){for(c.Fb=v(r),u=0;4>u;++u)c.Zb[u]=v(r)?l(r,7):0;for(u=0;4>u;++u)c.Lb[u]=v(r)?l(r,6):0}if(c.Bb)for(u=0;3>u;++u)d.jb[u]=v(r)?o(r,8):255}else c.Bb=0;if(r.Ka)return Ge(e,3,"cannot parse segment header");if((c=e.ed).zd=v(r),c.Tb=o(r,6),c.wb=o(r,3),c.Pc=v(r),c.Pc&&v(r)){for(d=0;4>d;++d)v(r)&&(c.vd[d]=l(r,6));for(d=0;4>d;++d)v(r)&&(c.od[d]=l(r,6))}if(e.L=0==c.Tb?0:c.zd?1:2,r.Ka)return Ge(e,3,"cannot parse filter header");var f=n;if(n=u=s,s=u+f,c=f,e.Xb=(1<<o(e.m,2))-1,f<3*(d=e.Xb))i=7;else{for(u+=3*d,c-=3*d,f=0;f<d;++f){var g=i[n+0]|i[n+1]<<8|i[n+2]<<16;g>c&&(g=c),a(e.Jc[+f],i,u,g),u+=g,c-=g,n+=3}a(e.Jc[+d],i,u,c),i=u<s?0:5}if(0!=i)return Ge(e,i,"cannot parse partitions");for(i=o(u=e.m,7),n=v(u)?l(u,4):0,s=v(u)?l(u,4):0,c=v(u)?l(u,4):0,d=v(u)?l(u,4):0,u=v(u)?l(u,4):0,f=e.Qa,g=0;4>g;++g){if(f.Cb){var m=f.Zb[g];f.Fb||(m+=i)}else{if(0<g){e.pb[g]=e.pb[0];continue}m=i}var _=e.pb[g];_.Sc[0]=Qs[Ve(m+n,127)],_.Sc[1]=en[Ve(m+0,127)],_.Eb[0]=2*Qs[Ve(m+s,127)],_.Eb[1]=101581*en[Ve(m+c,127)]>>16,8>_.Eb[1]&&(_.Eb[1]=8),_.Qc[0]=Qs[Ve(m+d,117)],_.Qc[1]=en[Ve(m+u,127)],_.lc=m+u}if(!h.Rb)return Ge(e,4,"Not a key frame.");for(v(r),h=e.Pa,i=0;4>i;++i){for(n=0;8>n;++n)for(s=0;3>s;++s)for(c=0;11>c;++c)d=y(r,ln[i][n][s][c])?o(r,8):an[i][n][s][c],h.Wc[i][n].Yb[s][c]=d;for(n=0;17>n;++n)h.Xc[i][n]=h.Wc[i][hn[n]]}return e.kc=v(r),e.kc&&(e.Bd=o(r,8)),e.cb=1}function We(e,t,i,s,n,r,a){var o=t[n].Yb[i];for(i=0;16>n;++n){if(!y(e,o[i+0]))return n;for(;!y(e,o[i+1]);)if(o=t[++n].Yb[0],i=0,16==n)return 16;var l=t[n+1].Yb;if(y(e,o[i+2])){var h=e,c=0;if(y(h,(d=o)[(u=i)+3]))if(y(h,d[u+6])){for(o=0,u=2*(c=y(h,d[u+8]))+(d=y(h,d[u+9+c])),c=0,d=sn[u];d[o];++o)c+=c+y(h,d[o]);c+=3+(8<<u)}else y(h,d[u+7])?(c=7+2*y(h,165),c+=y(h,145)):c=5+y(h,159);else c=y(h,d[u+4])?3+y(h,d[u+5]):2;o=l[2]}else c=1,o=l[1];l=a+nn[n],0>(h=e).b&&w(h);var u,d=h.b,f=(u=h.Ca>>1)-(h.I>>d)>>31;--h.b,h.Ca+=f,h.Ca|=1,h.I-=(u+1&f)<<d,r[l]=((c^f)-f)*s[(0<n)+0]}return 16}function He(e){var t=e.rb[e.sb-1];t.la=0,t.Na=0,it(e.zc,0,0,e.zc.length),e.ja=0}function $e(e,t){if(null==e)return 0;if(null==t)return Ge(e,2,"NULL VP8Io parameter in VP8Decode().");if(!e.cb&&!Ue(e,t))return 0;if(Qe(e.cb),null==t.ac||t.ac(t)){t.ob&&(e.L=0);var i=jn[e.L];if(2==e.L?(e.yb=0,e.zb=0):(e.yb=t.v-i>>4,e.zb=t.j-i>>4,0>e.yb&&(e.yb=0),0>e.zb&&(e.zb=0)),e.Va=t.o+15+i>>4,e.Hb=t.va+15+i>>4,e.Hb>e.za&&(e.Hb=e.za),e.Va>e.Ub&&(e.Va=e.Ub),0<e.L){var s=e.ed;for(i=0;4>i;++i){var n;if(e.Qa.Cb){var r=e.Qa.Lb[i];e.Qa.Fb||(r+=s.Tb)}else r=s.Tb;for(n=0;1>=n;++n){var a=e.gd[i][n],o=r;if(s.Pc&&(o+=s.vd[0],n&&(o+=s.od[0])),0<(o=0>o?0:63<o?63:o)){var l=o;0<s.wb&&((l=4<s.wb?l>>2:l>>1)>9-s.wb&&(l=9-s.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=n}}}i=0}else Ge(e,6,"Frame setup failed"),i=e.a;if(i=0==i){if(i){e.$c=0,0<e.Aa||(e.Ic=Gn);e:{i=e.Ic;s=4*(l=e.za);var h=32*l,c=l+1,u=0<e.L?l*(0<e.Aa?2:1):0,d=(2==e.Aa?2:1)*l;if((a=s+832+(n=3*(16*i+jn[e.L])/2*h)+(r=null!=e.Fa&&0<e.Fa.length?e.Kc.c*e.Kc.i:0))!=a)i=0;else{if(a>e.Vb){if(e.Vb=0,e.Ec=st(a),e.Fc=0,null==e.Ec){i=Ge(e,1,"no memory during frame initialization.");break e}e.Vb=a}a=e.Ec,o=e.Fc,e.Ac=a,e.Bc=o,o+=s,e.Gd=nt(h,Me),e.Hd=0,e.rb=nt(c+1,Oe),e.sb=1,e.wa=u?nt(u,Pe):null,e.Y=0,e.D.Nb=0,e.D.wa=e.wa,e.D.Y=e.Y,0<e.Aa&&(e.D.Y+=l),Qe(!0),e.oc=a,e.pc=o,o+=832,e.ya=nt(d,De),e.aa=0,e.D.ya=e.ya,e.D.aa=e.aa,2==e.Aa&&(e.D.aa+=l),e.R=16*l,e.B=8*l,l=(h=jn[e.L])*e.R,h=h/2*e.B,e.sa=a,e.ta=o+l,e.qa=e.sa,e.ra=e.ta+16*i*e.R+h,e.Ha=e.qa,e.Ia=e.ra+8*i*e.B+h,e.$c=0,o+=n,e.mb=r?a:null,e.nb=r?o:null,Qe(o+r<=e.Fc+e.Vb),He(e),it(e.Ac,e.Bc,0,s),i=1}}if(i){if(t.ka=0,t.y=e.sa,t.O=e.ta,t.f=e.qa,t.N=e.ra,t.ea=e.Ha,t.Vd=e.Ia,t.fa=e.R,t.Rc=e.B,t.F=null,t.J=0,!Rs){for(i=-255;255>=i;++i)Es[255+i]=0>i?-i:i;for(i=-1020;1020>=i;++i)xs[1020+i]=-128>i?-128:127<i?127:i;for(i=-112;112>=i;++i)Is[112+i]=-16>i?-16:15<i?15:i;for(i=-255;510>=i;++i)As[255+i]=0>i?0:255<i?255:i;Rs=1}ss=lt,ns=qe,as=Ze,os=at,ls=ot,rs=Je,hs=Yt,cs=zt,us=qt,ds=Zt,fs=Xt,gs=Jt,ms=Qt,_s=ei,ps=Bt,ws=Ut,vs=Wt,ys=Ht,un[0]=St,un[1]=ct,un[2]=bt,un[3]=Tt,un[4]=Ct,un[5]=xt,un[6]=Et,un[7]=It,un[8]=Rt,un[9]=At,cn[0]=_t,cn[1]=dt,cn[2]=ft,cn[3]=gt,cn[4]=pt,cn[5]=wt,cn[6]=vt,dn[0]=Dt,dn[1]=ut,dn[2]=Pt,dn[3]=Ot,dn[4]=Mt,dn[5]=kt,dn[6]=Ft,i=1}else i=0}i&&(i=function(e,t){for(e.M=0;e.M<e.Va;++e.M){var i,s=e.Jc[e.M&e.Xb],n=e.m,r=e;for(i=0;i<r.za;++i){var a=n,o=r,l=o.Ac,h=o.Bc+4*i,c=o.zc,u=o.ya[o.aa+i];if(o.Qa.Bb?u.$b=y(a,o.Pa.jb[0])?2+y(a,o.Pa.jb[2]):y(a,o.Pa.jb[1]):u.$b=0,o.kc&&(u.Ad=y(a,o.Bd)),u.Za=!y(a,145)+0,u.Za){var d=u.Ob,f=0;for(o=0;4>o;++o){var g,m=c[0+o];for(g=0;4>g;++g){m=on[l[h+g]][m];for(var _=rn[y(a,m[0])];0<_;)_=rn[2*_+y(a,m[_])];m=-_,l[h+g]=m}tt(d,f,l,h,4),f+=4,c[0+o]=m}}else m=y(a,156)?y(a,128)?1:3:y(a,163)?2:0,u.Ob[0]=m,it(l,h,m,4),it(c,0,m,4);u.Dd=y(a,142)?y(a,114)?y(a,183)?1:3:2:0}if(r.m.Ka)return Ge(e,7,"Premature end-of-partition0 encountered.");for(;e.ja<e.za;++e.ja){if(r=s,a=(n=e).rb[n.sb-1],l=n.rb[n.sb+n.ja],i=n.ya[n.aa+n.ja],h=n.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=n.Pa.Xc,c=n.ya[n.aa+n.ja],u=n.pb[c.$b],o=c.ad,d=0,f=n.rb[n.sb-1],m=g=0,it(o,d,0,384),c.Za)var v=0,b=h[3];else{_=st(16);var T=a.Na+f.Na;if(T=tn(l,h[1],T,u.Eb,0,_,0),a.Na=f.Na=(0<T)+0,1<T)ss(_,0,o,d);else{var S=_[0]+3>>3;for(_=0;256>_;_+=16)o[d+_]=S}v=1,b=h[0]}var C=15&a.la,E=15&f.la;for(_=0;4>_;++_){var x=1&E;for(S=w=0;4>S;++S)C=C>>1|(x=(T=tn(l,b,T=x+(1&C),u.Sc,v,o,d))>v)<<7,w=w<<2|(3<T?3:1<T?2:0!=o[d+0]),d+=16;C>>=4,E=E>>1|x<<7,g=(g<<8|w)>>>0}for(b=C,v=E>>4,p=0;4>p;p+=2){for(w=0,C=a.la>>4+p,E=f.la>>4+p,_=0;2>_;++_){for(x=1&E,S=0;2>S;++S)T=x+(1&C),C=C>>1|(x=0<(T=tn(l,h[2],T,u.Qc,0,o,d)))<<3,w=w<<2|(3<T?3:1<T?2:0!=o[d+0]),d+=16;C>>=2,E=E>>1|x<<5}m|=w<<4*p,b|=C<<4<<p,v|=(240&E)<<p}a.la=b,f.la=v,c.Hc=g,c.Gc=m,c.ia=43690&m?0:u.ia,h=!(g|m)}if(0<n.L&&(n.wa[n.Y+n.ja]=n.gd[i.$b][i.Za],n.wa[n.Y+n.ja].La|=!h),r.Ka)return Ge(e,7,"Premature end-of-file encountered.")}if(He(e),n=t,r=1,i=(s=e).D,a=0<s.L&&s.M>=s.zb&&s.M<=s.Va,0==s.Aa)e:{if(i.M=s.M,i.uc=a,Li(s,i),r=1,i=(w=s.D).Nb,a=(m=jn[s.L])*s.R,l=m/2*s.B,_=16*i*s.R,S=8*i*s.B,h=s.sa,c=s.ta-a+_,u=s.qa,o=s.ra-l+S,d=s.Ha,f=s.Ia-l+S,E=0==(C=w.M),g=C>=s.Va-1,2==s.Aa&&Li(s,w),w.uc)for(x=(T=s).D.M,Qe(T.D.uc),w=T.yb;w<T.Hb;++w){v=w,b=x;var I=(A=(V=T).D).Nb;p=V.R;var A=A.wa[A.Y+v],R=V.sa,P=V.ta+16*I*p+16*v,O=A.dd,L=A.tc;if(0!=L)if(Qe(3<=L),1==V.L)0<v&&ws(R,P,p,L+4),A.La&&ys(R,P,p,L),0<b&&ps(R,P,p,L+4),A.La&&vs(R,P,p,L);else{var D=V.B,k=V.qa,M=V.ra+8*I*D+8*v,F=V.Ha,V=V.Ia+8*I*D+8*v;I=A.ld,0<v&&(cs(R,P,p,L+4,O,I),ds(k,M,F,V,D,L+4,O,I)),A.La&&(gs(R,P,p,L,O,I),_s(k,M,F,V,D,L,O,I)),0<b&&(hs(R,P,p,L+4,O,I),us(k,M,F,V,D,L+4,O,I)),A.La&&(fs(R,P,p,L,O,I),ms(k,M,F,V,D,L,O,I))}}if(s.ia&&alert("todo:DitherRow"),null!=n.put){if(w=16*C,C=16*(C+1),E?(n.y=s.sa,n.O=s.ta+_,n.f=s.qa,n.N=s.ra+S,n.ea=s.Ha,n.W=s.Ia+S):(w-=m,n.y=h,n.O=c,n.f=u,n.N=o,n.ea=d,n.W=f),g||(C-=m),C>n.o&&(C=n.o),n.F=null,n.J=null,null!=s.Fa&&0<s.Fa.length&&w<C&&(n.J=ci(s,n,w,C-w),n.F=s.mb,null==n.F&&0==n.F.length)){r=Ge(s,3,"Could not decode alpha data.");break e}w<n.j&&(m=n.j-w,w=n.j,Qe(!(1&m)),n.O+=s.R*m,n.N+=s.B*(m>>1),n.W+=s.B*(m>>1),null!=n.F&&(n.J+=n.width*m)),w<C&&(n.O+=n.v,n.N+=n.v>>1,n.W+=n.v>>1,null!=n.F&&(n.J+=n.v),n.ka=w-n.j,n.U=n.va-n.v,n.T=C-w,r=n.put(n))}i+1!=s.Ic||g||(tt(s.sa,s.ta-a,h,c+16*s.R,a),tt(s.qa,s.ra-l,u,o+8*s.B,l),tt(s.Ha,s.Ia-l,d,f+8*s.B,l))}if(!r)return Ge(e,6,"Output aborted.")}return 1}(e,t)),null!=t.bc&&t.bc(t),i&=1}return i?(e.cb=0,i):0}function Ke(e,t,i,s,n){n=e[t+i+32*s]+(n>>3),e[t+i+32*s]=-256&n?0>n?0:255:n}function Ye(e,t,i,s,n,r){Ke(e,t,0,i,s+n),Ke(e,t,1,i,s+r),Ke(e,t,2,i,s-r),Ke(e,t,3,i,s-n)}function ze(e){return(20091*e>>16)+e}function Xe(e,t,i,s){var n,r=0,a=st(16);for(n=0;4>n;++n){var o=e[t+0]+e[t+8],l=e[t+0]-e[t+8],h=(35468*e[t+4]>>16)-ze(e[t+12]),c=ze(e[t+4])+(35468*e[t+12]>>16);a[r+0]=o+c,a[r+1]=l+h,a[r+2]=l-h,a[r+3]=o-c,r+=4,t++}for(n=r=0;4>n;++n)o=(e=a[r+0]+4)+a[r+8],l=e-a[r+8],h=(35468*a[r+4]>>16)-ze(a[r+12]),Ke(i,s,0,0,o+(c=ze(a[r+4])+(35468*a[r+12]>>16))),Ke(i,s,1,0,l+h),Ke(i,s,2,0,l-h),Ke(i,s,3,0,o-c),r++,s+=32}function Je(e,t,i,s){var n=e[t+0]+4,r=35468*e[t+4]>>16,a=ze(e[t+4]),o=35468*e[t+1]>>16;Ye(i,s,0,n+a,e=ze(e[t+1]),o),Ye(i,s,1,n+r,e,o),Ye(i,s,2,n-r,e,o),Ye(i,s,3,n-a,e,o)}function qe(e,t,i,s,n){Xe(e,t,i,s),n&&Xe(e,t+16,i,s+4)}function Ze(e,t,i,s){ns(e,t+0,i,s,1),ns(e,t+32,i,s+128,1)}function at(e,t,i,s){var n;for(e=e[t+0]+4,n=0;4>n;++n)for(t=0;4>t;++t)Ke(i,s,t,n,e)}function ot(e,t,i,s){e[t+0]&&os(e,t+0,i,s),e[t+16]&&os(e,t+16,i,s+4),e[t+32]&&os(e,t+32,i,s+128),e[t+48]&&os(e,t+48,i,s+128+4)}function lt(e,t,i,s){var n,r=st(16);for(n=0;4>n;++n){var a=e[t+0+n]+e[t+12+n],o=e[t+4+n]+e[t+8+n],l=e[t+4+n]-e[t+8+n],h=e[t+0+n]-e[t+12+n];r[0+n]=a+o,r[8+n]=a-o,r[4+n]=h+l,r[12+n]=h-l}for(n=0;4>n;++n)a=(e=r[0+4*n]+3)+r[3+4*n],o=r[1+4*n]+r[2+4*n],l=r[1+4*n]-r[2+4*n],h=e-r[3+4*n],i[s+0]=a+o>>3,i[s+16]=h+l>>3,i[s+32]=a-o>>3,i[s+48]=h-l>>3,s+=64}function ht(e,t,i){var s,n=t-32,r=Ls,a=255-e[n-1];for(s=0;s<i;++s){var o,l=r,h=a+e[t-1];for(o=0;o<i;++o)e[t+o]=l[h+e[n+o]];t+=32}}function ct(e,t){ht(e,t,4)}function ut(e,t){ht(e,t,8)}function dt(e,t){ht(e,t,16)}function ft(e,t){var i;for(i=0;16>i;++i)tt(e,t+32*i,e,t-32,16)}function gt(e,t){var i;for(i=16;0<i;--i)it(e,t,e[t-1],16),t+=32}function mt(e,t,i){var s;for(s=0;16>s;++s)it(t,i+32*s,e,16)}function _t(e,t){var i,s=16;for(i=0;16>i;++i)s+=e[t-1+32*i]+e[t+i-32];mt(s>>5,e,t)}function pt(e,t){var i,s=8;for(i=0;16>i;++i)s+=e[t-1+32*i];mt(s>>4,e,t)}function wt(e,t){var i,s=8;for(i=0;16>i;++i)s+=e[t+i-32];mt(s>>4,e,t)}function vt(e,t){mt(128,e,t)}function yt(e,t,i){return e+2*t+i+2>>2}function bt(e,t){var i,s=t-32;s=new Uint8Array([yt(e[s-1],e[s+0],e[s+1]),yt(e[s+0],e[s+1],e[s+2]),yt(e[s+1],e[s+2],e[s+3]),yt(e[s+2],e[s+3],e[s+4])]);for(i=0;4>i;++i)tt(e,t+32*i,s,0,s.length)}function Tt(e,t){var i=e[t-1],s=e[t-1+32],n=e[t-1+64],r=e[t-1+96];b(e,t+0,16843009*yt(e[t-1-32],i,s)),b(e,t+32,16843009*yt(i,s,n)),b(e,t+64,16843009*yt(s,n,r)),b(e,t+96,16843009*yt(n,r,r))}function St(e,t){var i,s=4;for(i=0;4>i;++i)s+=e[t+i-32]+e[t-1+32*i];for(s>>=3,i=0;4>i;++i)it(e,t+32*i,s,4)}function Ct(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1-32],a=e[t+0-32],o=e[t+1-32],l=e[t+2-32],h=e[t+3-32];e[t+0+96]=yt(s,n,e[t-1+96]),e[t+1+96]=e[t+0+64]=yt(i,s,n),e[t+2+96]=e[t+1+64]=e[t+0+32]=yt(r,i,s),e[t+3+96]=e[t+2+64]=e[t+1+32]=e[t+0+0]=yt(a,r,i),e[t+3+64]=e[t+2+32]=e[t+1+0]=yt(o,a,r),e[t+3+32]=e[t+2+0]=yt(l,o,a),e[t+3+0]=yt(h,l,o)}function Et(e,t){var i=e[t+1-32],s=e[t+2-32],n=e[t+3-32],r=e[t+4-32],a=e[t+5-32],o=e[t+6-32],l=e[t+7-32];e[t+0+0]=yt(e[t+0-32],i,s),e[t+1+0]=e[t+0+32]=yt(i,s,n),e[t+2+0]=e[t+1+32]=e[t+0+64]=yt(s,n,r),e[t+3+0]=e[t+2+32]=e[t+1+64]=e[t+0+96]=yt(n,r,a),e[t+3+32]=e[t+2+64]=e[t+1+96]=yt(r,a,o),e[t+3+64]=e[t+2+96]=yt(a,o,l),e[t+3+96]=yt(o,l,l)}function xt(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1-32],a=e[t+0-32],o=e[t+1-32],l=e[t+2-32],h=e[t+3-32];e[t+0+0]=e[t+1+64]=r+a+1>>1,e[t+1+0]=e[t+2+64]=a+o+1>>1,e[t+2+0]=e[t+3+64]=o+l+1>>1,e[t+3+0]=l+h+1>>1,e[t+0+96]=yt(n,s,i),e[t+0+64]=yt(s,i,r),e[t+0+32]=e[t+1+96]=yt(i,r,a),e[t+1+32]=e[t+2+96]=yt(r,a,o),e[t+2+32]=e[t+3+96]=yt(a,o,l),e[t+3+32]=yt(o,l,h)}function It(e,t){var i=e[t+0-32],s=e[t+1-32],n=e[t+2-32],r=e[t+3-32],a=e[t+4-32],o=e[t+5-32],l=e[t+6-32],h=e[t+7-32];e[t+0+0]=i+s+1>>1,e[t+1+0]=e[t+0+64]=s+n+1>>1,e[t+2+0]=e[t+1+64]=n+r+1>>1,e[t+3+0]=e[t+2+64]=r+a+1>>1,e[t+0+32]=yt(i,s,n),e[t+1+32]=e[t+0+96]=yt(s,n,r),e[t+2+32]=e[t+1+96]=yt(n,r,a),e[t+3+32]=e[t+2+96]=yt(r,a,o),e[t+3+64]=yt(a,o,l),e[t+3+96]=yt(o,l,h)}function At(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1+96];e[t+0+0]=i+s+1>>1,e[t+2+0]=e[t+0+32]=s+n+1>>1,e[t+2+32]=e[t+0+64]=n+r+1>>1,e[t+1+0]=yt(i,s,n),e[t+3+0]=e[t+1+32]=yt(s,n,r),e[t+3+32]=e[t+1+64]=yt(n,r,r),e[t+3+64]=e[t+2+64]=e[t+0+96]=e[t+1+96]=e[t+2+96]=e[t+3+96]=r}function Rt(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1+96],a=e[t-1-32],o=e[t+0-32],l=e[t+1-32],h=e[t+2-32];e[t+0+0]=e[t+2+32]=i+a+1>>1,e[t+0+32]=e[t+2+64]=s+i+1>>1,e[t+0+64]=e[t+2+96]=n+s+1>>1,e[t+0+96]=r+n+1>>1,e[t+3+0]=yt(o,l,h),e[t+2+0]=yt(a,o,l),e[t+1+0]=e[t+3+32]=yt(i,a,o),e[t+1+32]=e[t+3+64]=yt(s,i,a),e[t+1+64]=e[t+3+96]=yt(n,s,i),e[t+1+96]=yt(r,n,s)}function Pt(e,t){var i;for(i=0;8>i;++i)tt(e,t+32*i,e,t-32,8)}function Ot(e,t){var i;for(i=0;8>i;++i)it(e,t,e[t-1],8),t+=32}function Lt(e,t,i){var s;for(s=0;8>s;++s)it(t,i+32*s,e,8)}function Dt(e,t){var i,s=8;for(i=0;8>i;++i)s+=e[t+i-32]+e[t-1+32*i];Lt(s>>4,e,t)}function kt(e,t){var i,s=4;for(i=0;8>i;++i)s+=e[t+i-32];Lt(s>>3,e,t)}function Mt(e,t){var i,s=4;for(i=0;8>i;++i)s+=e[t-1+32*i];Lt(s>>3,e,t)}function Ft(e,t){Lt(128,e,t)}function Vt(e,t,i){var s=e[t-i],n=e[t+0],r=3*(n-s)+Ps[1020+e[t-2*i]-e[t+i]],a=Os[112+(r+4>>3)];e[t-i]=Ls[255+s+Os[112+(r+3>>3)]],e[t+0]=Ls[255+n-a]}function jt(e,t,i,s){var n=e[t+0],r=e[t+i];return Ds[255+e[t-2*i]-e[t-i]]>s||Ds[255+r-n]>s}function Nt(e,t,i,s){return 4*Ds[255+e[t-i]-e[t+0]]+Ds[255+e[t-2*i]-e[t+i]]<=s}function Gt(e,t,i,s,n){var r=e[t-3*i],a=e[t-2*i],o=e[t-i],l=e[t+0],h=e[t+i],c=e[t+2*i],u=e[t+3*i];return 4*Ds[255+o-l]+Ds[255+a-h]>s?0:Ds[255+e[t-4*i]-r]<=n&&Ds[255+r-a]<=n&&Ds[255+a-o]<=n&&Ds[255+u-c]<=n&&Ds[255+c-h]<=n&&Ds[255+h-l]<=n}function Bt(e,t,i,s){var n=2*s+1;for(s=0;16>s;++s)Nt(e,t+s,i,n)&&Vt(e,t+s,i)}function Ut(e,t,i,s){var n=2*s+1;for(s=0;16>s;++s)Nt(e,t+s*i,1,n)&&Vt(e,t+s*i,1)}function Wt(e,t,i,s){var n;for(n=3;0<n;--n)Bt(e,t+=4*i,i,s)}function Ht(e,t,i,s){var n;for(n=3;0<n;--n)Ut(e,t+=4,i,s)}function $t(e,t,i,s,n,r,a,o){for(r=2*r+1;0<n--;){if(Gt(e,t,i,r,a))if(jt(e,t,i,o))Vt(e,t,i);else{var l=e,h=t,c=i,u=l[h-2*c],d=l[h-c],f=l[h+0],g=l[h+c],m=l[h+2*c],_=27*(w=Ps[1020+3*(f-d)+Ps[1020+u-g]])+63>>7,p=18*w+63>>7,w=9*w+63>>7;l[h-3*c]=Ls[255+l[h-3*c]+w],l[h-2*c]=Ls[255+u+p],l[h-c]=Ls[255+d+_],l[h+0]=Ls[255+f-_],l[h+c]=Ls[255+g-p],l[h+2*c]=Ls[255+m-w]}t+=s}}function Kt(e,t,i,s,n,r,a,o){for(r=2*r+1;0<n--;){if(Gt(e,t,i,r,a))if(jt(e,t,i,o))Vt(e,t,i);else{var l=e,h=t,c=i,u=l[h-c],d=l[h+0],f=l[h+c],g=Os[112+((m=3*(d-u))+4>>3)],m=Os[112+(m+3>>3)],_=g+1>>1;l[h-2*c]=Ls[255+l[h-2*c]+_],l[h-c]=Ls[255+u+m],l[h+0]=Ls[255+d-g],l[h+c]=Ls[255+f-_]}t+=s}}function Yt(e,t,i,s,n,r){$t(e,t,i,1,16,s,n,r)}function zt(e,t,i,s,n,r){$t(e,t,1,i,16,s,n,r)}function Xt(e,t,i,s,n,r){var a;for(a=3;0<a;--a)Kt(e,t+=4*i,i,1,16,s,n,r)}function Jt(e,t,i,s,n,r){var a;for(a=3;0<a;--a)Kt(e,t+=4,1,i,16,s,n,r)}function qt(e,t,i,s,n,r,a,o){$t(e,t,n,1,8,r,a,o),$t(i,s,n,1,8,r,a,o)}function Zt(e,t,i,s,n,r,a,o){$t(e,t,1,n,8,r,a,o),$t(i,s,1,n,8,r,a,o)}function Qt(e,t,i,s,n,r,a,o){Kt(e,t+4*n,n,1,8,r,a,o),Kt(i,s+4*n,n,1,8,r,a,o)}function ei(e,t,i,s,n,r,a,o){Kt(e,t+4,1,n,8,r,a,o),Kt(i,s+4,1,n,8,r,a,o)}function ti(){this.ba=new Z,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new ee,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 si(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function ni(){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 s}function ri(){this.xb=this.a=0,this.l=new je,this.ca=new Z,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new f,this.Pb=0,this.wd=new f,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new ni,this.ab=0,this.gc=nt(4,si),this.Oc=0}function ai(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new je,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function oi(e,t,i,s,n,r,a){for(e=null==e?0:e[t+0],t=0;t<a;++t)n[r+t]=e+i[s+t]&255,e=n[r+t]}function li(e,t,i,s,n,r,a){var o;if(null==e)oi(null,null,i,s,n,r,a);else for(o=0;o<a;++o)n[r+o]=e[t+o]+i[s+o]&255}function hi(e,t,i,s,n,r,a){if(null==e)oi(null,null,i,s,n,r,a);else{var o,l=e[t+0],h=l,c=l;for(o=0;o<a;++o)h=c+(l=e[t+o])-h,c=i[s+o]+(-256&h?0>h?0:255:h)&255,h=l,n[r+o]=c}}function ci(e,t,i,s){var n=t.width,r=t.o;if(Qe(null!=e&&null!=t),0>i||0>=s||i+s>r)return null;if(!e.Cc){if(null==e.ga){var a;if(e.ga=new ai,(a=null==e.ga)||(a=t.width*t.o,Qe(0==e.Gb.length),e.Gb=st(a),e.Uc=0,null==e.Gb?a=0:(e.mb=e.Gb,e.nb=e.Uc,e.rc=null,a=1),a=!a),!a){a=e.ga;var o=e.Fa,l=e.P,c=e.qc,u=e.mb,d=e.nb,f=l+1,g=c-1,_=a.l;if(Qe(null!=o&&null!=u&&null!=t),mn[0]=null,mn[1]=oi,mn[2]=li,mn[3]=hi,a.ca=u,a.tb=d,a.c=t.width,a.i=t.height,Qe(0<a.c&&0<a.i),1>=c)t=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)t=0;else if(_.put=re,_.ac=ne,_.bc=ae,_.ma=a,_.width=t.width,_.height=t.height,_.Da=t.Da,_.v=t.v,_.va=t.va,_.j=t.j,_.o=t.o,a.$a)e:{Qe(1==a.$a),t=ye();t:for(;;){if(null==t){t=0;break e}if(Qe(null!=a),a.mc=t,t.c=a.c,t.i=a.i,t.l=a.l,t.l.ma=a,t.l.width=a.c,t.l.height=a.i,t.a=0,h(t.m,o,f,g),!be(a.c,a.i,1,t,null))break t;if(1==t.ab&&3==t.gc[0].hc&&me(t.s)?(a.ic=1,o=t.c*t.i,t.Ta=null,t.Ua=0,t.V=st(o),t.Ba=0,null==t.V?(t.a=1,t=0):t=1):(a.ic=0,t=Te(t,a.c)),!t)break t;t=1;break e}a.mc=null,t=0}else t=g>=a.c*a.i;a=!t}if(a)return null;1!=e.ga.Lc?e.Ga=0:s=r-i}Qe(null!=e.ga),Qe(i+s<=r);e:{if(t=(o=e.ga).c,r=o.l.o,0==o.$a){if(f=e.rc,g=e.Vc,_=e.Fa,l=e.P+1+i*t,c=e.mb,u=e.nb+i*t,Qe(l<=e.P+e.qc),0!=o.Z)for(Qe(null!=mn[o.Z]),a=0;a<s;++a)mn[o.Z](f,g,_,l,c,u,t),f=c,g=u,u+=t,l+=t;else for(a=0;a<s;++a)tt(c,u,_,l,t),f=c,g=u,u+=t,l+=t;e.rc=f,e.Vc=g}else{if(Qe(null!=o.mc),t=i+s,Qe(null!=(a=o.mc)),Qe(t<=a.i),a.C>=t)t=1;else if(o.ic||mi(),o.ic){o=a.V,f=a.Ba,g=a.c;var w=a.i,v=(_=1,l=a.$/g,c=a.$%g,u=a.m,d=a.s,a.$),y=g*w,b=g*t,T=d.wc,S=v<b?de(d,c,l):null;Qe(v<=y),Qe(t<=w),Qe(me(d));t:for(;;){for(;!u.h&&v<b;){if(c&T||(S=de(d,c,l)),Qe(null!=S),p(u),256>(w=ce(S.G[0],S.H[0],u)))o[f+v]=w,++v,++c>=g&&(c=0,++l<=t&&!(l%16)&&pe(a,l));else{if(!(280>w)){_=0;break t}w=le(w-256,u);var C,E=ce(S.G[4],S.H[4],u);if(p(u),!(v>=(E=he(g,E=le(E,u)))&&y-v>=w)){_=0;break t}for(C=0;C<w;++C)o[f+v+C]=o[f+v+C-E];for(v+=w,c+=w;c>=g;)c-=g,++l<=t&&!(l%16)&&pe(a,l);v<b&&c&T&&(S=de(d,c,l))}Qe(u.h==m(u))}pe(a,l>t?t:l);break t}!_||u.h&&v<y?(_=0,a.a=u.h?5:3):a.$=v,t=_}else t=we(a,a.V,a.Ba,a.c,a.i,t,Se);if(!t){s=0;break e}}i+s>=r&&(e.Cc=1),s=1}if(!s)return null;if(e.Cc&&(null!=(s=e.ga)&&(s.mc=null),e.ga=null,0<e.Ga))return alert("todo:WebPDequantizeLevels"),null}return e.nb+i*n}function ui(e,t,i,s,n,r){for(;0<n--;){var a,o=e,l=t+(i?1:0),h=e,c=t+(i?0:3);for(a=0;a<s;++a){var u=h[c+4*a];255!=u&&(u*=32897,o[l+4*a+0]=o[l+4*a+0]*u>>23,o[l+4*a+1]=o[l+4*a+1]*u>>23,o[l+4*a+2]=o[l+4*a+2]*u>>23)}t+=r}}function di(e,t,i,s,n){for(;0<s--;){var r;for(r=0;r<i;++r){var a=e[t+2*r+0],o=15&(h=e[t+2*r+1]),l=4369*o,h=(240&h|h>>4)*l>>16;e[t+2*r+0]=(240&a|a>>4)*l>>16&240|(15&a|a<<4)*l>>16>>4&15,e[t+2*r+1]=240&h|o}t+=n}}function fi(e,t,i,s,n,r,a,o){var l,h,c=255;for(h=0;h<n;++h){for(l=0;l<s;++l){var u=e[t+l];r[a+4*l]=u,c&=u}t+=i,a+=o}return 255!=c}function gi(e,t,i,s,n){var r;for(r=0;r<n;++r)i[s+r]=e[t+r]>>8}function mi(){bs=ui,Ts=di,Ss=fi,Cs=gi}function _i(e,t,i){self[e]=function(e,s,n,r,a,o,l,h,c,u,d,f,g,m,_,p,w){var v,y=w-1>>1,b=a[o+0]|l[h+0]<<16,T=c[u+0]|d[f+0]<<16;Qe(null!=e);var S=3*b+T+131074>>2;for(t(e[s+0],255&S,S>>16,g,m),null!=n&&(S=3*T+b+131074>>2,t(n[r+0],255&S,S>>16,_,p)),v=1;v<=y;++v){var C=a[o+v]|l[h+v]<<16,E=c[u+v]|d[f+v]<<16,x=b+C+T+E+524296,I=x+2*(C+T)>>3;S=I+b>>1,b=(x=x+2*(b+E)>>3)+C>>1,t(e[s+2*v-1],255&S,S>>16,g,m+(2*v-1)*i),t(e[s+2*v-0],255&b,b>>16,g,m+(2*v-0)*i),null!=n&&(S=x+T>>1,b=I+E>>1,t(n[r+2*v-1],255&S,S>>16,_,p+(2*v-1)*i),t(n[r+2*v+0],255&b,b>>16,_,p+(2*v+0)*i)),b=C,T=E}1&w||(S=3*b+T+131074>>2,t(e[s+w-1],255&S,S>>16,g,m+(w-1)*i),null!=n&&(S=3*T+b+131074>>2,t(n[r+w-1],255&S,S>>16,_,p+(w-1)*i)))}}function pi(){_n[ks]=pn,_n[Ms]=vn,_n[Fs]=wn,_n[Vs]=yn,_n[js]=bn,_n[Ns]=Tn,_n[Gs]=Sn,_n[Bs]=vn,_n[Us]=yn,_n[Ws]=bn,_n[Hs]=Tn}function wi(e){return e&~Rn?0>e?0:255:e>>An}function vi(e,t){return wi((19077*e>>8)+(26149*t>>8)-14234)}function yi(e,t,i){return wi((19077*e>>8)-(6419*t>>8)-(13320*i>>8)+8708)}function bi(e,t){return wi((19077*e>>8)+(33050*t>>8)-17685)}function Ti(e,t,i,s,n){s[n+0]=vi(e,i),s[n+1]=yi(e,t,i),s[n+2]=bi(e,t)}function Si(e,t,i,s,n){s[n+0]=bi(e,t),s[n+1]=yi(e,t,i),s[n+2]=vi(e,i)}function Ci(e,t,i,s,n){var r=yi(e,t,i);t=r<<3&224|bi(e,t)>>3,s[n+0]=248&vi(e,i)|r>>5,s[n+1]=t}function Ei(e,t,i,s,n){var r=240&bi(e,t)|15;s[n+0]=240&vi(e,i)|yi(e,t,i)>>4,s[n+1]=r}function xi(e,t,i,s,n){s[n+0]=255,Ti(e,t,i,s,n+1)}function Ii(e,t,i,s,n){Si(e,t,i,s,n),s[n+3]=255}function Ai(e,t,i,s,n){Ti(e,t,i,s,n),s[n+3]=255}function Ve(e,t){return 0>e?0:e>t?t:e}function Ri(e,t,i){self[e]=function(e,s,n,r,a,o,l,h,c){for(var u=h+(-2&c)*i;h!=u;)t(e[s+0],n[r+0],a[o+0],l,h),t(e[s+1],n[r+0],a[o+0],l,h+i),s+=2,++r,++o,h+=2*i;1&c&&t(e[s+0],n[r+0],a[o+0],l,h)}}function Pi(e,t,i){return 0==i?0==e?0==t?6:5:0==t?4:0:i}function Oi(e,t,i,s,n){switch(e>>>30){case 3:ns(t,i,s,n,0);break;case 2:rs(t,i,s,n);break;case 1:os(t,i,s,n)}}function Li(e,t){var i,s,n=t.M,r=t.Nb,a=e.oc,o=e.pc+40,l=e.oc,h=e.pc+584,c=e.oc,u=e.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,c[u+32*i-1]=129;for(0<n?a[o-1-32]=l[h-1-32]=c[u-1-32]=129:(it(a,o-32-1,127,21),it(l,h-32-1,127,9),it(c,u-32-1,127,9)),s=0;s<e.za;++s){var d=t.ya[t.aa+s];if(0<s){for(i=-1;16>i;++i)tt(a,o+32*i-4,a,o+32*i+12,4);for(i=-1;8>i;++i)tt(l,h+32*i-4,l,h+32*i+4,4),tt(c,u+32*i-4,c,u+32*i+4,4)}var f=e.Gd,g=e.Hd+s,m=d.ad,_=d.Hc;if(0<n&&(tt(a,o-32,f[g].y,0,16),tt(l,h-32,f[g].f,0,8),tt(c,u-32,f[g].ea,0,8)),d.Za){var p=a,w=o-32+16;for(0<n&&(s>=e.za-1?it(p,w,f[g].y[15],4):tt(p,w,f[g+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,_<<=2)p=a,w=o+Vn[i],un[d.Ob[i]](p,w),Oi(_,m,16*+i,p,w)}else if(p=Pi(s,n,d.Ob[0]),cn[p](a,o),0!=_)for(i=0;16>i;++i,_<<=2)Oi(_,m,16*+i,a,o+Vn[i]);for(i=d.Gc,p=Pi(s,n,d.Dd),dn[p](l,h),dn[p](c,u),_=m,p=l,w=h,255&(d=i>>0)&&(170&d?as(_,256,p,w):ls(_,256,p,w)),d=c,_=u,255&(i>>=8)&&(170&i?as(m,320,d,_):ls(m,320,d,_)),n<e.Ub-1&&(tt(f[g].y,0,a,o+480,16),tt(f[g].f,0,l,h+224,8),tt(f[g].ea,0,c,u+224,8)),i=8*r*e.B,f=e.sa,g=e.ta+16*s+16*r*e.R,m=e.qa,d=e.ra+8*s+i,_=e.Ha,p=e.Ia+8*s+i,i=0;16>i;++i)tt(f,g+i*e.R,a,o+32*i,16);for(i=0;8>i;++i)tt(m,d+i*e.B,l,h+32*i,8),tt(_,p+i*e.B,c,u+32*i,8)}}function Di(e,t,i,s,n,r,a,o,l){var c=[0],u=[0],d=0,g=null!=l?l.kd:0,m=null!=l?l:new ii;if(null==e||12>i)return 7;m.data=e,m.w=t,m.ha=i,t=[t],i=[i],m.gb=[m.gb];e:{var _=t,p=i,w=m.gb;if(Qe(null!=e),Qe(null!=p),Qe(null!=w),w[0]=0,12<=p[0]&&!et(e,_[0],"RIFF")){if(et(e,_[0]+8,"WEBP")){w=3;break e}var v=C(e,_[0]+4);if(12>v||4294967286<v){w=3;break e}if(g&&v>p[0]-8){w=7;break e}w[0]=v,_[0]+=12,p[0]-=12}w=0}if(0!=w)return w;for(v=0<m.gb[0],i=i[0];;){e:{var y=e;p=t,w=i;var b=c,T=u,E=_=[0];if((A=d=[d])[0]=0,8>w[0])w=7;else{if(!et(y,p[0],"VP8X")){if(10!=C(y,p[0]+4)){w=3;break e}if(18>w[0]){w=7;break e}var x=C(y,p[0]+8),I=1+S(y,p[0]+12);if(2147483648<=I*(y=1+S(y,p[0]+15))){w=3;break e}null!=E&&(E[0]=x),null!=b&&(b[0]=I),null!=T&&(T[0]=y),p[0]+=18,w[0]-=18,A[0]=1}w=0}}if(d=d[0],_=_[0],0!=w)return w;if(p=!!(2&_),!v&&d)return 3;if(null!=r&&(r[0]=!!(16&_)),null!=a&&(a[0]=p),null!=o&&(o[0]=0),a=c[0],_=u[0],d&&p&&null==l){w=0;break}if(4>i){w=7;break}if(v&&d||!v&&!d&&!et(e,t[0],"ALPH")){i=[i],m.na=[m.na],m.P=[m.P],m.Sa=[m.Sa];e:{x=e,w=t,v=i;var A=m.gb;b=m.na,T=m.P,E=m.Sa;I=22,Qe(null!=x),Qe(null!=v),y=w[0];var R=v[0];for(Qe(null!=b),Qe(null!=E),b[0]=null,T[0]=null,E[0]=0;;){if(w[0]=y,v[0]=R,8>R){w=7;break e}var P=C(x,y+4);if(4294967286<P){w=3;break e}var O=8+P+1&-2;if(I+=O,0<A&&I>A){w=3;break e}if(!et(x,y,"VP8 ")||!et(x,y,"VP8L")){w=0;break e}if(R[0]<O){w=7;break e}et(x,y,"ALPH")||(b[0]=x,T[0]=y+8,E[0]=P),y+=O,R-=O}}if(i=i[0],m.na=m.na[0],m.P=m.P[0],m.Sa=m.Sa[0],0!=w)break}i=[i],m.Ja=[m.Ja],m.xa=[m.xa];e:if(A=e,w=t,v=i,b=m.gb[0],T=m.Ja,E=m.xa,x=w[0],y=!et(A,x,"VP8 "),I=!et(A,x,"VP8L"),Qe(null!=A),Qe(null!=v),Qe(null!=T),Qe(null!=E),8>v[0])w=7;else{if(y||I){if(A=C(A,x+4),12<=b&&A>b-12){w=3;break e}if(g&&A>v[0]-8){w=7;break e}T[0]=A,w[0]+=8,v[0]-=8,E[0]=I}else E[0]=5<=v[0]&&47==A[x+0]&&!(A[x+4]>>5),T[0]=v[0];w=0}if(i=i[0],m.Ja=m.Ja[0],m.xa=m.xa[0],t=t[0],0!=w)break;if(4294967286<m.Ja)return 3;if(null==o||p||(o[0]=m.xa?2:1),a=[a],_=[_],m.xa){if(5>i){w=7;break}o=a,g=_,p=r,null==e||5>i?e=0:5<=i&&47==e[t+0]&&!(e[t+4]>>5)?(v=[0],A=[0],b=[0],h(T=new f,e,t,i),oe(T,v,A,b)?(null!=o&&(o[0]=v[0]),null!=g&&(g[0]=A[0]),null!=p&&(p[0]=b[0]),e=1):e=0):e=0}else{if(10>i){w=7;break}o=_,null==e||10>i||!Be(e,t+3,i-3)?e=0:(g=e[t+0]|e[t+1]<<8|e[t+2]<<16,p=16383&(e[t+7]<<8|e[t+6]),e=16383&(e[t+9]<<8|e[t+8]),1&g||3<(g>>1&7)||!(g>>4&1)||g>>5>=m.Ja||!p||!e?e=0:(a&&(a[0]=p),o&&(o[0]=e),e=1))}if(!e)return 3;if(a=a[0],_=_[0],d&&(c[0]!=a||u[0]!=_))return 3;null!=l&&(l[0]=m,l.offset=t-l.w,Qe(4294967286>t-l.w),Qe(l.offset==l.ha-i));break}return 0==w||7==w&&d&&null==l?(null!=r&&(r[0]|=null!=m.na&&0<m.na.length),null!=s&&(s[0]=a),null!=n&&(n[0]=_),0):w}function ki(e,t,i){var s=t.width,n=t.height,r=0,a=0,o=s,l=n;if(t.Da=null!=e&&0<e.Da,t.Da&&(o=e.cd,l=e.bd,r=e.v,a=e.j,11>i||(r&=-2,a&=-2),0>r||0>a||0>=o||0>=l||r+o>s||a+l>n))return 0;if(t.v=r,t.j=a,t.va=r+o,t.o=a+l,t.U=o,t.T=l,t.da=null!=e&&0<e.da,t.da){if(!A(o,l,i=[e.ib],r=[e.hb]))return 0;t.ib=i[0],t.hb=r[0]}return t.ob=null!=e&&e.ob,t.Kb=null==e||!e.Sd,t.da&&(t.ob=t.ib<3*s/4&&t.hb<3*n/4,t.Kb=0),1}function Mi(e){if(null==e)return 2;if(11>e.S){var t=e.f.RGBA;t.fb+=(e.height-1)*t.A,t.A=-t.A}else t=e.f.kb,e=e.height,t.O+=(e-1)*t.fa,t.fa=-t.fa,t.N+=(e-1>>1)*t.Ab,t.Ab=-t.Ab,t.W+=(e-1>>1)*t.Db,t.Db=-t.Db,null!=t.F&&(t.J+=(e-1)*t.lb,t.lb=-t.lb);return 0}function Fi(e,t,i,s){if(null==s||0>=e||0>=t)return 2;if(null!=i){if(i.Da){var n=i.cd,r=i.bd,a=-2&i.v,o=-2&i.j;if(0>a||0>o||0>=n||0>=r||a+n>e||o+r>t)return 2;e=n,t=r}if(i.da){if(!A(e,t,n=[i.ib],r=[i.hb]))return 2;e=n[0],t=r[0]}}s.width=e,s.height=t;e:{var l=s.width,h=s.height;if(e=s.S,0>=l||0>=h||!(e>=ks&&13>e))e=2;else{if(0>=s.Rd&&null==s.sd){a=r=n=t=0;var c=(o=l*Bn[e])*h;if(11>e||(r=(h+1)/2*(t=(l+1)/2),12==e&&(a=(n=l)*h)),null==(h=st(c+2*r+a))){e=1;break e}s.sd=h,11>e?((l=s.f.RGBA).eb=h,l.fb=0,l.A=o,l.size=c):((l=s.f.kb).y=h,l.O=0,l.fa=o,l.Fd=c,l.f=h,l.N=0+c,l.Ab=t,l.Cd=r,l.ea=h,l.W=0+c+r,l.Db=t,l.Ed=r,12==e&&(l.F=h,l.J=0+c+2*r),l.Tc=a,l.lb=n)}if(t=1,n=s.S,r=s.width,a=s.height,n>=ks&&13>n)if(11>n)e=s.f.RGBA,t&=(o=Math.abs(e.A))*(a-1)+r<=e.size,t&=o>=r*Bn[n],t&=null!=e.eb;else{e=s.f.kb,o=(r+1)/2,c=(a+1)/2,l=Math.abs(e.fa);h=Math.abs(e.Ab);var u=Math.abs(e.Db),d=Math.abs(e.lb),f=d*(a-1)+r;t&=l*(a-1)+r<=e.Fd,t&=h*(c-1)+o<=e.Cd,t=(t&=u*(c-1)+o<=e.Ed)&l>=r&h>=o&u>=o,t&=null!=e.y,t&=null!=e.f,t&=null!=e.ea,12==n&&(t&=d>=r,t&=f<=e.Tc,t&=null!=e.F)}else t=0;e=t?0:2}}return 0!=e||null!=i&&i.fd&&(e=Mi(s)),e}var Vi=64,ji=[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,Gi=32,Bi=8,Ui=[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];O("Predictor0","PredictorAdd0"),self.Predictor0=function(){return 4278190080},self.Predictor1=function(e){return e},self.Predictor2=function(e,t,i){return t[i+0]},self.Predictor3=function(e,t,i){return t[i+1]},self.Predictor4=function(e,t,i){return t[i-1]},self.Predictor5=function(e,t,i){return D(D(e,t[i+1]),t[i+0])},self.Predictor6=function(e,t,i){return D(e,t[i-1])},self.Predictor7=function(e,t,i){return D(e,t[i+0])},self.Predictor8=function(e,t,i){return D(t[i-1],t[i+0])},self.Predictor9=function(e,t,i){return D(t[i+0],t[i+1])},self.Predictor10=function(e,t,i){return D(D(e,t[i-1]),D(t[i+0],t[i+1]))},self.Predictor11=function(e,t,i){var s=t[i+0];return 0>=F(s>>24&255,e>>24&255,(t=t[i-1])>>24&255)+F(s>>16&255,e>>16&255,t>>16&255)+F(s>>8&255,e>>8&255,t>>8&255)+F(255&s,255&e,255&t)?s:e},self.Predictor12=function(e,t,i){var s=t[i+0];return(k((e>>24&255)+(s>>24&255)-((t=t[i-1])>>24&255))<<24|k((e>>16&255)+(s>>16&255)-(t>>16&255))<<16|k((e>>8&255)+(s>>8&255)-(t>>8&255))<<8|k((255&e)+(255&s)-(255&t)))>>>0},self.Predictor13=function(e,t,i){var s=t[i-1];return(M((e=D(e,t[i+0]))>>24&255,s>>24&255)<<24|M(e>>16&255,s>>16&255)<<16|M(e>>8&255,s>>8&255)<<8|M(e>>0&255,s>>0&255))>>>0};var Wi=self.PredictorAdd0;self.PredictorAdd1=V,O("Predictor2","PredictorAdd2"),O("Predictor3","PredictorAdd3"),O("Predictor4","PredictorAdd4"),O("Predictor5","PredictorAdd5"),O("Predictor6","PredictorAdd6"),O("Predictor7","PredictorAdd7"),O("Predictor8","PredictorAdd8"),O("Predictor9","PredictorAdd9"),O("Predictor10","PredictorAdd10"),O("Predictor11","PredictorAdd11"),O("Predictor12","PredictorAdd12"),O("Predictor13","PredictorAdd13");var Hi=self.PredictorAdd2;B("ColorIndexInverseTransform","MapARGB","32b",(function(e){return e>>8&255}),(function(e){return e})),B("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",(function(e){return e}),(function(e){return e>>8&255}));var $i,Ki=self.ColorIndexInverseTransform,Yi=self.MapARGB,zi=self.VP8LColorIndexInverseTransformAlpha,Xi=self.MapAlpha,Ji=self.VP8LPredictorsAdd=[];Ji.length=16,(self.VP8LPredictors=[]).length=16,(self.VP8LPredictorsAdd_C=[]).length=16,(self.VP8LPredictors_C=[]).length=16;var qi,Zi,Qi,es,ts,is,ss,ns,rs,as,os,ls,hs,cs,us,ds,fs,gs,ms,_s,ps,ws,vs,ys,bs,Ts,Ss,Cs,Es=st(511),xs=st(2041),Is=st(225),As=st(767),Rs=0,Ps=xs,Os=Is,Ls=As,Ds=Es,ks=0,Ms=1,Fs=2,Vs=3,js=4,Ns=5,Gs=6,Bs=7,Us=8,Ws=9,Hs=10,$s=[2,3,7],Ks=[3,3,11],Ys=[280,256,256,256,40],zs=[0,1,1,1,0],Xs=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],Js=[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],qs=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],Zs=8,Qs=[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],en=[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],tn=null,sn=[[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]],nn=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],rn=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],an=[[[[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]]]],on=[[[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]]],ln=[[[[255,255,255,255,255,255,255,255,255,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]]]],hn=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],cn=[],un=[],dn=[],fn=1,gn=2,mn=[],_n=[];_i("UpsampleRgbLinePair",Ti,3),_i("UpsampleBgrLinePair",Si,3),_i("UpsampleRgbaLinePair",Ai,4),_i("UpsampleBgraLinePair",Ii,4),_i("UpsampleArgbLinePair",xi,4),_i("UpsampleRgba4444LinePair",Ei,2),_i("UpsampleRgb565LinePair",Ci,2);var pn=window.UpsampleRgbLinePair,wn=window.UpsampleBgrLinePair,vn=window.UpsampleRgbaLinePair,yn=window.UpsampleBgraLinePair,bn=window.UpsampleArgbLinePair,Tn=window.UpsampleRgba4444LinePair,Sn=window.UpsampleRgb565LinePair,Cn=16,En=1<<Cn-1,xn=-227,In=482,An=6,Rn=(256<<An)-1,Pn=0,On=st(256),Ln=st(256),Dn=st(256),kn=st(256),Mn=st(In-xn),Fn=st(In-xn);Ri("YuvToRgbRow",Ti,3),Ri("YuvToBgrRow",Si,3),Ri("YuvToRgbaRow",Ai,4),Ri("YuvToBgraRow",Ii,4),Ri("YuvToArgbRow",xi,4),Ri("YuvToRgba4444Row",Ei,2),Ri("YuvToRgb565Row",Ci,2);var Vn=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],jn=[0,2,8],Nn=[8,7,6,4,4,2,2,2,1,1,1,1],Gn=1;this.WebPDecodeRGBA=function(e,t,i,s,n){var r=Ms,a=new ti,o=new Z;a.ba=o,o.S=r,o.width=[o.width],o.height=[o.height];var l=o.width,c=o.height,u=new Q;if(null==u||null==e)var d=2;else Qe(null!=u),d=Di(e,t,i,u.width,u.height,u.Pd,u.Qd,u.format,null);if(0!=d?l=0:(null!=l&&(l[0]=u.width[0]),null!=c&&(c[0]=u.height[0]),l=1),l){o.width=o.width[0],o.height=o.height[0],null!=s&&(s[0]=o.width),null!=n&&(n[0]=o.height);e:{if(s=new je,(n=new ii).data=e,n.w=t,n.ha=i,n.kd=1,t=[0],Qe(null!=n),(0==(e=Di(n.data,n.w,n.ha,null,null,null,t,null,n))||7==e)&&t[0]&&(e=4),0==(t=e)){if(Qe(null!=a),s.data=n.data,s.w=n.w+n.offset,s.ha=n.ha-n.offset,s.put=re,s.ac=ne,s.bc=ae,s.ma=a,n.xa){if(null==(e=ye())){a=1;break e}if(function(e,t){var i=[0],s=[0],n=[0];t:for(;;){if(null==e)return 0;if(null==t)return e.a=2,0;if(e.l=t,e.a=0,h(e.m,t.data,t.w,t.ha),!oe(e.m,i,s,n)){e.a=3;break t}if(e.xb=gn,t.width=i[0],t.height=s[0],!be(i[0],s[0],1,e,null))break t;return 1}return Qe(0!=e.a),0}(e,s)){if(s=0==(t=Fi(s.width,s.height,a.Oa,a.ba))){t:{s=e;i:for(;;){if(null==s){s=0;break t}if(Qe(null!=s.s.yc),Qe(null!=s.s.Ya),Qe(0<s.s.Wb),Qe(null!=(i=s.l)),Qe(null!=(n=i.ma)),0!=s.xb){if(s.ca=n.ba,s.tb=n.tb,Qe(null!=s.ca),!ki(n.Oa,i,Vs)){s.a=2;break i}if(!Te(s,i.width))break i;if(i.da)break i;if((i.da||X(s.ca.S))&&mi(),11>s.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),null!=s.ca.f.kb.F&&mi()),s.Pb&&0<s.s.ua&&null==s.s.vb.X&&!E(s.s.vb,s.s.Wa.Xa)){s.a=1;break i}s.xb=0}if(!we(s,s.V,s.Ba,s.c,s.i,i.o,ge))break i;n.Dc=s.Ma,s=1;break t}Qe(0!=s.a),s=0}s=!s}s&&(t=e.a)}else t=e.a}else{if(null==(e=new Ne)){a=1;break e}if(e.Fa=n.na,e.P=n.P,e.qc=n.Sa,Ue(e,s)){if(0==(t=Fi(s.width,s.height,a.Oa,a.ba))){if(e.Aa=0,i=a.Oa,Qe(null!=(n=e)),null!=i){if(0<(l=0>(l=i.Md)?0:100<l?255:255*l/100)){for(c=u=0;4>c;++c)12>(d=n.pb[c]).lc&&(d.ia=l*Nn[0>d.lc?0:d.lc]>>3),u|=d.ia;u&&(alert("todo:VP8InitRandom"),n.ia=1)}n.Ga=i.Id,100<n.Ga?n.Ga=100:0>n.Ga&&(n.Ga=0)}$e(e,s)||(t=e.a)}}else t=e.a}0==t&&null!=a.Oa&&a.Oa.fd&&(t=Mi(a.ba))}a=t}r=0!=a?null:11>r?o.f.RGBA.eb:o.f.kb.y}else r=null;return r};var Bn=[3,4,3,4,4,2,2,4,4,4,2,1,1]},new window.WebPDecoder,window.WebPRiffParser=function(e,t){var i={},s=0,n=!1,r=0,a=0;if(i.frames=[],!function(e,t,i,s){for(var n=0;n<s;n++)if(e[t+n]!=i.charCodeAt(n))return!0;return!1}(e,t,"RIFF",4)){for(lt(e,t+=4),t+=8;t<e.length;){var o=at(e,t),l=lt(e,t+=4);t+=4;var h=l+(1&l);switch(o){case"VP8 ":case"VP8L":void 0===i.frames[s]&&(i.frames[s]={}),(d=i.frames[s]).src_off=n?a:t-8,d.src_size=r+l+8,s++,n&&(n=!1,r=0,a=0);break;case"VP8X":(d=i.header={}).feature_flags=e[t];var c=t+4;d.canvas_width=1+ot(e,c),c+=3,d.canvas_height=1+ot(e,c),c+=3;break;case"ALPH":n=!0,r=h+8,a=t-8;break;case"ANIM":(d=i.header).bgcolor=lt(e,t),c=t+4,d.loop_count=(f=e)[(g=c)+0]<<0|f[g+1]<<8,c+=2;break;case"ANMF":var u,d;(d=i.frames[s]={}).offset_x=2*ot(e,t),t+=3,d.offset_y=2*ot(e,t),t+=3,d.width=1+ot(e,t),t+=3,d.height=1+ot(e,t),t+=3,d.duration=ot(e,t),t+=3,u=e[t++],d.dispose=1&u,d.blend=u>>1&1}"ANMF"!=o&&(t+=h)}var f,g;return i}},window.ApicTools={parseGIF:e,decompressFrames:t},console.log("Define originDocument ..."),window.originDocument={},window.originDocument.headAppendChild=window.document.head.appendChild.bind(window.document.head),window.originDocument.headRemoveChild=window.document.head.removeChild.bind(window.document.head),window.originDocument.createElement=window.document.createElement.bind(window.document),window.originDocument.createTextNode=window.document.createTextNode.bind(window.document),window.originDocument.createComment=window.document.createComment.bind(window.document),window.originDocument.getElementById=window.document.getElementById.bind(window.document),window.originDocument.getElementsByTagName=window.document.getElementsByTagName.bind(window.document),window.originDocument.querySelector=window.document.querySelector.bind(window.document),window.originDocument.createEvent=window.document.createEvent.bind(window.document),window.originDocument.dispatchEvent=window.document.dispatchEvent.bind(window.document);class ht{constructor(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){let t=e.indexOf("(")+1,i=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,i).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if((!0===e.startsWith("./")||!0===e.startsWith("../"))&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.__MainPath||"undefined"===window.JsView.Dom.__MainPathRef||window.JsView.Dom.__MainPathRef!==document.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.__MainPathRef=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.__MainPath=document.location.origin+document.location.pathname.substring(0,e)+"/"}let t=window.JsView.Dom.__MainPath;e=e.startsWith("./")?t+e.substring(2):t+e}if(this.href=e,!t)return;let s=this.href,n=s.indexOf("#");n>0&&(this.hash=s.substring(n),s=s.substring(0,n));let r=s.indexOf("?");r>1&&(this.search=s.substring(r),s=s.substring(0,r));let a=s,o=a.indexOf("://");this.protocol=o>0?a.substring(0,o+1):"";let l=o>1?a.substring(o+3):"";if(o=l.indexOf("/"),this.host=o>0?l.substring(0,o):"",this.pathname=o>1?l.substring(o):"",this.origin=o>0?this.protocol+"//"+this.host:"",this.host.startsWith("[")){let e=this.host.indexOf("]");this.hostname=this.host.substring(0,e+1),e=this.host.substring(e+1).indexOf(":"),this.port=e>1?this.host.substring(e+1):""}else{let e=this.host.indexOf(":");this.hostname=e>0?this.host.substring(0,e):this.host,this.port=e>1?this.host.substring(e+1):""}}replace(e){this.href=e}}window.JsView&&window.JsView.registerUriConverter?.((e=>new ht(e,!1).href));class ct{static SetBackgroundColor(e,t,s){const n=ct.TextureManager.GetColorTexture(t);let r;s&&(r=new i.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new i.TextureSetting(n,r);e.ResetTexture(a)}static SetBackgroundImage(e,t,s,n,r,a){if("string"==typeof t&&(t=new ht(t)),t instanceof ht==!1)throw Error("Bad Argument.",t);let o;if(o=t.href.endsWith("gif")||t.href.endsWith("webp")?ct.TextureManager.GetGifImage(t.href,!1,null):ct.TextureManager.GetImage2(t.href,!1,r,a||i.ColorSpace.RGBA_8888),o){let t;s&&(t=new i.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const r=new i.ExternalTextureSetting(o,t);if(e.ResetTexture(r),n){let t=o.RegisterLoadImageCallback(null,(function(){n({width:o.Width,height:o.Height})}));e.RegisterDetachCallback((()=>{o.UnregisterLoadImageCallback(t)}))}}}static SetMaskedBackgroundImage(e,t,s,n){if("string"==typeof t&&(t=new ht(t)),t instanceof ht==!1)throw Error("Bad Argument.",t);if("string"==typeof s&&(s=new ht(s)),s instanceof ht==!1)throw Error("Bad Argument(MaskURL).",s);const r=ct.TextureManager.GetImage2(t.href,!1,null,n||i.ColorSpace.RGBA_8888);if(r){const t=ct.TextureManager.GetImage2(s.href,!1,null,i.ColorSpace.RGBA_8888),n=new i.ExternalTextureSetting(r,new i.ViewTextureMask(t));e.ResetTexture(n)}}static SetVideoTexture(e,t,s){const n=ct.TextureManager.GetColorTexture(t);let r;s&&(r=new i.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new i.TextureSetting(n,r);e.ResetTexture(a)}static GetTextWidth(e){return e.str||(e.str=""),e.font||(e.font=i.TextUtils._sDefaultFont),e.size||(e.size=i.TextUtils._sDefaultFontSize),"italic"!==e.italic&&(e.italic=""),"bold"!==e.bold&&(e.bold=""),window.PlatformUtils.GetTextWidth(e)}static RequestSwap(){i.sRenderBridge.RequestSwap()}static SetImgTexSize(e,t){let i={size:t,refNum:0};ct.TextureInfo.Cache[e.Source]=i}static RefImgTexSize(e,t){let i=ct.TextureInfo.Cache[e.Source];i?(i.refNum>0?i.refNum++:i.refNum=1,t(i.size)):e.RegisterLoadImageCallback(null,(function(){const i={width:e.Width,height:e.Height};t(i);let s=ct.TextureInfo.Cache[e.Source];if(s)s.refNum>0?s.refNum++:s.refNum=1;else{let t={size:i,refNum:1};ct.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=ct.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&ct.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of ct.TextureInfo.Unused){let t=ct.TextureInfo.Cache[e];t.refNum<-2?(delete ct.TextureInfo.Cache[e],ct.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:ct.TextureInfo.Unused.delete(e)}}}ct.TextureInfo={Cache:{},Unused:new Set},ct.TextureManager=null,ct.RootView=null,ct.RootActivity=null,ct.HaltKeyEvent=!1;class ut{constructor(e){this.target=null,this.timeStamp=Date.now(),this.type=e}initEvent(e,t,i){this.type=e}}let dt={cnt:0};class ft{constructor(e){this.type=e,this.cachedValues=null,this.onSyncCallback=null}setOnSyncCallback(e){this.onSyncCallback=e,this.syncLastCaches(!0)}setCacheProperty(e,t){this.cachedValues||(this.cachedValues={}),this.cachedValues[e]=t,this.syncLastCaches(!1),ct.RequestSwap()}syncLastCaches(e){let t=ft.LastModified[this.type];if((e||t!==this)&&(ft.LastModified[this.type]=this,t&&t.cachedValues&&"function"==typeof t.onSyncCallback)){let e=t.cachedValues;t.cachedValues=null,t.onSyncCallback(e)}}static SyncAllCachedProperty(){for(let e of Object.values(ft.LastModified))e.syncLastCaches(!0);dt.cnt=(dt.cnt+1)%65535}}ft.LastModified={},window.JsView&&(window.JsView.Dom={DesignMap:null,Render:null,Extension:ct,UrlRef:ht},window.JsView.React=window.JsView.Dom);class gt{static SetLevel(e){switch(gt.E=gt.W=gt.I=gt.D=function(){},e){case gt.Level.Verbose:gt.V=console.debug.bind(console);case gt.Level.Debug:gt.D=console.debug.bind(console);case gt.Level.Info:gt.I=console.info.bind(console)}}static Throw(...e){throw console.error(...e),[...e]}}gt.E=console.error.bind(console),gt.W=console.warn.bind(console),gt.I=console.info.bind(console),gt.D=function(){},gt.V=function(){},gt.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class mt{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[],this.jsvEventListener=void 0,this.jsvChildChangedCallback=void 0}jsvGetTagName(){return"Unknown"}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.jsvChildChangedCallback?.()}removeChild(e){for(let t=e.childNodes.length-1;t>=0;t--)e.removeChild(e.childNodes[t]);let t=this.childNodes.indexOf(e);t<0&>.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(t,1),e.parentNode=void 0,this.jsvChildChangedCallback?.()}insertBefore(e,t){let i=this.childNodes.length;void 0===t?gt.Throw("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present."):null!==t&&(i=this.childNodes.indexOf(t)),i<0&>.Throw("Failed to call Node.insertBefore(), before node not found. beforeNode=",t),this.childNodes.splice(i,0,e),e.parentNode=this,this.jsvChildChangedCallback?.()}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);return t<0&>.Throw("Failed to call Node.previousSibling(), this node not found. this=",this),e[t-1]}get nextSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);return t<0&>.Throw("Failed to call Node.nextSibling(), this node not found. this=",this),e[t+1]}addEventListener(e,t,i){this.jsvEventListener||(this.jsvEventListener={});let s=this.jsvEventListener[e];s||(s=new Set,this.jsvEventListener[e]=s),s.add(t)}removeEventListener(e,t,i){if(!this.jsvEventListener)return;let s=this.jsvEventListener[e];s&&(s.delete(t),s.size<=0&&this.jsvEventListener.hasOwnProperty(e)&&delete this.jsvEventListener[e],0===Object.values(this.jsvEventListener).length&&(this.jsvEventListener=void 0))}dispatchEvent(e){if(!this.jsvEventListener)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.jsvEventListener[e.type];if(t){e.target||(e.target=document.activeElement);for(let i of t)i(e)}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.jsvChildChangedCallback=e}}mt.ELEMENT_NODE=1,mt.TEXT_NODE=3,mt.COMMENT_NODE=8,mt.DOCUMENT_NODE=9,mt.NOLAYOUT_NODE=10;class _t extends ut{}_t.Type={FOCUS:"focus",BLUR:"blur"};class pt extends ut{stopPropagation(){}}class wt{static ConvertInt(e){return e?"number"==typeof e?Math.floor(e):"string"==typeof e?parseInt(e):e:e}static ConvertFloat(e){if(!e)return e;if("string"!=typeof e)return e;return parseFloat(e)}static ConvertPx(e){if(!e)return e;if("string"!=typeof e)return e;if("0"===e)return 0;if(e.endsWith("px")){return parseInt(e)}return e}static ConvertRect(e){let t=wt.SplitString(e," "),i={top:t.length>0?parseInt(t[0]):0,right:t.length>1?parseInt(t[1]):null,bottom:t.length>2?parseInt(t[2]):null,left:t.length>3?parseInt(t[3]):null};return i.right=i.right||0===i.right?i.right:i.top,i.bottom=i.bottom||0===i.bottom?i.bottom:i.top,i.left=i.left||0===i.left?i.left:i.right,i}static ConvertCorner(e){let t=wt.SplitString(e," "),i={topLeft:t.length>0?parseInt(t[0]):0,topRight:t.length>1?parseInt(t[1]):null,bottomRight:t.length>2?parseInt(t[2]):null,bottomLeft:t.length>3?parseInt(t[3]):null};return i.topRight=i.topRight||0===i.topRight?i.topRight:i.topLeft,i.bottomRight=i.bottomRight||0===i.bottomRight?i.bottomRight:i.topLeft,i.bottomLeft=i.bottomLeft||0===i.bottomLeft?i.bottomLeft:i.bottomRight,i}static ConvertSize(e){let t=wt.SplitString(e," "),i={width:t.length>0?parseInt(t[0]):0,height:t.length>1?parseInt(t[1]):null};return i.height=i.height||0===i.height?i.height:i.width,i}static ConvertAnimation(e){if(null===e||0===e.length)return null;let t=e.indexOf("cubic-bezier"),i=[];if(t>=0){let s=e.indexOf(")"),n=e.substring(t,s+1),r=wt.SplitString(e,n);for(let e of r){let t=wt.SplitString(e," ");i=i.concat(t)}i.push(n)}else i=wt.SplitString(e," ");let s=null,n=0,r=1,a=e.includes("alternate");for(let e=2;e<i.length;e++){if("infinite"===i[e]){r=-1;continue}let t=wt.ConvertTimeMs(i[e]);!1===isNaN(t)?n=t:(t=parseFloat(i[e]),!1===isNaN(t)?r=t:s=i[e])}let o=i.length>1?wt.ConvertTimeMs(i[1]):0;return{name:i.length>0?i[0]:"",duration:o,timingFunction:wt.ConvertEasing(s,o),delay:n,iterationCount:r,direction:a,originStr:e}}static ConvertTransition(e){if(null==e||0==e.length)return null;let t={},i=new Array,s=e.split(",");for(let e=0;e<s.length;e++)if(s[e].indexOf("(")>=0){let t=e;for(;t<s.length&&s[t].indexOf(")")<0;)t++;let n="";for(let i=e;i<=t;i++)i!=e&&(n+=","),n+=s[i];e=t,i=i.concat(n)}else i=i.concat(s[e]);for(let e of i){let i=wt.ConvertAnimation(e);if(t[i.name]=i,"all"==i.name){let e=new Array("opacity","left","top","width","height","transform");for(let s of e)t[s]=i}}return t}static ConvertTimeMs(e){e||(e="");let t=NaN;return(e=e.trim()).endsWith("ms")?t=1:e.endsWith("s")&&(t=1e3),t*=parseFloat(e),t}static ConvertEasing(e,t){let s=i.Easing.Circular.InOut;if(!e)return s;if(e.includes("ease"))s=e.includes("-in-out")?i.Easing.Circular.InOut:e.includes("-out")?i.Easing.Circular.Out:e.includes("-in")?i.Easing.Circular.In:i.Easing.Circular.InOut;else if(e.includes("linear"))s=null;else if(e.includes("cubic-bezier")){let n=wt.ConvertBezier(e);s=new i.BezierEasing(n.x1,n.y1,n.x2,n.y2,t)}else if(e.includes("steps")){let t=wt.ConvertSteps(e);s=new i.StepsEasing(t.steps,t.type)}return s}static ConvertBezier(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let i=wt.SplitString(e,",");return{x1:i.length>0?parseFloat(i[0]):0,y1:i.length>1?parseFloat(i[1]):0,x2:i.length>2?parseFloat(i[2]):0,y2:i.length>3?parseFloat(i[3]):0}}static ConvertSteps(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let i=wt.SplitString(e,",");return{steps:i.length>0?parseInt(i[0]):1,type:i.length>1?i[1].includes("start")?0:1:0}}static ConvertOverflow(e,t){return e&&!e.includes("visible")?t.HIDDEN:t.VISIBLE}static ConvertObjectFit(e,t){return"symbol"==typeof e?e:(e||(e=""),e.includes("fill")?t.FILL:e.includes("contain")?t.CONTAIN:e.includes("cover")?t.COVER:e.includes("none")?t.NONE:e.includes("scale-down")?t.SCALEDOWN:t.CONTAIN)}static SplitString(e,t){e||(e="");let i=e.trim().split(t);if(" "!==t)return i;let s=[];for(let e of i)e&&s.push(e);return s}}class vt{constructor(e){if(this.top=null,this.right=null,this.bottom=null,this.left=null,!e||!1===e.startsWith("inset"))return void console.error("Inset.Parse() InvalidArgs: value=",e);let t=e.indexOf("(")+1,i=e.substring(t),s=wt.ConvertRect(i);this.top=s.top,this.right=s.right,this.bottom=s.bottom,this.left=s.left}}class yt{constructor(e){if(this.source=null,this.slice=null,this.repeat=null,this.outset=null,this.width=null,!e)return void console.error("BorderImage.constructor() InvalidArgs: value=",e);let t=e.indexOf(")")+1,i=e.substring(0,t),s=e.substring(t);this.source=new ht(i),this.slice=wt.ConvertRect(s)}}class bt{constructor(){this.refStyleObject=new Map,this.value=void 0}static AppendRefStyle(e,t,i){let s=bt.jsvGetStyleVar(e);s.refStyleObject.has(t)||s.refStyleObject.set(t,[]),s.refStyleObject.get(t).push(i)}static RemoveRefStyle(e){for(const t of bt.VariableMap.values())for(const i of t.refStyleObject.keys())i==e&&t.refStyleObject.delete(e)}static UpdateValue(e,t){let i=bt.jsvGetStyleVar(e);i.value=t;for(const[e,t]of i.refStyleObject)for(const i of t)e.jsvSetClassProperty(i)}static GetValue(e){return bt.jsvGetStyleVar(e).value}static jsvGetStyleVar(e){e.startsWith("--")&&(e=`var(${e})`),bt.VariableMap.has(e)||bt.VariableMap.set(e,new bt);return bt.VariableMap.get(e)}}bt.VariableMap=new Map;class Tt{constructor(){this.jsvStore={},this.jsvLazySyncCache=new ft("style"),this.jsvLockedProps={},this.jsvNamedClassArray=null,this.jsvCustomStyles={},this.jsvLazyPrevClassNames=null,this.jsvLazyPrevInheritedClassNames=null,this.jsvLazyClassNames=null,this.jsvLazyInheritedClassNames=null,this.jsvLazyClassAttributes=null}setProperty(e,t){"function"==typeof document.jsvCheckStyleFormat&&document.jsvCheckStyleFormat(e,t),this.jsvLockedProps[e]=!0,t=Tt.JsvConvertPropValue(e,t),this.jsvUpdateProperty(e,t)}getPropertyValue(e){if(void 0!==this.jsvStore[e])return this.jsvStore[e];let t=this.jsvGetClassPropValue(this.jsvLazyClassNames,this.jsvLazyClassAttributes,e);return t?(e==Tt.PROP.ANIMATION?t=wt.ConvertAnimation(t):e==Tt.PROP.TRANSITION&&(t=wt.ConvertTransition(t)),t):(t=this.jsvGetClassPropValue(this.jsvLazyInheritedClassNames,this.jsvLazyClassAttributes,e),t?(e==Tt.PROP.ANIMATION?t=wt.ConvertAnimation(t):e==Tt.PROP.TRANSITION&&(t=wt.ConvertTransition(t)),t):void 0)}jsvDestory(){bt.RemoveRefStyle(this)}jsvUpdateProperty(e,t){let i=this.jsvSetPropertySilently(e,t);i&&this.jsvLazySyncCache.setCacheProperty(i,!0)}jsvSetPropertySilently(e,t){if(e.startsWith("--"))return void bt.UpdateValue(e,t);if("string"==typeof t&&t.startsWith("var(--"))return void bt.AppendRefStyle(t,this,e);if("animation"===e){if(this.jsvStore[e]?.originStr===t?.originStr)return null}else if(this.jsvStore[e]===t)return null;return this.jsvStore[e]=t,Tt.JsvGetStyleType(e)}jsvApplyClasses(e,t){if(e.indexOf("JsvStyle_")<0){t?(this.jsvLazyPrevInheritedClassNames=this.jsvLazyInheritedClassNames,this.jsvLazyInheritedClassNames=e.split(" ")):(this.jsvLazyPrevClassNames=this.jsvLazyClassNames,this.jsvLazyClassNames=e.split(" "));const i=Tt.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(i,!0)}else if(e){let t=e.split(" "),s={};this.jsvNamedClassArray=new Array(t.length);let n=0;for(let e of t){let t=null;if(i.ReactUtils.StyleClassMap.hasOwnProperty(e)){t=i.ReactUtils.StyleClassMap[e];let n=t.getAttach();if(null==n){let e=t.getStyles();n={altStyles:{},hasTextMajorStyle:0,textPackAttr:null};for(let t in e)n.altStyles[t]=Tt.JsvConvertPropValue(t,e[t]);t.updateAttach(n)}"text"===t.classType()&&(n.hasTextMajorStyle=2,null===n.textPackAttr&&(n.textPackAttr={textLineAlign:t.getLineAlign(),textVerticalAlign:t.getVerticalAlign()}),this.jsvCustomStyles.textLineAlign=n.textPackAttr.textLineAlign,this.jsvCustomStyles.textVerticalAlign=n.textPackAttr.textVerticalAlign),Object.assign(s,n.altStyles)}else console.error("Error: className not found");this.jsvNamedClassArray[n]=t,n++}for(let e in s)this.jsvLockedProps[e]||this.jsvUpdateProperty(e,s[e])}}jsvAppendClassAttribute(e){this.jsvLazyClassAttributes||(this.jsvLazyClassAttributes=new Set),this.jsvLazyClassAttributes.add(e);const t=Tt.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(t,!0)}jsvSetClassProperty(e){let t=Tt.JsvGetStyleType(e);t&&this.jsvLazySyncCache.setCacheProperty(t,!0)}jsvGetClassPropValue(e,t,i){if(!e)return;const s=(e,t,i,s)=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(i&&(r+="["+i+"]"),!e.hasOwnProperty(r))continue;const a=e[r];if(!a.hasOwnProperty(s))continue;let o=a[s];return"string"==typeof o&&o.startsWith("var(--")&&(o=bt.GetValue(o)),o}},n=window.JsvCode.Dom.StyleSheets;for(const r of t??[]){const t=s(n,e,r,i);if(t)return t}return s(n,e,null,i)}jsvGetClassDeclarations(e,t){if(!e)return;const i=(e,t,i)=>{let s={};for(let n=0;n<t.length;n++){let r=t[n];if(i&&(r+="["+i+"]"),!e.hasOwnProperty(r))continue;const a=e[r];Object.assign(s,a)}return s},s=window.JsvCode.Dom.StyleSheets;let n=i(s,e,null);for(const r of t??[]){const t=i(s,e,r);Object.assign(n,t)}return n}jsvUpdateChangedClasses(e,t,i){gt.D("jsvGetChangedClassTypes() classNames="+e);let s={};if(t){bt.RemoveRefStyle(this);const e=this.jsvGetClassDeclarations(t,i);for(const t of Object.keys(e)){s[Tt.JsvGetStyleType(t)]=!0}t=null}if(e){const t=this.jsvGetClassDeclarations(e,i);for(const[e,i]of Object.entries(t)){s[Tt.JsvGetStyleType(e)]=!0,"string"==typeof i&&i.startsWith("var(--")&&bt.AppendRefStyle(i,this,e)}}return s}jsvSetChangedListener(e){let t=null;e&&(t=t=>{if(t.hasOwnProperty(Tt.TYPE.CLASS_NAME)){let e=this.jsvUpdateChangedClasses(this.jsvLazyClassNames,this.jsvLazyPrevClassNames,this.jsvLazyClassAttributes);Object.assign(t,e),e=this.jsvUpdateChangedClasses(this.jsvLazyInheritedClassNames,this.jsvLazyPrevInheritedClassNames,this.jsvLazyClassAttributes),Object.assign(t,e),t[Tt.TYPE.CLASS_NAME]=void 0}e(t)}),this.jsvLazySyncCache.setOnSyncCallback(t)}static JsvContainsTextMajor(e){for(let t of Tt.TextClassMajorStyles)if(e.hasOwnProperty(t))return!0;return!1}static JsvGetStyleType(e){switch(e){case Tt.PROP.LEFT:case Tt.PROP.RIGHT:case Tt.PROP.TOP:case Tt.PROP.BOTTOM:case Tt.PROP.ZINDEX:return Tt.TYPE.LAYOUT_POS;case Tt.PROP.TRANSFORM:case Tt.PROP.TRANSFORMORIGIN:return Tt.TYPE.TRANSFORM;case Tt.PROP.WIDTH:case Tt.PROP.HEIGHT:case Tt.PROP.VISIBILITY:case Tt.PROP.DISPLAY:case Tt.PROP.CLIPPATH:case Tt.PROP.OVERFLOW:case Tt.PROP.OBJECTFIT:case Tt.PROP.PERSPECTIVE:case Tt.PROP.PERSPECTIVEORIGIN:case Tt.PROP.BACKFACEVISIBILITY:case Tt.PROP.TRANSFORMSTYLE:case Tt.PROP.JSVVIDEOROTATION:return Tt.TYPE.LAYOUT_SIZE;case Tt.PROP.BACKGROUNDCOLOR:case Tt.PROP.BACKGROUNDIMAGE:case Tt.PROP.BORDERRADIUS:return Tt.TYPE.BACKGROUND;case Tt.PROP.COLOR:case Tt.PROP.LINEHEIGHT:case Tt.PROP.WHITESPACE:case Tt.PROP.FONTFAMILY:case Tt.PROP.FONTSIZE:case Tt.PROP.FONTSTYLE:case Tt.PROP.FONTWEIGHT:case Tt.PROP.TEXTALIGN:case Tt.PROP.TEXTSHADOW:case Tt.PROP.TEXTOVERFLOW:case Tt.PROP.WEBKITTEXTSTROKE:return Tt.TYPE.FOREGROUND;case Tt.PROP.BORDERIMAGE:case Tt.PROP.BORDERIMAGEWIDTH:case Tt.PROP.BORDERIMAGEOUTSET:return Tt.TYPE.BORDER;case Tt.PROP.ANIMATION:return Tt.TYPE.ANIMATION;case Tt.PROP.TRANSITION:return Tt.TYPE.TRANSITION;case Tt.PROP.OPACITY:break;default:return console.warn("Unknown style type for: "+e),null}}static JsvConvertPropValue(e,t){if(void 0===t)return t;if(e.startsWith("--")||t?.startsWith?.("var(--"))return t;switch(e){case Tt.PROP.TOP:case Tt.PROP.BOTTOM:case Tt.PROP.LEFT:case Tt.PROP.RIGHT:case Tt.PROP.WIDTH:case Tt.PROP.HEIGHT:case Tt.PROP.JSVVIDEOROTATION:return wt.ConvertInt(t);case Tt.PROP.VISIBILITY:case Tt.PROP.DISPLAY:return t.toUpperCase();case Tt.PROP.OVERFLOW:return wt.ConvertOverflow(t,Tt.Overflow);case Tt.PROP.OBJECTFIT:return wt.ConvertObjectFit(t,Tt.ObjectFit);case Tt.PROP.TRANSFORM:case Tt.PROP.TRANSFORMORIGIN:return t;case Tt.PROP.CLIPPATH:return new vt(t);case Tt.PROP.BORDERIMAGE:return new yt(t);case Tt.PROP.BORDERIMAGEWIDTH:case Tt.PROP.BORDERIMAGEOUTSET:return wt.ConvertRect(t);case Tt.PROP.BORDERRADIUS:return wt.ConvertCorner(t);case Tt.PROP.ANIMATION:return wt.ConvertAnimation(t);case Tt.PROP.TRANSITION:return wt.ConvertTransition(t);case Tt.PROP.OPACITY:return wt.ConvertFloat(t);default:return wt.ConvertPx(t)}}}Tt.Overflow={HIDDEN:Symbol("hidden"),VISIBLE:Symbol("visible")},Tt.ObjectFit={FILL:Symbol("fill"),CONTAIN:Symbol("contain"),COVER:Symbol("cover"),NONE:Symbol("none"),SCALEDOWN:Symbol("scale-down")},Tt.TextClassMajorStyles=new Set(["textOverflow","wordWrap","textShadow","color","fontFamily","fontStyle","fontWeight","textAlign","WebkitTextStroke"]),Tt.TYPE={LAYOUT_POS:"layout-position",LAYOUT_SIZE:"layout-size",FOREGROUND:"foreground",BACKGROUND:"background",BORDER:"border",ANIMATION:"animation",TRANSFORM:"transform",TRANSITION:"transition",CLASS_NAME:"class-name"},Tt.PROP={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",WIDTH:"width",HEIGHT:"height",VISIBILITY:"visibility",DISPLAY:"display",BACKFACEVISIBILITY:"backfaceVisibility",CLIPPATH:"clipPath",OVERFLOW:"overflow",OBJECTFIT:"objectFit",TRANSFORM:"transform",TRANSFORMORIGIN:"transformOrigin",PERSPECTIVE:"perspective",PERSPECTIVEORIGIN:"perspectiveOrigin",ZINDEX:"zIndex",TRANSFORMSTYLE:"transformStyle",BACKGROUNDCOLOR:"backgroundColor",BACKGROUNDIMAGE:"backgroundImage",BORDERRADIUS:"borderRadius",COLOR:"color",LINEHEIGHT:"lineHeight",WHITESPACE:"whiteSpace",FONTFAMILY:"fontFamily",FONTSIZE:"fontSize",FONTSTYLE:"fontStyle",FONTWEIGHT:"fontWeight",TEXTALIGN:"textAlign",TEXTSHADOW:"textShadow",TEXTOVERFLOW:"textOverflow",WEBKITTEXTSTROKE:"WebkitTextStroke",BORDERIMAGE:"borderImage",BORDERIMAGEWIDTH:"borderImageWidth",BORDERIMAGEOUTSET:"borderImageOutset",ANIMATION:"animation",TRANSITION:"transition",OPACITY:"opacity",JSVVIDEOROTATION:"JsvVideoRotation"};for(let e in Tt.PROP){let t=Tt.PROP[e];Object.defineProperty(Tt.prototype,t,{set:function(e){this.setProperty(t,e)},get:function(){return this.getPropertyValue(t)}})}let St=null;class Ct{static getHandlers(e){const t=Ct.reactEventHandlers(e);return t||(e._vei?e._vei:{})}static reactEventHandlers(e){return null==St&&Ct._getReactToken(e),e["__reactEventHandlers$"+St]}static _getReactToken(e){for(let t in e)if(t.indexOf("__reactEventHandlers")>=0||t.indexOf("__reactInternalInstance")>=0){let e=t.indexOf("$");St=t.substring(e+1);break}}}class Et extends mt{constructor(e){super(mt.ELEMENT_NODE),this.parentElement=null,this.tagName=this.jsvGetTagName(),this.tagName===Et.TAG.STYLE?(this.style=null,this.jsvMainView=null,this.jsvMaskView=null):(this.style=new Tt,this.jsvMainView=new i.LayoutView,this.jsvMaskView=null),this.jsvAnimation=null,this.jsvStore={transition:null,transitionTmp:null,textContent:null,textStylePack:null,clientWidth:NaN,clientHeight:NaN,textureWidth:NaN,textureHeight:NaN,scopedAttributes:[]},this.jsvLazySyncCache=new ft("element"),this.instantSwapCallback=null,this.eventHandlers=null,this.jsvInheritClassDepth=null,this.jsvHasInheritClassChildren=!1}appendChild(e){super.appendChild(e),this.jsvInsertChild(e,null)}removeChild(e){this.jsvRemoveChild(e),super.removeChild(e)}insertBefore(e,t){super.insertBefore(e,t),this.jsvInsertChild(e,t)}get childElementCount(){return this.childNodes.length}get firstElementChild(){return this.childNodes.length>0?this.childNodes[0]:null}get lastElementChild(){const e=this.childNodes.length;return e>0?this.childNodes[e-1]:null}set className(e){this.setAttribute("class",e)}setAttribute(e,t){e&&(this[e]=t,e.startsWith("data-v-")?this._jsvAppendScopedAttribute(e,0):"class"===e?this._jsvSetClassNames(t,0):"jsv-inherit-class"===e?this._jsvSetInheritClassDepth(parseInt(t)):e.startsWith(Et.ATTRIBUTE.JSVPREFIX)?(e=e.replace(/-/g,"_"),this.jsvLazySyncCache.setCacheProperty(e,t)):window.JsView||"id"!==e||this.jsvMainView.Element&&(this.jsvMainView.Element.id=t))}removeAttribute(e){this[e]=void 0,e.startsWith(Et.ATTRIBUTE.JSVPREFIX)&&this.jsvLazySyncCache.setCacheProperty(e,void 0)}getAttribute(e){return this[e]}hasAttribute(e){return console.log("Element.hasAttribute() name="+e),!!this[e]}get clientWidth(){return isNaN(this.jsvStore.clientWidth)?this.style.width:this.jsvStore.clientWidth}get clientHeight(){return isNaN(this.jsvStore.clientHeight)?this.style.height:this.jsvStore.clientHeight}focus(){console.log("Element.focus()"),document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new _t(_t.Type.BLUR);t.target=e,document.dispatchEvent(t)}let t=new _t(_t.Type.FOCUS);document.dispatchEvent(t)}jsvInsertChild(e,t){if(e.parentElement=this,e.nodeType===mt.ELEMENT_NODE&&e.tagName!==Et.TAG.STYLE){if(!1===document.jsvIsReady)return void console.warn("Element.appendChild() Failed to append child to Forge. jsvIsReady="+document.jsvIsReady);e.jsvOnLoadForgeView(),e.style.jsvSetChangedListener(e.jsvOnStyleChanged.bind(e)),t=this.jsvBackwardFindForgeView(t);let i=e.jsvMaskView.GetLayoutParams();this.jsvMainView.InsertView(e.jsvMaskView,t?t.jsvMaskView:null,i),(e.jsvInheritClassDepth>0||e.jsvHasInheritClassChildren)&&(this.jsvHasInheritClassChildren=!0)}else e.nodeType===mt.TEXT_NODE&&(this.textContent=e.textContent)}jsvRemoveChild(e){e.parentElement=null,e.jsvLazySyncCache=null,e.style?.jsvSetChangedListener(null),e.style?.jsvDestory(),e.jsvAnimation?.Cancel(),e.jsvAnimation=null,e instanceof Et&&this.jsvMainView.RemoveView(e.jsvMaskView)}jsvOnLoadForgeView(){if(this.style.clipPath||this.style.overflow||this.style.objectFit){if(this.jsvMaskView)throw Error("Jsview: jsvMaskView is conflicting.");this.jsvMaskView=new i.ClipView}else this.jsvMaskView||(this.jsvMaskView=this.jsvMainView);this.jsvMaskView!==this.jsvMainView&&this.jsvMaskView.AddView(this.jsvMainView);let e=this.jsvCallbackOnUnloadForgeView();e&&this.jsvMainView.RegisterDetachCallback(e),this.jsvLazySyncCache.setOnSyncCallback((e=>{this.jsvSetElementProp(e)}))}jsvSetElementProp(e){this.jsvMainView&&this.jsvMainView.SetElementProp(e,ct.RootActivity)}jsvCallbackOnUnloadForgeView(){return null}jsvOnStyleChanged(e){let t=!!e[Tt.TYPE.LAYOUT_SIZE],i=!1;e[Tt.TYPE.LAYOUT_POS]&&(t||(this.jsvFlushViewLayout(),i=!0)),e[Tt.TYPE.LAYOUT_SIZE]&&(this.jsvFlushViewLayout(),i=!0),e[Tt.TYPE.TRANSFORM]&&!i&&(this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.jsvFlushViewTransition(),i=!0),e[Tt.TYPE.BACKGROUND]&&this.jsvFlushViewBackground(),e[Tt.TYPE.ANIMATION]&&this.jsvFlushViewAnimation(),e[Tt.TYPE.TRANSITION]&&!i&&this.jsvFlushViewTransition(),this.jsvFlushEventHandlers()}jsvFlushEventHandlers(){null===this.eventHandlers&&(this.eventHandlers=Ct.getHandlers(this),this.eventHandlers&&this.eventHandlers.onClick&&this.jsvMainView&&this.jsvMainView.EnableDivTouch(this,null))}jsvApplyObjectFit(e){return null}jsvFlushViewLayout(){if((this.style.clipPath||this.style.overflow||this.style.objectFit)&&!this.jsvMaskView)return void console.error("Element.jsvFlushViewLayout() InvalidOpt: clippath=",this.style.clipPath);const e={x:isNaN(this.style.left)?0:this.style.left,y:isNaN(this.style.top)?0:this.style.top,width:isNaN(this.style.width)?0:this.style.width,height:isNaN(this.style.height)?0:this.style.height};let t=null;if(this.style.objectFit&&(t=this.jsvApplyObjectFit(e),this.style.objectFit===Tt.ObjectFit.FILL&&(t=null)),this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.style.perspective&&this.style.perspective>0){let e=this.style.perspectiveOrigin?this.style.perspectiveOrigin:null;this.jsvMainView.SetPerspective(this.style.perspective,e)}if(this.style.backfaceVisibility&&this.jsvMainView.SetBackfaceVisibility("visible"==this.style.backfaceVisibility),this.style.transformStyle&&this.jsvMainView.SetTransformStyle(this.style.transformStyle),this.jsvMaskView.ResetLayoutParams({x:e.x,y:e.y,width:this.clientWidth,height:this.clientHeight}),this.jsvMaskView!==this.jsvMainView){const e={x:0,y:0,width:this.jsvMaskView.LayoutParams.Width,height:this.jsvMaskView.LayoutParams.Height};this.jsvMainView.ResetLayoutParams(e)}let s=this.style.visibility;"NONE"==this.style.display&&(s="HIDDEN"),this.jsvMaskView.SetVisibility(s);let n=null;null!==t&&window.JsView?n={x:t.x,y:t.y,width:t.width,height:t.height}:this.style.clipPath?n={x:this.style.clipPath.left,y:this.style.clipPath.top,width:this.jsvMaskView.LayoutParams.Width-this.style.clipPath.left-this.style.clipPath.right,height:this.jsvMaskView.LayoutParams.Height-this.style.clipPath.top-this.style.clipPath.bottom}:this.style.overflow===Tt.Overflow.HIDDEN&&null===this.jsvStore.textContent&&(n={x:0,y:0,width:this.style.width,height:this.style.height}),n?this.jsvMaskView.SetClipRect(n.x,n.y,n.width,n.height,!0):this.jsvMaskView instanceof i.ClipView&&this.jsvMaskView.SetClipRect(0,0,0,0,!1),void 0!==this.style.zIndex&&null!==this.style.zIndex&&this.jsvMaskView.SetZIndex(this.style.zIndex),this.jsvFlushViewTransition()}jsvFlushViewBackground(){this.style.backgroundColor&&(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,ct.SetBackgroundColor(this.jsvMainView,this.style.backgroundColor,this.style.borderRadius)),this.style.backgroundImage&&(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,ct.SetBackgroundImage(this.jsvMainView,this.style.backgroundImage,this.style.borderRadius))}jsvFlushViewAnimation(){if(this.jsvAnimation&&this.jsvAnimation.Cancel(),!this.style.animation)return;let e=document.jsvGetKeyFrames(this.style.animation.name,this.jsvStore.scopedAttributes);this.jsvAnimation=new i.CssKeyframeAnimation(e,this.style.animation.duration,this.style.animation.timingFunction,this.style.width?this.style.width:this.clientWidth,this.style.height),this.jsvAnimation.EnableDelay(this.style.animation.delay).SetRepeat(this.style.animation.iterationCount),"forwards"===this.style.animationFillMode&&this.jsvAnimation.Enable(i.AnimationEnable.KeepTransform);var t=this;let s=new i.AnimationListener;s.OnEnd((e=>{if(t.jsvAnimation=null,e){if(t.eventHandlers&&t.eventHandlers.onAnimationEnd){let e;e=new pt("animationend"),e.target=t,t.eventHandlers.onAnimationEnd(e)}null==t.instantSwapCallback&&(t.instantSwapCallback=i.sRenderBridge.InstantPerformSwap.bind(i.sRenderBridge)),Promise.resolve().then(t.instantSwapCallback)}})),this.jsvAnimation.Enable(i.AnimationEnable.ReleaseAfterEndCallback),this.jsvAnimation.SetAnimationListener(s),this.jsvMaskView.StartAnimation(this.jsvAnimation)}jsvFlushViewTransition(){if(this.style.animation)return;if(null!=this.jsvStore.transitionTmp&&this.jsvStore.transitionTmp.syncTimes!=dt.cnt&&-1!=this.jsvStore.transitionTmp.syncTimes){let e=this.jsvStore.transition;this.jsvStore.transition=this.jsvStore.transitionTmp,this.jsvStore.transitionTmp=e,null!=this.jsvStore.transitionTmp&&(this.jsvStore.transitionTmp.syncTimes=-1)}if(this.style.transition){if(this.jsvStore.transition){if(!this._JsvBuildTransition())return}}else this.jsvAnimation&&(this.jsvAnimation.Cancel(),this.jsvAnimation=null);let e=this.jsvStore.transitionTmp;e||(e={left:0,top:0,width:0,height:0,opacity:1,transform:null,syncTimes:-1}),e.left=this.style.left,e.top=this.style.top,e.width=this.style.width,e.height=this.style.height,e.opacity=this.style.opacity,e.transform=this.style.transform,e.syncTimes=dt.cnt,this.jsvStore.transitionTmp=e}_JsvBuildTransition(){let e=[];for(let t in this.style.transition){let i=this.jsvStore.transition[t],s=this.style[t];if(i===s)continue;let n=this.style.transition[t],r={name:t,dur:n.duration,tf:null,dly:n.delay,from:i||"",to:s};"transform"===t&&(r.origin=this.style.transformOrigin?this.style.transformOrigin:"center center"),n.timingFunction&&(r.tf=n.timingFunction.Package()),e.push(r)}if(e.length<=0)return!1;var t=this;let s=new i.AnimationListener;return s.OnEnd((e=>{if(t.jsvAnimation=null,e){if(t.eventHandlers&&t.eventHandlers.onTransitionEnd){let e=new pt("transitionend");e.target=t,t.eventHandlers.onTransitionEnd(e)}null==t.instantSwapCallback&&(t.instantSwapCallback=i.sRenderBridge.InstantPerformSwap.bind(i.sRenderBridge)),Promise.resolve().then(t.instantSwapCallback)}})),this.jsvAnimation=new i.CssTransitionAnimation(e),this.jsvAnimation.SetAnimationListener(s),this.jsvMaskView.StartAnimation(this.jsvAnimation),!0}jsvBackwardFindForgeView(e){let t=e;for(;t&&!(t instanceof Et);)t=t.nextSibling;return t}static applyObjectFitCommon(e,t,i){if(i&&!isNaN(e.jsvStore.textureWidth)&&!isNaN(e.jsvStore.textureHeight)){const s=e.style.objectFit,n=i.ApplyObjectFit(t.width,t.height,e.jsvStore.textureWidth,e.jsvStore.textureHeight,s,Tt.ObjectFit);return 0!==t.width&&0!==t.height||0===t.width&&0===t.height||(e.jsvStore.clientWidth=Math.max(t.width,n.width),e.jsvStore.clientHeight=Math.max(t.height,n.height)),n}return null}_jsvAppendScopedAttribute(e,t){if(0!=t&&this.jsvInheritClassDepth!=t||(this.jsvStore.scopedAttributes.push(e),this.style.jsvAppendClassAttribute(e)),this.jsvHasInheritClassChildren){t=this.jsvInheritClassDepth==t?1:t+1;for(const i of this.childNodes)i.jsvInheritClassDepth<=0&&0==i.jsvHasInheritClassChildren||i instanceof Et&&(i.jsvStore.scopedAttributes.includes(e)||i._jsvAppendScopedAttribute(e,t))}}_jsvSetClassNames(e,t){if(0!=t&&this.jsvInheritClassDepth!=t||this.style.jsvApplyClasses(e,this.jsvInheritClassDepth==t),this.jsvHasInheritClassChildren){t=this.jsvInheritClassDepth==t?1:t+1;for(const i of this.childNodes)i.jsvInheritClassDepth<=0&&0==i.jsvHasInheritClassChildren||i instanceof Et&&i._jsvSetClassNames(e,t)}}_jsvSetInheritClassDepth(e){if(e<=0)return;this.jsvInheritClassDepth=e;let t=this;for(let i=0;i<e&&(t=t.parentNode,t);i++);if(t){for(const i of t.jsvStore.scopedAttributes)this._jsvAppendScopedAttribute(i,e);this._jsvSetClassNames(t.class,e)}}}Et.TAG={DIV:"DIV",IMAGE:"IMAGE",LINK:"LINK",STYLE:"STYLE",AUDIO:"AUDIO",VIDEO:"VIDEO",ANCHOR:"A",SVG:"SVG",FDIV:"FDIV",AUDIOTRACK:"AUDIOTRACK"},Et.ATTRIBUTE={SRC:"src",JSVPREFIX:"jsv"};class xt extends Et{constructor(){super(),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return Et.TAG.ANCHOR}}class It extends Et{constructor(e){super(),this.jsvMediaView=null,this.jsvMedia=null,this.onVisibilityChange=this.onVisibilityChange.bind(this),this.stopByOnHide=!1,this.playBackground=!1,e&&(this.srcValue=e)}addEventListener(e,t,i){e=e.replace(/-/g,""),super.addEventListener(e,t,i),this.jsvAddMediaListener(e)}jsvOnLoaded(){}set src(e){if(e&&"about:null"!==e&&"about:blank"!==e){e=new ht(e).href}this.jsvMedia||this.jsvInit(),e!==this.jsvMedia.src&&(this.jsvMedia.src=e,this.srcValue=e)}jsvOnLoadForgeView(){console.log("MediaElement jsvOnLoadForgeView"),super.jsvOnLoadForgeView(),this.jsvMedia||this.jsvInit(),this.registerOnVisibilityChange()}jsvInit(){let e=this.jsvEventListener;if(e)for(var t in e.keys)this.jsvAddMediaListener(t);Promise.resolve().then((()=>{this.jsvMedia&&this.jsvMedia.confirmInitSetup?.()}))}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){console.log("MediaElement jsvOnUnloadForgeView"),this.unregisterOnVisibilityChange(),this.jsvMediaView&&(this.jsvMediaView=null),this.jsvRelease()}jsvRelease(){this.jsvMedia&&(this.jsvMedia.pause(),this.jsvMedia.unload&&this.jsvMedia.unload(),this.jsvMedia.releaseResource&&(this.jsvMedia.releaseResource(),this.jsvMedia.onPlatformDestroy())),this.jsvEventListener=void 0}jsvAddMediaListener(e){}onJsViewHide(){this.jsvMedia&&(this.jsvMedia.paused||(this.stopByOnHide=!0),this.jsvMedia.unload())}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}onVisibilityChange(e){this.playBackground||("show"===e.status?this.onJsViewShow():"hide"===e.status&&this.onJsViewHide())}registerOnVisibilityChange(){window.JsView&&window.JsView.onVisibilityChange(this.onVisibilityChange)}unregisterOnVisibilityChange(){window.JsView&&window.JsView.removeEventCallback(this.onVisibilityChange)}setAttribute(e,t){"jsv_play_background"!==e?super.setAttribute(e,t):this.playBackground="true"===t}}It.HOOKS={Audio:Audio,Video:window._ExtVideo,OffscreenVideo:window._ExtOVP},It.PROP={SetOnly:["autoplay","loop","timeupdateless","predownload"],GetOnly:["duration","paused"],SetAndGet:["currentTime","muted","playbackRate","preload","volume"],Function:["load","pause","play","unload","confirmInitSetup"]};for(let e in It.PROP){let t=It.PROP[e];for(let i of t){let t={};"SetOnly"!==e&&"SetAndGet"!==e||(t.set=function(e){this.jsvMedia||this.jsvInit(),this.jsvMedia[i]=e}),"GetOnly"!==e&&"SetAndGet"!==e||(t.get=function(){return this.jsvMedia||this.jsvInit(),this.jsvMedia[i]}),"Function"===e&&(t=function(...e){return this.jsvMedia||this.jsvInit(),this.jsvMedia[i]?this.jsvMedia[i](...e):null}),t instanceof Function?It.prototype[i]=t:Object.defineProperty(It.prototype,i,t)}}class At extends It{constructor(e){super(e),this.jsvOverrideMedia=!1,console.log("AudioElement.constructor()",this)}jsvGetTagName(){return Et.TAG.AUDIO}jsvInit(){this.jsvOverrideMedia||(this.jsvMedia=new It.HOOKS.Audio),super.jsvInit(),this.jsvOnLoaded()}jsvOnLoaded(){this.jsvMediaView=new i.LayoutView,this.jsvMainView.AddView(this.jsvMediaView)}jsvAddMediaListener(e){this.jsvMedia||this.jsvInit(),this.jsvMedia.addEventListener(e,(()=>{let t=new ut(e);t.target=this,this.dispatchEvent(t)}))}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}setAttribute(e,t){if("data-jsv-audio-predownload"==e)return this.jsvMedia||this.jsvInit(),void(this.jsvMedia.predownload=!0);super.setAttribute(e,t)}}class Rt{constructor(){this._PersistMap=new Map,this._PersistMax=300,this._PersistIdx=0,this._PersistTrackList=new Array(this._PersistMax),this._TempMap=new Map,this._TempMax=50,this._TempIdx=0,this._TempTrackList=new Array(this._TempMax)}getPersistPack(e){return this._PersistMap.get(e)}putPersistPack(e,t){Rt._putPack(this._PersistMap,this._PersistTrackList,this._PersistIdx,e,t),this._PersistIdx=(this._PersistIdx+1)%this._PersistMax}getTempPack(e){return this._TempMap.get(e)}putTempPack(e,t){Rt._putPack(this._TempMap,this._TempTrackList,this._TempIdx,e,t),this._TempIdx=(this._TempIdx+1)%this._TempMax}static _putPack(e,t,i,s,n){let r=t[i];r&&(e.delete(r),t[i]=s),e.set(s,n)}}let Pt=new Rt;class Ot extends Et{constructor(){super(),this.jsvContentView=null,this.jsvRefedImgTex=null,this.jsvTextLatexEnable=!1,this.jsvEmoji=!1,this.jsvTextAlignMinWidth=NaN,this.jsvEmptyRect=null}jsvGetTagName(){return Et.TAG.DIV}get textContent(){return this.jsvStore.textContent}set textContent(e){(e||this.jsvStore.textContent)&&(this.jsvStore.textContent=e,this.jsvStore.clientWidth=NaN,this.jsvContentView||(this.jsvContentView=new i.LayoutView,this.jsvMainView.AddView(this.jsvContentView)),this.parentElement&&this.jsvFlushViewForeground())}get clientWidth(){const e=this.style.width;if(e||0===e)return e;if(this.jsvStore.textContent){if(!isNaN(this.jsvStore.clientWidth))return this.jsvStore.clientWidth;const e={str:this.jsvStore.textContent,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};return this.jsvStore.clientWidth=ct.GetTextWidth(e),this.jsvStore.clientWidth}return super.clientWidth}jsvOnLoadForgeView(){this.style.borderImage&&(this.jsvMaskView=new i.NinePatchView),super.jsvOnLoadForgeView()}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){ct.UnrefImgTexSize(this.jsvRefedImgTex),this.jsvRefedImgTex=null}jsvOnStyleChanged(e){super.jsvOnStyleChanged(e),this.jsvStore.textStylePack=null;let t=!!e[Tt.TYPE.FOREGROUND];e[Tt.TYPE.LAYOUT_SIZE]&&(t||this.jsvFlushViewForeground()),e[Tt.TYPE.FOREGROUND]&&this.jsvFlushViewForeground(),e[Tt.TYPE.BORDER]&&this.jsvFlushViewBorder()}jsvFlushViewForeground(){if(this.jsvContentView&&(this.jsvContentView.ClearViews(),this.jsvStore.textContent)){let e=void 0===this.style.height||0==this.style.height,t=e?(e,t)=>{this.jsvStore.clientHeight=e.height}:null,i=this.jsvBuildTextView(t);e&&i.EnableAutoHeight(),this.jsvContentView.AddView(i)}}jsvBuildTextView(e){let t=this.jsvStore.textStylePack;if(null===t&&(t=this._jsvGetClassNameCache()),null===t){this.style.jsvCustomStyles.textLineAlign||(this.style.jsvCustomStyles.textLineAlign=this.style.lineHeight?"middle":"top"),this.style.jsvCustomStyles.textVerticalAlign||(this.style.jsvCustomStyles.textVerticalAlign="top");let e=Ot._jsvStyleToPackData(this.style),s=JSON.stringify(e),n=Pt.getTempPack(s);n||(n=i.sTextStyleCache.StyleToPack(e),Pt.putTempPack(s,n)),t=n}this.jsvStore.textStylePack=t;let s=this.style.lineHeight?parseInt(this.style.lineHeight):this.style.fontSize?1.3*this.style.fontSize:14,n=this.style.width,r=!1;if(void 0===n&&(n=this.clientWidth,r=!0),this.jsvTextAlignMinWidth&&n<this.jsvTextAlignMinWidth&&(n=this.jsvTextAlignMinWidth),n>3e3){if(!r)return console.error(`text too long. str=${this.jsvStore.textContent}`),null;console.log(`text too long, start to break down. width(${n})`);let a=new i.LayoutView,o=Math.floor(2048/this.style.fontSize),l=this.jsvStore.textContent.length,h=0,c=0,u={str:null,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};for(;l>0;){let n=o<l?o:l,r=this.jsvStore.textContent.substr(h,n);h+=n,u.str=r;let d=ct.GetTextWidth(u),f=i.sTextUtils.BuildTextView(ct.TextureManager,r,t,0===h?e:null,{width:d,height:this.style.height},this.style.fontSize,s,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect);a.AddView(f,{x:c,y:0,width:d,height:this.style.height}),c+=d,l-=n}return a}return i.sTextUtils.BuildTextView(ct.TextureManager,this.jsvStore.textContent,t,e,{width:n,height:this.style.height},this.style.fontSize,s,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect)}_jsvGetClassNameCache(){if(null===this.style.jsvNamedClassArray)return null;if(Tt.JsvContainsTextMajor(this.style.jsvLockedProps))return null;let e="";for(let t of this.style.jsvNamedClassArray){let i=t.getAttach();0===i.hasTextMajorStyle&&(Tt.JsvContainsTextMajor(t.getStyles())?i.hasTextMajorStyle=2:i.hasTextMajorStyle=1),2===i.hasTextMajorStyle&&(e+=t.getName())}if(e.length>0){let t=Pt.getPersistPack(e);if(!t){let s=Ot._jsvStyleToPackData(this.style);t=i.sTextStyleCache.StyleToPack(s),Pt.putPersistPack(e,t)}return t}return null}static _jsvStyleToPackData(e){let t={textColor:e.color?e.color:"#000000",font:e.fontFamily,italic:"italic"===e.fontStyle,bold:"bold"===e.fontWeight,hAlign:e.textAlign?e.textAlign:"left",vAlign:e.jsvCustomStyles.textLineAlign?e.jsvCustomStyles.textLineAlign:"middle",vAreaAlign:e.jsvCustomStyles.textVerticalAlign?e.jsvCustomStyles.textVerticalAlign:"top",textOverflow:e.textOverflow?e.textOverflow:"clip",wordWrap:"break-word"===e.wordWrap?"break_word":"normal"};"nowrap"===e.whiteSpace&&(t.wordWrap="none");let i=e.textShadow?e.textShadow.split(" "):void 0;i&&(t.shadow={shadowOffsetX:parseInt(i[0]),shadowOffsetY:parseInt(i[1]),shadowBlur:parseFloat(i[2]),shadowColor:i[3]});let s=e.WebkitTextStroke?e.WebkitTextStroke.split(" "):void 0;return s&&(t.stroke={strokeWidth:parseInt(s[0]),strokeColor:s[1]}),t}jsvFlushViewBorder(){if(this.jsvMaskView)if(this.style.clipPath)console.error("BorderImage is conflicting with ClipPath.");else if(this.style.borderImage){if(!(this.jsvMaskView instanceof i.NinePatchView))return void console.error("Error: style.borderImage NOT support dynamic adding");let e=wt.ConvertPx(this.getAttribute("jsv-borderimage-width")),t=wt.ConvertPx(this.getAttribute("jsv-borderimage-height"));if(ct.UnrefImgTexSize(this.jsvRefedImgTex),!this.jsvRefedImgTex||this.jsvRefedImgTex.Source!==this.style.borderImage.source.href){let s=e&&t?{width:e,height:t}:null;if(!this.style.borderImage.source.href)return void this.jsvMaskView.ResetTexture(null);this.jsvRefedImgTex=ct.TextureManager.GetImage2(this.style.borderImage.source.href,!1,s,i.ColorSpace.RGBA_8888)}e&&t&&(console.log("Custom cache image size with: "+e+"/"+t),ct.SetImgTexSize(this.jsvRefedImgTex,{width:e,height:t}));const s=new i.ExternalTextureSetting(this.jsvRefedImgTex);this.jsvMaskView.ResetTexture(s),this.jsvMaskView.WaitTextureToResize(!0),ct.RefImgTexSize(this.jsvRefedImgTex,function(e){if(!this.jsvMaskView)return void console.log("Found border view gone");let t=this.style.borderImageWidth,i=this.style.borderImage.slice,s=Math.floor(e.width*t.top/i.top),n=Math.floor(e.height*t.left/i.left);this.jsvMaskView.SetImageDspSize(s,n);let r=this.style.borderImageOutset?this.style.borderImageOutset:wt.ConvertRect();this.jsvMaskView.SetPadding({start:r.left,width:Math.max(0,s-r.left-r.right)},{start:r.top,width:Math.max(0,n-r.top-r.bottom)}),this.jsvMaskView.SetRepeat([{start:t.left,width:Math.max(0,s-2*t.left)}],[{start:t.top,width:Math.max(0,n-2*t.top)}]),this.jsvMaskView.WaitTextureToResize(!1)}.bind(this))}}setAttribute(e,t){this.jsvTakeTextAttribute(e,t)||super.setAttribute(e,t)}jsvTakeTextAttribute(e,t){return"jsv_text_vertical_align"===e?(this.style.jsvCustomStyles.textVerticalAlign=t,!0):"jsv_text_latex_enable"===e?(this.jsvTextLatexEnable="true"===t,!0):"jsv_text_align_minwidth"===e?(this.jsvTextAlignMinWidth=parseInt(t),!0):"jsv_text_emoji"===e?(this.jsvEmoji="true"===t,!0):("jsv_text_empty_rect"===e&&(this.jsvEmptyRect=JSON.parse(t)),!1)}}class Lt{constructor(e,t){this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new Dt(!1,t))}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t){return this.RouterDelegate.ref.focusBeforeMount(e,t)}printFocusList(){for(let e in this.RouterDelegate.ref._ChildMap)console.log(`branchName[${e}] ${e===this.RouterDelegate.ref._FocusNodeName?"focused":""}`,this.RouterDelegate.ref._ChildMap[e])}printGlobalLastFocus(){console.log("FocusNode:"),console.log(kt.sLastFocus)}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof kt&&t.RouterDelegate.ref===this.RouterDelegate.ref;)e.push({name:t.BranchName}),t=t.GetParentPage()}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}}class Dt{constructor(e,t){this._IsTemp=!!e,this._ChildMap={},this._FocusNameBeforeMount=null,this._FocusNodeName=null,this.NameSpace=t}getCurrentFocusNode(){return this._ChildMap[this._FocusNodeName]}getNodeByName(e,t){let i=e.split(".");return this._FindRouterSearchBase(i,t)._GetNodeFromPathArray(i,e)}_FindRouterSearchBase(e,t){if(0==e[0].length){let t,i;for(let e in this._ChildMap){t=this._ChildMap[e];break}do{i=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),i.RouterDelegate.ref}return t&&t.AsHub&&t.GetParentPage()?t.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(e,t){let i=0,s=this;for(;i<e.length-1;){let n=!1;for(let t in s._ChildMap){let r=s._ChildMap[t].RouterDelegate.ref;if(r!=s&&r.NameSpace==e[i]){s=r,i++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${t}`)}let n=e[i];return s._ChildMap.hasOwnProperty(n)?s._ChildMap[n]:void console.error(`Error: no found fname=${t}`)}add(e,t){e.indexOf(".")>=0?console.error("ERROR: FDiv name can not contains '.'"):this._ChildMap.hasOwnProperty(e)&&this._ChildMap[e]!==t?console.error(`ERROR: FDiv router branch name duplicated:[${e}]`):(this._ChildMap[e]=t,this._FocusNameBeforeMount==e&&(this._FocusNameBeforeMount=null,t.Focus()))}remove(e,t){let i=this._ChildMap[e];i&&i==t&&delete this._ChildMap[e]}rename(e,t){if(!this._ChildMap.hasOwnProperty(e))return void console.error(`ERROR: alter name failed ${e}->${t}`);let i=this._ChildMap[e];delete this._ChildMap[e],this.add(t,i),this._FocusNodeName==e&&(this._FocusNodeName=t)}focusBeforeMount(e,t){if(e.indexOf(".")>=0)return console.error("ERROR: not support name with namespace"),!1;let i=this._ChildMap[e];return this._FocusNodeName=e,i?(i.Focus(!t),!0):(this._FocusNameBeforeMount=e,!1)}focus(e,t){let i=this.focusBeforeMount(e,t);return i||console.log("No found branch:"+e),i}forEach(e){for(let t in this._ChildMap)e(this._ChildMap[t],t,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class kt extends i.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this.BranchName=e,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}updateMountState(){this._Mounted=!0;let e=this.SubPages;for(let t in e)e[t].updateMountState()}getHub(){return this.InterfaceHub||(this.InterfaceHub=new Lt(!0),this.InterfaceHub.RouterDelegate=this.RouterDelegate),this.InterfaceHub}setHub(e){this.RouterDelegate.ref?console.error("Error: hub is already setted."):(this.RouterDelegate.ref=e.RouterDelegate.ref,this.AsHub=!0)}_UseParentRouter(e){this.RouterDelegate=e,this.InterfaceHub&&(this.InterfaceHub.RouterDelegate=e)}routerAdd(e,t){t.RouterDelegate.ref||t._UseParentRouter(this.RouterDelegate),this.RouterDelegate.ref||(this.RouterDelegate.ref=new Dt(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}printFocusList(){this.RouterDelegate.ref?this.RouterDelegate.ref.printFocusList():console.error("Error: no router")}routerUnbind(){let e;this.AsHub?this.GetParentPage()&&(e=this.GetParentPage().RouterDelegate.ref):e=this.RouterDelegate.ref,e&&e.remove(this.BranchName,this)}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}setOnKeyDown(e){this._OnKeyDown=e}setOnKeyUp(e){this._OnKeyUp=e}setOnFocus(e){this._OnFocus=e}setOnBlur(e){this._OnBlur=e}setDispatchKeyUp(e){this._DispatchKeyUp=e}setDispatchKeyDown(e){this._DispatchKeyDown=e}setOnCustomerEvent(e){this._OnCustomerEvent=e}setDispatchKeyProxy(e,t){this._DKeyDownProxy=e,this._DKeyUpProxy=t}requestFocus(e){let t=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(t=this.GetParentPage().RouterDelegate.ref),t?t.focus(this.BranchName,e):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomerEvent(e){return!!this._OnCustomerEvent&&this._OnCustomerEvent(e)}bubbleCustomerEvent(e){this.BubbleCustomerEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return kt.sLastFocus=this,this._DKeyDownProxy?this._DKeyDownProxy(e,this._OriginDispatchKeyDown):this._OriginDispatchKeyDown(e)}_OriginDispatchKeyDown(e){let t=!1;return this._DispatchKeyDown&&(t=this._DispatchKeyDown(e)),!!t||super.DispatchKeyDown(e)}dispatchKeyUp(e){return this.DispatchKeyUp(e)}DispatchKeyUp(e){return this.__DKeyUpProxy?this.__DKeyUpProxy(e,this._OriginDispatchKeyUp):this._OriginDispatchKeyUp(e)}_OriginDispatchKeyUp(e){let t=!1;return this._DispatchKeyUp&&(t=this._DispatchKeyUp(e)),!!t||super.DispatchKeyUp(e)}attachToActivity(e,t){this.AttachToActivity(e,t)}AttachToActivity(e,t){super.SetParent(e,t)}setParent(e){this.SetParent(e)}SetParent(e){if(null!=e&&(super.SetParent(e,null),this._ParentPage._Mounted&&(this.updateMountState(),Mt()),e instanceof kt)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let t=this.RouterDelegate.ref;this.RouterDelegate.ref=null,t.forEach(((t,i)=>{e.routerAdd(i,t)}))}e.routerAdd(this.BranchName,this)}}focus(e){this.Focus(e)}Focus(e){if(!this._Mounted)return kt.sFocusMemos.push({obj:this,bcf:e}),void console.log("page base tree not build, cache focus");super.Focus(e)}OnFocus(){this._OnFocus&&this._OnFocus()}OnBlur(){this._OnBlur&&this._OnBlur()}onUnMount(){let e=this.GetParentPage();e&&e.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind()}getName(){let e=this,t=[this.RouterDelegate.ref.NameSpace];this.AsHub||t.push(this.BranchName);let i=this.RouterDelegate.ref;do{if(e=e.GetParentPage(),"__AppRoot__"==t[0])break;e&&e.RouterDelegate.ref!=i&&(i=e.RouterDelegate.ref,t.unshift(i.NameSpace))}while(e);return"__AppRoot__"==t[0]?t[0]="":console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}printFocusNodeList(){this.getHub().printFocusList()}printGlobalLastFocus(){this.getHub().printGlobalLastFocus()}}kt.sFocusMemos=[],kt.sLastFocus=null,kt.sRootPageNode=null;let Mt=()=>{let e=kt.sFocusMemos.length;if(e>0){let t=kt.sFocusMemos;kt.sFocusMemos=[];for(let i=0;i<e;i++)t[i].obj.Focus(t[i].bcf)}},Ft=1;class Vt extends Et{constructor(){super(),this.FocusNodeRef=new kt(""+Ft++),this.HubRef=void 0}jsvGetTagName(){return Et.TAG.FDIV}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new Lt(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}jsvGetHub(){return this.HubRef}}class jt extends Et{constructor(e){super(e),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){console.log("LinkElement.setAttribute() name="+e+", value=",t),this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var i=new ht(this.href);console.log("Ignore to load link from url="+i.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,t){if(console.log("jsvOnLoadResult isSuccess:"+e+", errCode:"+t),e){if(this.onload){let e=new ut("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+t,target:this})}}class Nt extends Et{constructor(e){super(e),this.src=null,this.onerror=null,this.onload=null,this.charset=null,this.timeout=120}setAttribute(e,t){console.log("ScriptElement.setAttribute() name="+e+", value=",t),this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new ht(this.src);console.log("load script with url="+e.href);var t=this;window.JsView.runJsWithUrl(e.href,!1,((e,i)=>{t.jsvOnLoadResult(e,i)}))}}jsvOnLoadResult(e,t){if(console.log("onLoadResult "+e+" "+t),e){if(this.onload){let e=new ut("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+t,target:this})}}class Gt extends Et{constructor(){super(),console.log("Document header construct")}appendChild(e){"HTMLScriptElement"==e.constructor.name||"HTMLStyleElement"==e.constructor.name||"HTMLLinkElement"==e.constructor.name?window.originDocument.headAppendChild(e):super.appendChild(e),(e instanceof jt||e instanceof Nt)&&e.jsvLoadResource()}removeChild(e){"HTMLScriptElement"==e.constructor.name||"HTMLStyleElement"==e.constructor.name||"HTMLLinkElement"==e.constructor.name?window.originDocument.headRemoveChild(e):super.removeChild(e)}}class Bt extends ut{constructor(e){super("load")}}class Ut extends Et{constructor(e){super(e),this.jsvImageView=new i.LayoutView(null,"img"),this.jsvMainView.AddView(this.jsvImageView),this._ImageInLoading=!1,this.jsvColorSpace=i.ColorSpace.RGBA_8888,this.jsvScaleDownTex=null,this._HasUserOnLoad=!1,this._OnLoadSeq=1}jsvGetTagName(){return Et.TAG.IMAGE}setAttribute(e,t){this.jsvTakeTextureAttribute(e,t)?console.assert(!this._ImageInLoading,`set ${e} after src`):(super.setAttribute(e,t),e===Et.ATTRIBUTE.SRC&&(this._ImageInLoading=!0,this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,this.jsvDrawImage()))}jsvSetElementProp(e){this.jsvImageView.SetElementProp(e,ct.RootActivity)}jsvCallbackOnUnloadForgeView(){return()=>{if(this._HasUserOnLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&e.DisableBackgroundLoad(this)}}}jsvFlushEventHandlers(){if(super.jsvFlushEventHandlers(),this.eventHandlers.onLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&(this._HasUserOnLoad=!0,e.EnableBackgroundLoad(this))}else if(this._HasUserOnLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&e.DisableBackgroundLoad(this),this._HasUserOnLoad=!1}}jsvTakeTextureAttribute(e,t){return"jsv_img_color_space"==e||"jsvImgColorSpace"==e||"jsv-img-color-space"==e?(this.jsvColorSpace=t,!0):("jsv_img_scaledown_tex"==e||"jsvImgScaledownTex"==e||"jsv-img-scaledown-tex"==e)&&(""!==t&&void 0!==t||(t="true"),this.jsvScaleDownTex=t,!0)}jsvFlushViewLayout(){this._ImageInLoading?(this.jsvImageView.WaitTextureToResize(!0),this.jsvImageView.ResetLayoutParams({x:0,y:0,width:this.style.width,height:this.style.height})):this.jsvImageView.WaitTextureToResize(!1),super.jsvFlushViewLayout()}jsvFlushViewBackground(){this.jsvDrawImage();this.getAttribute(Et.ATTRIBUTE.SRC)}jsvOnLoaded(e){if(console.log("ImageElement.jsvOnLoaded() imageSize="+JSON.stringify(e)),this._ImageInLoading=!1,this.jsvStore.textureWidth=e.width,this.jsvStore.textureHeight=e.height,this.style.jsvLazySyncCache.setCacheProperty(Tt.TYPE.LAYOUT_SIZE,!0),this._HasUserOnLoad){let e=new Bt;e.target=this,document.dispatchEvent(e)}}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",Tt.ObjectFit.FILL),super.jsvOnLoadForgeView()}jsvApplyObjectFit(e){return 0!=imageSize.width&&0!=imageSize.height||console.warn("warning: size 0 not support object fit, src="+this.src),Et.applyObjectFitCommon(this,e,this.jsvImageView)}jsvDrawImage(){if(!this.src)return;let e=null;"true"===this.jsvScaleDownTex&&(this.style&&this.style.width?e={width:this.style.width,height:0}:console.error("set jsvScaleDownTex while style.width is not set")),this._OnLoadSeq++;let t=this._OnLoadSeq;ct.SetBackgroundImage(this.jsvImageView,this.src,this.style.borderRadius,(e=>{t===this._OnLoadSeq&&this.jsvOnLoaded(e)}),e,this.jsvColorSpace)}}class Wt extends Et{constructor(e){super(),this.jsvMainView=new i.JsvElementView(e)}get textContent(){return this.jsvMainView.textContent}set textContent(e){this.jsvMainView.textContent=e}setAttribute(e,t){super.setAttribute(e,t),this.jsvMainView.setAttribute(e,t)}removeAttribute(e){super.removeAttribute(e),this.jsvMainView.removeAttribute(e)}getAttribute(e){return this.jsvMainView.getAttribute(e)}hasAttribute(e){return this.jsvMainView.hasAttribute(e)}jsvOnStyleChanged(e){super.jsvOnStyleChanged(e)}}class Ht{constructor(e){let t=e.indexOf(Ht.KeyFramesFlag)+Ht.KeyFramesFlag.length,i=e.indexOf("{"),s=e.substring(t,i);this.name=s.trim(),this.cssText=e}}Ht.KeyFramesFlag="@keyframes";class $t{constructor(e){this.jsvCssRules=null,this.jsvTextContent=e}get cssRules(){if(this.jsvCssRules)return this.jsvCssRules;this.jsvCssRules=new Array;if(this.jsvTextContent.indexOf(Ht.KeyFramesFlag)<0)return this.jsvCssRules;var e=this.jsvTextContent.split(Ht.KeyFramesFlag);for(let t in e)0!=t&&this.insertRule(Ht.KeyFramesFlag+e[t]);return this.jsvCssRules}insertRule(e,t){if(void 0===t&&(t=this.jsvCssRules.length),e.indexOf(Ht.KeyFramesFlag)<0)throw Error("StyleSheet.insertRule() Rule is not supported except keyframes.");let i=new Ht(e);this.jsvCssRules.splice(t,0,i)}deleteRule(e){this.jsvCssRules.splice(e,1)}}class Kt extends Et{constructor(e){super(e),this.textContent=null}jsvGetTagName(){return Et.TAG.STYLE}appendChild(e){super.appendChild(e);let t=new $t(e.textContent);document.jsvAppendStyleSheet(t)}removeChild(e){throw super.removeChild(e),Error("Failed to removeChild, unimplement!.")}}class Yt extends Et{}class zt extends It{constructor(e){super(e),console.log("VideoElement.constructor()",this),this._EventCache=[],this._UseTexture=!1,this._StartTime=0}jsvGetTagName(){return Et.TAG.VIDEO}setAttribute(e,t){("jsv-media-usetexture"!==e||"true"!==t&&!0!==t&&""!==t)&&("jsv_media_usetexture"!==e||"true"!==t)?super.setAttribute(e,t):this._UseTexture=!0}removeAttribute(e){if("jsv-media-usetexture"===e||"jsv_media_usetexture"===e)return this._UseTexture=!1,void console.log("removeAttribute jsv_media_usetexture");super.removeAttribute(e)}jsvFlushViewLayout(){super.jsvFlushViewLayout();let e=this.style.JsvVideoRotation;isNaN(e)&&(e=0),this.style.objectFit&&this.style.objectFit!=Tt.ObjectFit.CONTAIN&&this.style.objectFit!=Tt.ObjectFit.FILL&&(console.error("Video rotation is not valid on objectFit=",this.style.objectFit),e=0),this.jsvMedia&&this.jsvMedia.setRotation?.(e,this.style.width,this.style.height,this.style.objectFit==Tt.ObjectFit.FILL)}jsvAddMediaListener(e){this.jsvMedia?this.jsvMedia.addEventListener(e,(()=>{let t=new ut(e);t.target=this,this.dispatchEvent(t)})):this._EventCache.push(e)}jsvFlushVideoView(){this.jsvMediaView&&(this.jsvStore.textureWidth=this.jsvMedia.videoWidth,this.jsvStore.textureHeight=this.jsvMedia.videoHeight,this.style.jsvLazySyncCache.setCacheProperty(Tt.TYPE.LAYOUT_SIZE,!0))}jsvApplyObjectFit(e){return Et.applyObjectFitCommon(this,e,this.jsvMediaView)}jsvInit(){console.log("VideoElement jsvInit"),this._UseTexture?this.jsvMedia=new It.HOOKS.OffscreenVideo:this.jsvMedia=new It.HOOKS.Video,this._EventCache.length>0&&(this._EventCache.map((e=>{this.jsvAddMediaListener(e)})),this._EventCache=[]),this.addEventListener("load",this.jsvOnLoaded.bind(this)),super.jsvInit()}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}jsvOnLoaded(){if(!this.jsvMediaView){let e;if(this._UseTexture){this.jsvMediaView=new i.LayoutView;let t,s=ct.TextureManager.GetOffScreenMediaTexture(this.jsvMedia),n=this.style.borderRadius;n&&(t=new i.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight)),e=new i.TextureSetting(s,t)}else{this.jsvMediaView=new i.VideoView(this.jsvMedia);let t=ct.TextureManager.GetColorTexture("rgba(0,0,0,0)");e=new i.TextureSetting(t,null,null,!1)}this.jsvMainView.AddView(this.jsvMediaView),this.jsvMediaView.ResetTexture(e)}this.jsvFlushVideoView()}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",Tt.ObjectFit.CONTAIN),super.jsvOnLoadForgeView()}onJsViewHide(){this._StartTime=this.jsvMedia.currentTime,super.onJsViewHide(),this.jsvMedia.setState("autoPlay",!1,"boolean")}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.jsvMedia.startTime=Math.max(this._StartTime-1,0),this._StartTime=0,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}}zt.PROP={SetOnly:[],GetOnly:["videoHeight","videoWidth"],SetAndGet:["height","poster","width"]};for(let e in zt.PROP){let t=zt.PROP[e];for(let i of t){let t={};"SetOnly"!==e&&"SetAndGet"!==e||(t.set=function(e){this.media[i]=e}),"GetOnly"!==e&&"SetAndGet"!==e||(t.get=function(){return this.media[i]}),zt.prototype[i]=t}}zt.EVENTS=["oncanplay","oncanplaythrough","ondurationchange","onended","onerror","onload","onloadedmetadata","onloadstart","onpause","onplay","onplaying","onprogress","onseeking","onseeked","onstalled","ontimeupdate"];class Xt extends mt{constructor(e){super(mt.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}class Jt extends mt{constructor(e){super(mt.COMMENT_NODE),this.textContent=e}}let qt={};class Zt{constructor(e,t,i){this._Element=i,qt.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),qt[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;if(this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),window.JsView){let e=window.JsView.ForgeExt;t.attachToActivity(e.RootActivity,e.RootView)}else window.addEventListener("keydown",(e=>{var i=document.activeElement.tagName;i&&"input"===i.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var i=document.activeElement.tagName;i&&"input"===i.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())}))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),Mt()}}class Qt extends At{constructor(e){super(e),console.log("AudioElement.constructor()",this)}jsvGetTagName(){return Et.TAG.AUDIOTRACK}jsvInit(){this.jsvMedia=new It.HOOKS.Audio("AudioTrack"),this.jsvOverrideMedia=!0,super.jsvInit()}}class ei extends mt{constructor(){console.log("Document.constructor()"),super(mt.DOCUMENT_NODE),this.location=window.location,this.rootElement=new Ot,this.rootElement.ownerDocument=this,this.rootElement.id="root",this.activeElement=this.rootElement,this.head=new Gt,this.styleSheets=new Array,window.JsView&&this.styleSheets.push(new $t("@keyframes jsv-basic-slot {}")),this.jsvIsReady=!1}createElement(e){switch(e){case ei.FDIV_ELEMENT:return new Vt;case ei.DIV_ELEMENT:return new Ot;case ei.IMG_ELEMENT:case ei.FIMG_ELEMENT:return new Ut;case ei.STYLE_ELEMENT:return new Kt;case ei.AUDIO_ELEMENT:return new At;case ei.AUDIOTRACK_ELEMENT:return new Qt;case ei.VIDEO_ELEMENT:return new zt;case ei.LINK_ELEMENT:return window.JsView?new jt:window.originDocument.createElement(ei.LINK_ELEMENT);case ei.SCRIPT_ELEMENT:return window.JsView?new Nt:window.originDocument.createElement(ei.SCRIPT_ELEMENT);case ei.ANCHOR_ELEMENT:return new xt;case ei.SVG_ELEMENT:return new SVGElement;default:return window.JsView?(console.warn("Document.createElement() unknown name="+e),new Yt(e)):new Wt(e.startsWith("jsv")?e:"jsve-"+e)}}createTextNode(e){return new Xt(e)}createEvent(e){return new ut(e)}createComment(e){return new Jt(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw Error("Document.getElementById() id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if("head"===e.toLowerCase())return window.JsView?[this.head]:window.originDocument.getElementsByTagName(e);if("link"===e.toLowerCase()||"script"===e.toLowerCase()||"style"===e.toLowerCase())return[];throw Error("Document.getElementsByTagName() name="+e+" is UNIMPLEMENTED.")}querySelector(e){if("root"===e||"#app"===e)return this.rootElement;if("head"===e)return this.head;if("base"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;throw Error("Document.querySelector() selectors="+e+" is UNIMPLEMENTED.")}jsvAppendStyleSheet(e){document.styleSheets.push(e)}jsvGetKeyFrames(e,t){if(window.JsvCode.Dom.StyleSheets){const i=window.JsvCode.Dom.StyleSheets;for(const s of t){const t=i[`${e}-${s.replace("data-v-","")}`];if(t)return t}const s=i[e];if(s)return s}for(let t of this.styleSheets)for(let i of t.cssRules)if(i.name==e)return i.cssText;let i="@keyframes ",s=i+e;for(let e of this.styleSheets){let t=e.jsvTextContent,n=t.indexOf(s);if(n<0)continue;let r=t.indexOf("-keyframes",n+1),a=t.indexOf(i,n+1);a<0&&(a=t.length),r>0&&r<a&&(a=r);let o=t.substring(n,a);return e.insertRule(o,0),o}return null}jsvUpdateRootElement(e){console.log("Document.jsvUpdateRootElement() this.jsvIsReady = true"),this.rootElement.jsvMainView=e,this.jsvIsReady=!0}jsvInitFDivRoot(e,t,i){if(!i){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,i=this.rootElement}return new Zt(e,t,i)}jsvGetFDivRoot(e){return function(e){return qt[e]}(e)}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}ei.ANCHOR_ELEMENT="a",ei.AUDIO_ELEMENT="audio",ei.DIV_ELEMENT="div",ei.IMG_ELEMENT="img",ei.LINK_ELEMENT="link",ei.SCRIPT_ELEMENT="script",ei.STYLE_ELEMENT="style",ei.SVG_ELEMENT="svg",ei.VIDEO_ELEMENT="video",ei.FIMG_ELEMENT="fimg",ei.FDIV_ELEMENT="fdiv",ei.AUDIOTRACK_ELEMENT="audiotrack";class ti extends Et{jsvGetTagName(){return Et.TAG.LINK}}if(window.JsvCode={Dom:{StyleSheets:{}}},window.Audio=At,window.Video=zt,window.MutationObserver=class{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof mt))throw Error("TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type JsView's 'Node'");for(const e of Object.keys(t))"childList"==e||console.warn("JsView: only childList config is supported! ignore "+e);t.childList&&e.jsvObserveChildChanged((()=>{this.callback?.()}))}disconnect(){this.callback=void 0}},window.JsView){console.log("Declare Dom Proxy."),global.SVGElement=ti,global.Element=Et;let e=new ht(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.addEventListener=function(e,t){},window.document=new ei,window.history={},window.navigator={userAgent:"jsview-runtime"},window.HTMLIFrameElement=function(){}}gt.I("Using JsView Runtime");class ii{static _isUndefined(e,t){let i=void 0===t;return i&&console.error(e+" property is undefined!"),i}static _isUndefinedOrNumber(e,t){return!!ii._isUndefined(e,t)||"number"==typeof t}static _keyframesCheck(e,t){ii._isUndefined(e,t)||t.indexOf("transform")<0&&t.indexOf("opacity")<0&&console.error("keyframes property is only support transform and opacity, value:",t)}static _objectFit(e,t){if(ii._isUndefined(e,t))return;const i="fill contain cover none scale-down";i.indexOf(t)<0&&console.error(" objectFit is only support one of string["+i+"]")}static _clipPathCheck(e,t){ii._isUndefined(e,t)||t.startsWith("inset")||console.error("clipPath property is support inset only.")}static _transitionOtherCheck(e,t){ii._isUndefined(e,t)||console.error(e+" property is not support, you can use transition property, e.g. transition='width 2s'")}static _transitionCheck(e,t){ii._isUndefined(e,t)}static _transformCheck(e,t){ii._isUndefined(e,t)||t.length>0&&t.indexOf("translate3d")<0&&t.indexOf("scale3d")<0&&t.indexOf("rotate3d")<0&&t.indexOf("skew")<0&&console.error("transform property's value only support translate3d、scale3d、rotate3d、skew, value:",t)}static _transformOriginCheck(e,t){ii._isUndefined(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("transformOrigin property's value only support XX%、left、top、right, bottom:",t)}static _textOverflowCheck(e,t){if(!ii._isUndefined(e,t))switch(t){case"clip":case"ellipsis":break;default:console.error("textOverflow property's value is not support, value:",t)}}static _whiteSpaceCheck(e,t){if(!ii._isUndefined(e,t))switch(t){case"normal":case"nowrap":case"pre-wrap":break;default:console.error("whiteSpace property's value is not support, value:",t)}}static _textAlignCheck(e,t){if(!ii._isUndefined(e,t))switch(t){case"left":case"right":case"center":break;default:console.error("textAlign property's value is not support, value:",t)}}static _lineHeightCheck(e,t){if(!ii._isUndefinedOrNumber(e,t))switch(t){case"normal":case"inherit":console.error("lineHeight property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("lineHeight property's value is support number only, value:",t)}}static _colorCheck(e,t){ii._isUndefined(e,t)||ii._checkColorFormat("Color()",t)}static _visibilityCheck(e,t){ii._isUndefined(e,t)||"visible"!==t&&"hidden"!==t&&"inherit"!==t&&console.error("visibility property's value is not support, value:",t)}static _displayCheck(e,t){ii._isUndefined(e,t)||"block"!==t&&"inline"!==t&&"none"!==t&&"inline-block"!==t&&"inherit"!==t&&""!==t&&console.error("display property's value is not support, value:",t)}static _overflowCheck(e,t){ii._isUndefined(e,t)||"visible"!==t&&"hidden"!==t&&console.error("overflow property's value is support visible or hidden only, value:",t)}static _topCheck(e,t){if(!ii._isUndefinedOrNumber(e,t))switch(t){case"auto":case"inherit":console.error("top property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("top property's value is support number only, value:",t)}}static _leftCheck(e,t){if(!ii._isUndefinedOrNumber(e,t))switch(t){case"auto":case"inherit":console.error("left property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("left property's value is support number only, value:",t)}}static _heightCheck(e,t){if(!ii._isUndefinedOrNumber(e,t))switch(t){case"auto":case"inherit":console.error("height property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("height property's value is support number only, value:",t)}}static _widthCheck(e,t){if(!ii._isUndefinedOrNumber(e,t))switch(t){case"auto":case"inherit":console.error("width property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("width property's value is support number only, value:",t)}}static _backfaceVisibility(e,t){if(!ii._isUndefined(e,t))switch(t){case"visible":case"hidden":break;default:console.error("backfaceVisibility property's value is support visible/hidden only, value: ",t)}}static _perspectiveCheck(e,t){ii._isUndefined(e,t)}static _WebkitTextStroke(e,t){if(ii._isUndefined(e,t))return;t.split(" ").length<2&&console.error("Error: WebkitTextStroke should format of(width color) such as: '1px rgba(255,255,255,1.0)'")}static _zIndexCheck(e,t){ii._isUndefined(e,t)||isNaN(t)&&console.error("zIndex property's value is support number only, value: ",t)}static _fontSizeCheck(e,t){if(!ii._isUndefined(e,t)&&"number"!=typeof t)switch(t){case"smaller":case"larger":case"inherit":case"x-small":case"xx-small":case"small":case"large":case"medium":case"x-large":case"xx-large":console.error("fontSize property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("fontSize property's value is support number only, value:",t)}}static _fontWeightCheck(e,t){ii._isUndefined(e,t)||"bold"!==t&&console.error("fontWeight property's value is support bold only, value:",t)}static _fontStyleCheck(e,t){ii._isUndefined(e,t)||"italic"!==t&&console.error("fontWeight property's value is support italic only, value:",t)}static _borderRadiusCheck(e,t){if(ii._isUndefined(e,t))return;t.split(" ").length>4&&console.error("borderRadius property's value is not support, value:",t)}static _borderImageWidthCheck(e,t){ii._isUndefinedOrNumber(e,t)}static _borderImageOutsetCheck(e,t){if(ii._isUndefined(e,t))return;t.split(" ").length>4&&console.error("borderImageOutsetCheck property's value is not support, value:",t)}static _borderImageCheck(e,t){ii._isUndefined(e,t)||t.indexOf("fill")<0&&console.error("borderImage property's value is not contain fill, e.g. source slice, but value:",t)}static _backgroundOtherCheck(e,t){console.error(e+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`")}static _backgroundImageCheck(e,t){ii._isUndefined(e,t)||"inherit"==t&&console.error("backgroundImage property's value is not support, value:",t)}static _backgroundColorCheck(e,t){if(!ii._isUndefined(e,t))return ii._checkColorFormat("backgroundColor",t)}static _animationCheck(e,t){}static _animationOtherNotSupport(e,t){console.error(e+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'")}static _transformStyleCheck(e,t){if(!ii._isUndefined(e,t))switch(t){case"flat":case"preserve-3d":break;default:console.error("transformStyle property value is not valid",t)}}static _perspectiveOriginCheck(e,t){ii._isUndefined(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("perspectiveOrigin property's value only support XX%、left、top、right, bottom:",t)}static _textShadowCheck(e,t){if(!ii._isUndefined(e,t)&&t.length>0){if(t.replace(/\(.*\)/g,"").split(",").length>1)return void console.error("textShadow: NOT support more than one part settings");const e=t.split(" ");if(4!==e.length&&(5!==e.length||0!==e[4].length)||isNaN(parseInt(e[0]))||isNaN(parseInt(e[1])))console.error('textShadow: format should be "offsetX offsetY blurSize color"(0 0 1 rgba(100,100,100,1)), !NOT space in rgba()');else{if(!(parseFloat(e[2])>0))return void console.error(`textShadow: blur shadow above 0(now=${t})`);if(!ii._checkColorFormat("textShadow",e[3]))return}}}static _checkColorFormat(e,t){if(0===t.indexOf("rgba(")||0===t.indexOf("rgb("));else{if(0!==t.indexOf("#"))return console.error(`${e} color value is not valid, need startwith rgba or #, value:[${t}]`),!1;if(7!==t.length)return console.error(`${e} color value's length is not valid, value:${t}`),!1}return!0}static _JsvVideoRotationCheck(e,t){return!isNaN(parseInt(t))||(console.error(`${e} value is not valid, value:${t}`),!1)}static get(e){return ii.ValidStyleMap[e]}}ii.ValidStyleMap={animation:{check:ii._animationCheck},animationName:{check:ii._animationOtherNotSupport},animationDuration:{check:ii._animationOtherNotSupport},animationTimingFunction:{check:ii._animationOtherNotSupport},animationDelay:{check:ii._animationOtherNotSupport},animationIterationCount:{check:ii._animationOtherNotSupport},animationDirection:{check:ii._animationOtherNotSupport},animationPlayState:{check:ii._animationOtherNotSupport},animationFillMode:{check:ii._animationOtherNotSupport},background:{check:ii._backgroundOtherCheck},backgroundColor:{check:ii._backgroundColorCheck},backgroundImage:{check:ii._backgroundImageCheck},borderImage:{check:ii._borderImageCheck},borderImageOutset:{check:ii._borderImageOutsetCheck},borderImageWidth:{check:ii._borderImageWidthCheck},borderRadius:{check:ii._borderRadiusCheck},height:{check:ii._heightCheck},width:{check:ii._widthCheck},zIndex:{check:ii._zIndexCheck},fontFamily:{check:null},fontSize:{check:ii._fontSizeCheck},fontStyle:{check:ii._fontStyleCheck},fontWeight:{check:ii._fontWeightCheck},left:{check:ii._leftCheck},overflow:{check:ii._overflowCheck},top:{check:ii._topCheck},visibility:{check:ii._visibilityCheck},display:{check:ii._displayCheck},color:{check:ii._colorCheck},lineHeight:{check:ii._lineHeightCheck},textAlign:{check:ii._textAlignCheck},whiteSpace:{check:ii._whiteSpaceCheck},textOverflow:{check:ii._textOverflowCheck},transform:{check:ii._transformCheck},transformOrigin:{check:ii._transformOriginCheck},transition:{check:ii._transitionCheck},transitionProperty:{check:ii._transitionOtherCheck},transitionDuration:{check:ii._transitionOtherCheck},transitionTimingFunction:{check:ii._transitionOtherCheck},transitionDelay:{check:ii._transitionOtherCheck},clipPath:{check:ii._clipPathCheck},keyframes:{check:ii._keyframesCheck},objectFit:{check:ii._objectFit},perspective:{check:ii._perspectiveCheck},backfaceVisibility:{check:ii._backfaceVisibility},transformStyle:{check:ii._transformStyleCheck},perspectiveOrigin:{check:ii._perspectiveCheck},WebkitTextStroke:{check:ii._WebkitTextStroke},textShadow:{check:ii._textShadowCheck},JsvVideoRotation:{check:ii._JsvVideoRotationCheck}},console.log("Hook Document ...");const si=new ei;window.myHook=si,window.document.head.appendChild=si.head.appendChild.bind(si.head),window.document.head.removeChild=si.head.removeChild.bind(si.head),window.document.createElement=si.createElement.bind(si),window.document.createTextNode=si.createTextNode.bind(si),window.document.createComment=si.createComment.bind(si),window.document.getElementById=si.getElementById.bind(si),window.document.getElementsByTagName=si.getElementsByTagName.bind(si),window.document.querySelector=si.querySelector.bind(si),window.document.createEvent=si.createEvent.bind(si),window.document.dispatchEvent=si.dispatchEvent.bind(si),window.document.jsvInitFDivRoot=si.jsvInitFDivRoot.bind(si),window.document.jsvGetFDivRoot=si.jsvGetFDivRoot.bind(si),window.document.jsvAppendStyleSheet=function(e){let t=window.originDocument.createElement("style");t.type="text/css",t.innerHTML=e.jsvTextContent,this.getElementsByTagName("Head")[0].appendChild(t)},window.document.jsvGetKeyFrames=function(e,t){let i="";var s=document.styleSheets;for(let t=0;t<s.length;++t){const n=s[t];if(n.cssRules)for(let t=0;t<n.cssRules.length;++t){let s=n.cssRules[t];if(s&&s.name===e){i=s.cssText;break}}}if(!i){const s=window.JsvCode.Dom.StyleSheets;for(const n of t){if(i=s[`${e}-${n.replace("data-v-","")}`],i){document.jsvAppendStyleSheet({jsvTextContent:i});break}}i||(i=s[e],i&&document.jsvAppendStyleSheet({jsvTextContent:i}))}return i&&document.jsvCheckStyleFormat&&document.jsvCheckStyleFormat("keyframes",i),i};let ni=window.navigator.userAgent.toLowerCase();window.jsvInAndroidWebView=ni.indexOf("android")>=0,window.jsvInAndroidWebView?window.document.jsvCheckStyleFormat=null:window.document.jsvCheckStyleFormat=function(e,t){if(e.startsWith("--"))return;let i=ii.get(e);i?i.check&&t&&i.check(e,t):console.error(e+" property is not support.")},ct.TextureManager=new i.TextureManager,ct.RootView=new i.RootView,si.jsvUpdateRootElement(ct.RootView),i.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{ft.SyncAllCachedProperty(),ct.ClearUnusedTexSize()})),window.jsvIsBrowserDebug=!0,console.log("Using JsView HTML hook");
|