@shijiu/jsview 2.1.482-test.0 → 2.2.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- /* eslint-disable */ class e{static CreateAudioPlayer(e){return new Audio(e)}static CreateVideoPlayer(){const t=new Video;return t.jsvOnCssStyleChanged=e.OnCssStyleChanged.bind(t),t.jsvFinalize=e.JsvFinalize.bind(t),t}static OnCssStyleChanged(e,t){this.jsvSetStyles(t.left,t.top,t.width,t.height,t.objectFit,t.visibility)}static JsvFinalize(){console.log("NativePlatformMediaBridge.JsvFinalize()");const e=this;e.pause(),e.unload?.(),e.releaseResource&&(e.releaseResource(),e.onPlatformDestroy())}}window.JsvCode.NativePlatformMediaBridge||(window.JsvCode.NativePlatformMediaBridge=e);class t{constructor(e,t){this.prevented=!1,this.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.prevented=!0}jsvIsPrevented(){return this.prevented}}class s extends t{constructor(e){super(e)}}class i extends t{constructor(e,t){super(e),this.options=t}initCustomEvent(e,t,s,i){this.type=e}get detail(){return this.options?.detail}}class n extends t{constructor(e){super(e)}}n.JsvType={Focus:"focus",Blur:"blur"},void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var o,r,a,l,h,c,d,u,v,m,f,p,g,w,y,T=window.Forge;class N{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,s=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,s).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:")||!0===e.startsWith("jsvtexturestore:"))return void(this.href=e);let s=e.indexOf("://");if(!(s<0||s>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if(!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)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let i=this.href,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let o=i.indexOf("?");o>1&&(this.search=i.substring(o),i=i.substring(0,o));let r=i,a=r.indexOf("://");this.protocol=a>0?r.substring(0,a+1):"";let l=a>1?r.substring(a+3):"";a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>=1?l.substring(a):"","file:"==this.protocol&&(this.host="",this.pathname=l),this.origin=this.protocol+"//"+this.host,a=this.host.indexOf(":"),this.hostname=a>0?this.host.substring(0,a):this.host,this.port=a>1?this.host.substring(a+1):""}replace(e){this.href=e}}class D{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){D.PushLazyTask(D.LazyTaskType.CreateElement,e,t)}static BindElementToRootView(e){D.PushLazyTask(D.LazyTaskType.BindElementToRootView,e)}static InsertElementChild(e,t,s){D.PushLazyTask(D.LazyTaskType.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){D.PushLazyTask(D.LazyTaskType.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){D.PushLazyTask(D.LazyTaskType.MoveElementChild,e,t,s,i)}static ReOrderElementChild(e,t,s){D.PushLazyTask(D.LazyTaskType.ReOrderElementChild,e,t,s)}static AddElementEventListener(e,t,s){D.PushLazyTask(D.LazyTaskType.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){D.PushLazyTask(D.LazyTaskType.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){D.PushLazyTask(D.LazyTaskType.SetElementText,e,t)}static SetElementAttribute(e,t,s){D.PushLazyTask(D.LazyTaskType.SetElementAttribute,e,t,s),D.LazyTaskSyncedListenerMap.has(e)&&D.CachedSyncListenIdSet.add(e)}static GetElementBoundingClientStyles(e,t){return D.RunSyncTask(D.LazyTaskType.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),D.PushLazyTask(D.LazyTaskType.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){D.PushLazyTask(D.LazyTaskType.DeclareStyleSheets,-1,e)}static UndeclareStyleSheets(e){D.PushLazyTask(D.LazyTaskType.UndeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){D.PushLazyTask(D.LazyTaskType.SetStyleProperty,e,t,s),D.LazyTaskSyncedListenerMap.has(e)&&D.CachedSyncListenIdSet.add(e)}static GetStyleProperties(e,t){return D.RunSyncTask(D.LazyTaskType.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){D.LazyTaskSyncedListenerMap.set(e,t)}static RemoveLazyTaskSyncedListener(e){D.LazyTaskSyncedListenerMap.delete(e)}static RequestSwapAllCachedTasks(){if(0==D.CachedLazyTaskList.length)return;const e=JSON.stringify(D.CachedLazyTaskList);D.CachedLazyTaskList=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of D.CachedSyncListenIdSet){const t=D.LazyTaskSyncedListenerMap.get(e);t?.()}D.CachedSyncListenIdSet.clear()}static GetElementAttribute(e,t){return D.RunSyncTask(D.LazyTaskType.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){D.PushLazyTask(D.LazyTaskType.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){D.PushLazyTask(D.LazyTaskType.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=D.RunSyncTask(D.LazyTaskType.GetRelativePosition,e,t);return JSON.parse(s)}static RunSyncTask(e,t,...s){D.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static PushLazyTask(e,t,...s){D.CachedLazyTaskList.push([e,t,...s]),T.sRenderBridge?.RequestSwap()}}D.CachedLazyTaskList=new Array,D.CachedSyncListenIdSet=new Set,D.LazyTaskSyncedListenerMap=new Map,D.LazyTaskType={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,ReOrderElementChild:22,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,UndeclareStyleSheets:39,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42};class E{}E.Dom=D,E.Media=class{static CreateAudioPlayer(){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer()}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}};class S{static GenerateId(){const e=this.UniqueId++;if(e>=this.MaxUniqueId)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}}S.UniqueId=0,S.MaxUniqueId=Math.pow(2,31)-1;class x{constructor(e){this.childNodes=[],this.nodeType=e,this.ownerDocument=window.document,this.parentNode=null,this.jsvEventListenerMap=null,this.jsvChildChangedCallback=null}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.jsvChildChangedCallback?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=null,this.jsvChildChangedCallback?.()}insertBefore(e,t){this.insertBeforeInner(e,t)}get previousSibling(){const e=this.parentNode?.childNodes;let t=e?.indexOf(this);if(void 0===t||t<0)throw new DOMException("Failed to call Node.previousSibling(), this node not found. this=",this);return e[t-1]}get nextSibling(){const e=this.parentNode?.childNodes;let t=e?.indexOf(this);if(void 0===t||t<0)throw new DOMException("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.jsvEventListenerMap||(this.jsvEventListenerMap=new Map);let i=this.jsvEventListenerMap?.get(e);i||(i=new Set,this.jsvEventListenerMap?.set(e,i)),i.add(t)}removeEventListener(e,t,s){let i=this.jsvEventListenerMap?.get(e);i&&(i.delete(t),i.size<=0&&this.jsvEventListenerMap?.delete(e),0==this.jsvEventListenerMap?.size&&(this.jsvEventListenerMap=null))}dispatchEvent(e){if(!this.jsvEventListenerMap)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.jsvEventListenerMap?.get(e.type);if(t){e.target||(e.target=document.activeElement);for(let s of t)if(s?.(e),e.jsvIsPrevented())break}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.jsvChildChangedCallback=e}jsvMoveChildReOrder(e,t){{let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to call jsvMoveChildReOrder, node not found. node=",e);this.childNodes.splice(t,1)}{let s=this.childNodes.length;if(t&&(s=this.childNodes.indexOf(t),s<0))throw new DOMException("Failed to call move node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e)}this.jsvChildChangedCallback?.()}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);if(i<0)throw new DOMException("Failed to call jsvMoveChildToNewParent, node not found. node=",e);this.childNodes.splice(i,1),e.parentNode=null,this.jsvChildChangedCallback?.(),t.insertBeforeInner(e,s)}jsvGetEventListenerSet(e){const t=this.jsvEventListenerMap?.get(e);return t}insertBeforeInner(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMException("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.");if(null!==t&&(s=this.childNodes.indexOf(t)),s<0)throw new DOMException("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.jsvChildChangedCallback?.()}}function C(e,t,s){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:s?"".concat(s," ",t):t})}x.ELEMENT_NODE=1,x.TEXT_NODE=3,x.COMMENT_NODE=8,x.DOCUMENT_NODE=9,x.NOLAYOUT_NODE=10;class I{static HasGetterMethod(e){switch(e){case I.Layout.Height:case I.Layout.Left:case I.Layout.Top:case I.Layout.Width:case I.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==I.Layout.Height?I.Layout.Height:e==I.Layout.Left?I.Layout.Left:e==I.Layout.Top?I.Layout.Top:e==I.Layout.Width?I.Layout.Width:e==I.Flex.FlexDirection?I.Flex.FlexDirection:e==I.Flex.FlexWrap?I.Flex.FlexWrap:e==I.Flex.JustifyContent?I.Flex.JustifyContent:e==I.Flex.AlignItems?I.Flex.AlignItems:e==I.Flex.AlignContent?I.Flex.AlignContent:e==I.Flex.AlignSelf?I.Flex.AlignSelf:e==I.Flex.FlexGrow?I.Flex.FlexGrow:e==I.Background.BackgroundColor?I.Background.BackgroundColor:e==I.Background.BackgroundImage?I.Background.BackgroundImage:e==I.Background.BorderRadius?I.Background.BorderRadius:e==I.Effect.BackfaceVisibility?I.Effect.BackfaceVisibility:e==I.Effect.BorderImage?I.Effect.BorderImage:e==I.Effect.BorderImageWidth?I.Effect.BorderImageWidth:e==I.Effect.BorderImageOutset?I.Effect.BorderImageOutset:e==I.Effect.Display?I.Effect.Display:e==I.Effect.ObjectFit?I.Effect.ObjectFit:e==I.Effect.Opacity?I.Effect.Opacity:e==I.Effect.Overflow?I.Effect.Overflow:e==I.Effect.Perspective?I.Effect.Perspective:e==I.Effect.PerspectiveOrigin?I.Effect.PerspectiveOrigin:e==I.Effect.Transform?I.Effect.Transform:e==I.Effect.TransformOrigin?I.Effect.TransformOrigin:e==I.Effect.TransformStyle?I.Effect.TransformStyle:e==I.Effect.Visibility?I.Effect.Visibility:e==I.Effect.ZIndex?I.Effect.ZIndex:e==I.Text.Color?I.Text.Color:e==I.Text.FontFamily?I.Text.FontFamily:e==I.Text.FontSize?I.Text.FontSize:e==I.Text.FontStyle?I.Text.FontStyle:e==I.Text.FontWeight?I.Text.FontWeight:e==I.Text.LineHeight?I.Text.LineHeight:e==I.Text.TextAlign?I.Text.TextAlign:e==I.Text.TextOverflow?I.Text.TextOverflow:e==I.Text.TextShadow?I.Text.TextShadow:e==I.Text.WebkitTextStroke?I.Text.WebkitTextStroke:e==I.Text.WhiteSpace?I.Text.WhiteSpace:e==I.Text.WordWrap?I.Text.WordWrap:e==I.Text.Direction?I.Text.Direction:e==I.Text.JsvTextEmoji?I.Text.JsvTextEmoji:e==I.Text.JsvTextLatex?I.Text.JsvTextLatex:e==I.Text.JsvTextAlignMinWidth?I.Text.JsvTextAlignMinWidth:e==I.Text.JsvTextVerticalAlign?I.Text.JsvTextVerticalAlign:e==I.Text.JsvTextLineAlign?I.Text.JsvTextLineAlign:e==I.Text.JsvTextInnerDirection?I.Text.JsvTextInnerDirection:e==I.Motion.Animation?I.Motion.Animation:e==I.Motion.Transition?I.Motion.Transition:e==I.Motion.AnimationFillMode?I.Motion.AnimationFillMode:null}constructor(){throw new Error("new StyleName() is forbidden.")}}I.Layout=(C(o=class{constructor(){throw new Error("new StyleName.Layout() is forbidden.")}},"Layout"),o.Height="height",o.Left="left",o.Top="top",o.Width="width",o),I.Flex=(C(r=class{constructor(){throw new Error("new StyleName.Flex() is forbidden.")}},"Flex"),r.FlexDirection="flexDirection",r.FlexWrap="flexWrap",r.JustifyContent="justifyContent",r.AlignItems="alignItems",r.AlignContent="alignContent",r.AlignSelf="alignSelf",r.FlexGrow="flexGrow",r),I.Background=(C(a=class{constructor(){throw new Error("new StyleName.Background() is forbidden.")}},"Background"),a.BackgroundColor="backgroundColor",a.BackgroundImage="backgroundImage",a.BorderRadius="borderRadius",a),I.Effect=(C(l=class{constructor(){throw new Error("new StyleName.Effect() is forbidden.")}},"Effect"),l.BackfaceVisibility="backfaceVisibility",l.BorderImage="borderImage",l.BorderImageWidth="borderImageWidth",l.BorderImageOutset="borderImageOutset",l.Display="display",l.ObjectFit="objectFit",l.Opacity="opacity",l.Overflow="overflow",l.Perspective="perspective",l.PerspectiveOrigin="perspectiveOrigin",l.Transform="transform",l.TransformOrigin="transformOrigin",l.TransformStyle="transformStyle",l.Visibility="visibility",l.ZIndex="zIndex",l),I.Text=(C(h=class{constructor(){throw new Error("new StyleName.Text() is forbidden.")}},"Text"),h.Color="color",h.FontFamily="fontFamily",h.FontSize="fontSize",h.FontStyle="fontStyle",h.FontWeight="fontWeight",h.LineHeight="lineHeight",h.TextAlign="textAlign",h.TextOverflow="textOverflow",h.TextShadow="textShadow",h.WebkitTextStroke="WebkitTextStroke",h.WhiteSpace="whiteSpace",h.WordWrap="wordWrap",h.Direction="direction",h.JsvTextEmoji="JsvTextEmoji",h.JsvTextLatex="JsvTextLatex",h.JsvTextAlignMinWidth="JsvTextAlignMinWidth",h.JsvTextVerticalAlign="JsvTextVerticalAlign",h.JsvTextLineAlign="JsvTextLineAlign",h.JsvTextInnerDirection="JsvTextInnerDirection",h),I.Motion=(C(c=class{constructor(){throw new Error("new StyleName.Motion() is forbidden.")}},"Motion"),c.Animation="animation",c.Transition="transition",c.AnimationFillMode="animationFillMode",c);class F{constructor(e){let t=-1,s=null;null==e?t=F.DataType.Null:Number(e)===e&&e%1==0?t=F.DataType.Int32:Number(e)===e&&e%1!=0?t=F.DataType.Float:"string"==typeof e||e instanceof String?t=F.DataType.String:e instanceof F.AnimationImpl?t=F.DataType.Animation:e instanceof F.CornerImpl?t=F.DataType.Corner:e instanceof F.RectImpl?t=F.DataType.Rect:e instanceof F.TextShadowImpl?t=F.DataType.TextShadow:e instanceof F.WebkitTextStrokeImpl?t=F.DataType.WebkitTextStroke:e instanceof F.TransitionImpl?t=F.DataType.Transition:e instanceof F.BorderImageImpl&&(t=F.DataType.BorderImage),e!=F.InvalidInt32&&e!=F.InvalidFloat&&e!=F.InvalidPointer?s=e:(t=F.DataType.Null,s=null),this.data=new F.DataInfo,this.data.index=t,this.data.value=s}toString(){let e=null;switch(this.data.index){case F.DataType.Null:return"";case F.DataType.Int32:case F.DataType.Float:return String(this.get());case F.DataType.String:e=this.get();break;case F.DataType.Animation:case F.DataType.Corner:case F.DataType.Rect:case F.DataType.TextShadow:case F.DataType.WebkitTextStroke:case F.DataType.Transition:case F.DataType.BorderImage:case F.DataType.BackgroundImage:e=this.get().rawValue;break;default:console.error("Failed to do StyleValue.toString()")}return e??""}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}}F.Base=class{constructor(e){this.rawValue=e}},F.AnimationImpl=class extends F.Base{constructor(e){super(e),this.name="",this.duration=0,this.timingFunction=null,this.delay=0,this.iterationCount=0,this.direction=!1}},F.CornerImpl=class extends F.Base{constructor(e){super(e),this.topLeft=0,this.topRight=0,this.bottomRight=0,this.bottomLeft=0}},F.RectImpl=class extends F.Base{constructor(e){super(e),this.top=0,this.right=0,this.left=0,this.bottom=0}},F.TextShadowImpl=class extends F.Base{constructor(e){super(e),this.hShadow=0,this.vShadow=0,this.blur=0,this.color=void 0}},F.WebkitTextStrokeImpl=class extends F.Base{constructor(e){super(e),this.length=0,this.color=void 0}},F.TransitionImpl=class extends F.Base{constructor(e){super(e),this.animationMap=new Map}},F.BorderImageImpl=class extends F.Base{constructor(e){super(e),this.source="",this.slice=null}},F.BackgroundImageImpl=(C(d=class extends F.Base{constructor(e){super(e),this.type=0,this.urlPath=""}},"BackgroundImageImpl"),d.eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2},d.LinearGradient=class{constructor(){this.fromX=0,this.fromY=0,this.toX=0,this.toY=0,this.stops=[]}},d),F.DataType=(C(u=class{},"DataType"),u.Null=0,u.Int32=1,u.Float=2,u.String=3,u.Animation=4,u.Corner=5,u.Rect=6,u.TextShadow=7,u.WebkitTextStroke=8,u.Transition=9,u.BorderImage=10,u.BackgroundImage=11,u),F.InvalidInt32=Number.MIN_VALUE,F.InvalidFloat=Number.NaN,F.InvalidPointer=null,F.DataInfo=class{constructor(){this.value=null,this.index=-1}},C(v=class{},"Text"),v.Color="#000000",v.FontFamily="黑体",v.FontSize=10,v.FontStyle="normal",v.FontWeight="normal",v.LineHeight=0,v.TextAlign="start",v.TextOverflow="clip",v.TextShadow=null,v.WebkitTextStroke=null,v.WhiteSpace="normal",v.WordWrap="normal",v.Direction="ltr",v.JsvTextEmoji=0,v.JsvTextLatex=0,v.JsvTextAlignMinWidth=0,v.JsvTextVerticalAlign="top",v.JsvTextLineAlign="middle",v.JsvTextInnerDirection="unset",C(m=class{constructor(){this.height=F.InvalidInt32,this.left=F.InvalidInt32,this.top=F.InvalidInt32,this.width=F.InvalidInt32}},"Layout"),m.Name="layout",C(f=class{constructor(){this.flexDirection=F.InvalidInt32,this.flexWrap=F.InvalidInt32,this.justifyContent=F.InvalidInt32,this.alignItems=F.InvalidInt32,this.alignContent=F.InvalidInt32,this.alignSelf=F.InvalidInt32,this.flexGrow=F.InvalidFloat}},"Flex"),f.Name="flex",C(p=class{constructor(){this.backgroundColor=F.InvalidPointer,this.backgroundImage=F.InvalidPointer,this.borderRadius=F.InvalidPointer}},"Background"),p.Name="background",C(g=class{constructor(){this.backfaceVisibility=F.InvalidPointer,this.borderImage=F.InvalidPointer,this.borderImageWidth=F.InvalidPointer,this.borderImageOutset=F.InvalidPointer,this.display=F.InvalidPointer,this.objectFit=F.InvalidPointer,this.opacity=F.InvalidFloat,this.overflow=F.InvalidPointer,this.perspective=F.InvalidInt32,this.perspectiveOrigin=F.InvalidPointer,this.transform=F.InvalidPointer,this.transformOrigin=F.InvalidPointer,this.transformStyle=F.InvalidPointer,this.visibility=F.InvalidPointer,this.zIndex=F.InvalidInt32}},"Effect"),g.Name="effect",C(w=class{constructor(){this.color=F.InvalidPointer,this.fontFamily=F.InvalidPointer,this.fontSize=F.InvalidInt32,this.fontStyle=F.InvalidPointer,this.fontWeight=F.InvalidPointer,this.lineHeight=F.InvalidInt32,this.textAlign=F.InvalidPointer,this.textOverflow=F.InvalidPointer,this.textShadow=F.InvalidPointer,this.webkitTextStroke=F.InvalidPointer,this.whiteSpace=F.InvalidPointer,this.wordWrap=F.InvalidPointer,this.direction=F.InvalidPointer,this.jsvTextEmoji=F.InvalidInt32,this.jsvTextLatex=F.InvalidInt32,this.jsvTextAlignMinWidth=F.InvalidInt32,this.jsvTextVerticalAlign=F.InvalidPointer,this.jsvTextLineAlign=F.InvalidPointer,this.jsvTextInnerDirection=F.InvalidPointer}},"Text"),w.Name="text",C(y=class{constructor(){this.animation=F.InvalidPointer,this.transition=F.InvalidPointer,this.animationFillMode="none"}},"Motion"),y.Name="motion";class b{static JsvDeclarePrototype(){for(let e in I){let t=I[e];for(let e in t){let s=t[e];if("string"!=typeof s)continue;const i={set:function(e){this.setProperty(s,e)},get:function(){return this.getPropertyValue(s)}};Object.defineProperty(b.prototype,s,i)}}}constructor(e){this.cachedProps={},this.nativeId=e}setProperty(e,t){if(window.JsvCode.Dom.CheckStyleFormat?.(e,t),e==I.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient")){const e=t.match(/\(/g)?.length,s=t.match(/\)/g)?.length;e!=s&&(console.error(`StyleError: illegal linear-gradient value '${t}'`),t="")}else{t=new N(t).href}else if(e==I.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new N(e[0]).href),t=e.join(" ")}else e==I.Effect.Display&&(this.cachedProps[e]=t);E.Dom.SetStyleProperty(this.nativeId,e,t)}getPropertyValue(e){if(e==I.Effect.Display)return this.cachedProps[e];throw console.error("StyleDeclaration.getPropertyValue() propName="+e),new Error("Get style value is unimplemented because it's low performance.")}jsvGetProperties(...e){const t=JSON.stringify(e),s=E.Dom.GetStyleProperties(this.nativeId,t);return JSON.parse(s)}}class P extends t{constructor(e){super(e)}}class k extends x{static JsvEnableEventListener(){E.Dom.EnableEventListener((function(e,t,...s){let i=k.JsvEventListenerMap.get(e);const n=i?.get(t);n?.(t,...s)}))}constructor(e){super(x.ELEMENT_NODE),this.jsvNativeId=-1,this.jsvAttrStore={},this.jsvClientSizeStore={},this.tagName=e,this.tagName!=k.JsvTagName.Audio&&this.tagName!=k.JsvTagName.Div&&this.tagName!=k.JsvTagName.Image&&this.tagName!=k.JsvTagName.Video&&this.tagName!=k.JsvTagName.JsvFDiv||(this.jsvNativeId=S.GenerateId(),this.style=new b(this.jsvNativeId),E.Dom.CreateElement(this.jsvNativeId,e))}appendChild(e){e.parentNode?this.moveChildNode(e,null):(super.appendChild(e),this.jsvInsertChild(e,null))}removeChild(e){super.removeChild(e),this.jsvRemoveChild(e),e instanceof k&&e.jsvNativeId>0&&E.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?e.parentNode==this?(this.jsvMoveChildReOrder(e,t),this.jsvReOrderChildNode(e,t)):this.moveChildNode(e,t):(super.insertBefore(e,t),this.jsvInsertChild(e,t))}addEventListener(e,t,s){const i=this.jsvGetEventListenerSet(e);i?.has(t)?console.warn("Element.addEventListener() Faild to add listener, func is exists"):(s=this.jsvCheckEventOptions(s),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),E.Dom.AddElementEventListener(this.jsvNativeId,e,s)),super.addEventListener(e,t,s))}removeEventListener(e,t,s){const i=this.jsvGetEventListenerSet(e);0!=!!i?.has(t)&&(s=this.jsvCheckEventOptions(s),super.removeEventListener(e,t,s),this.jsvNativeId&&(this.jsvRemoveListener(this.jsvNativeId,e),E.Dom.RemoveElementEventListener(this.jsvNativeId,e,s)))}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)}get clientWidth(){return this.jsvClientSizeStore.clientWidth||(this.jsvClientSizeStore.clientWidth=E.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvClientSizeStore.clientWidth}get clientHeight(){return this.jsvClientSizeStore.clientHeight||(this.jsvClientSizeStore.clientHeight=E.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvClientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?E.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?E.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&E.Dom.SetForgeViewInnerProps(this.jsvNativeId,"data-jsv-vw-id",t)))}removeAttribute(e){delete this.jsvAttrStore[e],("class"==e||e.startsWith("data-v-")||"src"==e)&&this.jsvNativeId&&E.Dom.SetElementAttribute(this.jsvNativeId,e,null)}getAttribute(e){return this.jsvAttrStore[e]}hasAttribute(e){return!!this.jsvAttrStore[e]}focus(){document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new n(n.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new n(n.JsvType.Focus);document.dispatchEvent(t)}jsvGetBoundingClientRect(){const e="jsv-getbound",t=S.GenerateId();return new Promise(((s,i)=>{const n=o=>{const r=o.jsvParams?.[1];if(r!=t)return;o.preventDefault(),this.removeEventListener(e,n);const a=JSON.parse(o.jsvParams?.[0]??"{}");0===a.status?s(a.data):i(a.error)};this.addEventListener(e,n,{jsvtoken:t})}))}jsvSetOnLazyTaskSyncedListener(e){E.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...n){let o;e.startsWith("animation")?(o=new s(e),o.animationName=n[0]):e.startsWith("transition")?(o=new P(e),o.propertyName=n[0]):e.startsWith("jsv")?(o=new i(e),o.options={detail:n[0]},o.jsvParams=n):"click"==e&&(o=new t(e),o.target=this),o&&(o.target=this,this.dispatchEvent(o))}jsvGetProxyView(e){return e?(this.maskViewProxy||(this.maskViewProxy=T.NewDomProxyView(this.jsvNativeId,!0)),this.maskViewProxy):(this.mainViewProxy||(this.mainViewProxy=T.NewDomProxyView(this.jsvNativeId,!1)),this.mainViewProxy)}jsvGetProxyTexture(e){return this.mainViewTextureProxy||(this.mainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this.mainViewTextureProxy}jsvGetRelativePosition(e){return E.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}jsvAddListener(e,t){let s=k.JsvEventListenerMap.get(e);s||(s=new Map,k.JsvEventListenerMap.set(e,s));this.jsvGetEventListenerSet(t)||s.set(t,this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let s=k.JsvEventListenerMap.get(e);if(!s)return;this.jsvGetEventListenerSet(t)||s.delete(t)}moveChildNode(e,t){console.log("Do move child node");let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.jsvMoveChildNode(s,e,t)}jsvMoveChildNode(e,t,s){t.jsvNativeId&&(s=k.JsvFindBackwardForgeView(s),E.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}jsvReOrderChildNode(e,t){e.jsvNativeId&&(t=k.JsvFindBackwardForgeView(t),E.Dom.ReOrderElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvInsertChild(e,t){e.parentNode=this,e.nodeType===x.TEXT_NODE?this.textContent=e.nodeValue:e instanceof k&&e.jsvNativeId>0&&(t=k.JsvFindBackwardForgeView(t),E.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvRemoveChild(e){if(e instanceof k!=0){for(const t of e.childNodes)e.jsvRemoveChild(t);e.jsvFinalize(),E.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),k.JsvEventListenerMap.delete(e.jsvNativeId)}}jsvCheckEventOptions(e){if(null==e)return null;if("object"!=typeof e||e instanceof Array)return console.warn("Event options is invalid for ",e),null;const t=["capture","once","passive","signal"];for(const[s,i]of Object.entries(e))0==t.includes(s)&&0==s.startsWith("jsv")&&(console.warn("Event options name is invalid: ",s),delete e[s]),"boolean"==typeof i?e[s]=+e[s]:"number"!=typeof i&&(console.warn("Event options value is invalid: ",i),delete e[s]);return e}static JsvFindBackwardForgeView(e){let t=e;for(;t&&!(t instanceof k);)t=t.nextSibling;return t}}k.JsvTagName={Anchor:"A",Audio:"AUDIO",Div:"DIV",Head:"HEAD",Image:"IMG",IFrame:"IFRAME",Link:"LINK",Script:"SCRIPT",Style:"STYLE",Svg:"SVG",Video:"VIDEO",JsvAudioTrack:"JSV-AUDIOTRACK",JsvFDiv:"FDIV"},k.JsvEventListenerMap=new Map;class L extends k{constructor(){super(k.JsvTagName.Anchor),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname="",console.warn("Warnig: <a> is fake in JsView system")}jsvGetTagName(){return k.JsvTagName.Anchor}}class M extends x{constructor(e){super(x.COMMENT_NODE),this.textContent=e}}class R extends k{constructor(){super(k.JsvTagName.Div),this.textContentStore=null}get textContent(){return this.textContentStore}set textContent(e){this.textContentStore=e,this.jsvClientSizeStore={},E.Dom.SetElementText(this.jsvNativeId,e)}}const j="FocusDebug",_="__AppRoot__";let O=!1,J=!1;function B(e){let t="";if(e){let s=e,i=s.RouterDelegate?.ref?.NameSpace;for(i=i==_?"":i,t=`[${i?i+", ":""}${s.BranchName}]`,s=s.GetParentPage();s;)i=s.RouterDelegate?.ref?.NameSpace,i=i==_?"":i,t=`[${i?i+", ":""}${s.BranchName}]->`+t,s=s.GetParentPage()}return t}function A(e,t){let s=B(e);if(t.stack){let e=t.stack.split("\n");e.length>=3&&(t.stack=e.slice(2,6))}let i="";for(let e of t.stack)i+=e+"\n";delete t.stack,console.log(j,`focusChange(${t?.from}):${t?.askName}\n:originFocusStack:${t?.originFStack}\n:focusStack:${s}\n:trace:${i}:`,t)}class V{constructor(e,t){this._DefaultFocusNameSpace=null,this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new W(!1,t))}enableFocusTrace(e){O=!0,J=e}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==_?"":e}wrapWithNameSpace(e){let t=new V(!0);return t._DefaultFocusNameSpace=e,t.RouterDelegate=this.RouterDelegate,t}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t,s){if("string"==typeof e)return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t,s);console.error(`setFocus name=${e} is invalid`)}setFocus(e,t){this._DefaultFocusNameSpace&&this._DefaultFocusNameSpace.length>0&&(e=`${this._DefaultFocusNameSpace}.${e}`);let s=null;O&&(s={askName:e,deepToChild:t,from:"setFocus",stack:J?new Error("simulate-stack").stack:null});return this.focusByNameBeforeMount(e,t,s)}printAllFocusable(){this.RouterDelegate.ref.printAllFocusRecursive(this._DefaultFocusNameSpace,"")}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof z;){let s=t.RouterDelegate?.ref?.NameSpace;e.push({nameSpace:s==_||s==t.BranchName?"":s,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(z.sLastFocus){let e=z.sLastFocus;for(;e._LatestFocusChild;)e=e._LatestFocusChild;return e.BranchName}return null}getCurrentFocus(){if(this.RouterDelegate.ref){const e=this.RouterDelegate.ref.getCurrentFocusNode();if(e)return e.BranchName}return null}getDeactivedPageFocus(){return this.RouterDelegate.ref?this.RouterDelegate.ref.getDeactivePageFocusName():null}returnFocusToParent(){const e=this.RouterDelegate.ref.getCurrentFocusNode();e?e.ReturnFocusToParent():console.warn("returnFocusToParent: current focus node is null.")}}class W{constructor(e,t){this._ChildMap={},this._FocusNameBeforeMount=null,this._BeforeMountStack=null,this._FocusNodeName=null,this._IsTemp=!!e,this.NameSpace=t}getDeactivePageFocusName(){return this._FocusNodeName}getCurrentFocusNode(e=!1){if(null==this._FocusNodeName)return null;let t=this._ChildMap[this._FocusNodeName];if(!t)return e||console.error("Erorr: node not mounted name="+this._FocusNodeName),null;if(t.RouterDelegate.ref!=this){let e=t.RouterDelegate.ref.getCurrentFocusNode();return null==e?t:e}return t}getNodeByName(e,t){let s=e.split(".");return this._FindRouterSearchBase(s,t)._GetNodeFromPathArray(s,e)}printAllFocusRecursive(e,t){let s=this.NameSpace==_?"":this.NameSpace,i=t+(t&&t.length>0?".":"")+s;for(let t in this._ChildMap){let s=this._ChildMap[t];if(!e||0==e.length||i.indexOf(e)>=0){let e=i===_?t:i+"."+t;console.log(e,s)}s.RouterDelegate.ref!=this&&s.RouterDelegate.ref.printAllFocusRecursive(e,i)}}_FindRouterSearchBase(e,t){if(0==e[0].length){let t,s;for(let e in this._ChildMap){t=this._ChildMap[e];break}do{s=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),s.RouterDelegate.ref}return t&&t.AsHub&&t.GetParentPage()?t.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(e,t){let s=0,i=this;for(;s<e.length-1;){let n=!1;for(let t in i._ChildMap){let o=i._ChildMap[t].RouterDelegate.ref;if(o!=i&&o.NameSpace==e[s]){i=o,s++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${t}`)}let n=e[s];return i._ChildMap.hasOwnProperty(n)?i._ChildMap[n]:void console.error(`Error: no found fname=${t}`)}add(e,t){if(e.indexOf(".")>=0)console.error("ERROR: FDiv name can not contains '.'");else if(this._ChildMap.hasOwnProperty(e)&&this._ChildMap[e]!==t)console.error(`ERROR: FDiv router branch name duplicated:[${e}]`);else if(this._ChildMap[e]=t,this._FocusNameBeforeMount)if("string"==typeof this._FocusNameBeforeMount)this._FocusNameBeforeMount==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount,!1,this._BeforeMountStack);else{this._FocusNameBeforeMount[0]==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1),!1,this._BeforeMountStack)}}remove(e,t,s,i){let n=this._ChildMap[e];n&&n==t&&(delete this._ChildMap[e],n.OnRemoveFromTree()),this._FocusNodeName==e&&s&&(i||(this._FocusNodeName=s))}rename(e,t){if(!this._ChildMap.hasOwnProperty(e))return void console.error(`ERROR: alter name failed ${e}->${t}`);let s=this._ChildMap[e];delete this._ChildMap[e],this.add(t,s),this._FocusNodeName==e&&(this._FocusNodeName=t)}clearChildFocus(){this._FocusNodeName=null,this._FocusNameBeforeMount=null}hasPendingFocusRequest(){return!this._FocusNameBeforeMount}focusBeforeMount(e,t,s){if(O)if(s){if(!s.originFStack){let e=this.getCurrentFocusNode(!0);s.originFStack="Mark1:",s.originFStack+=e?B(e):`NoFocus[focusSet:${this._FocusNodeName} notMountFocus:${this._FocusNameBeforeMount}]`}}else console.error(j,`Error: found debug info missing from ${new Error("simulate-stack").stack}`);let i=!1;if("string"==typeof e){if(!e.includes(".")){i=!0;let n=this._ChildMap[e];if(this._FocusNodeName=e,n){this._FocusNameBeforeMount=null,this._BeforeMountStack=s,n.Focus(!t);let e=n.GetFocusChild();for(;e;){let t=e.GetFocusChild();if(!t){this._FocusNodeName=e.BranchName;break}e=t}return O&&A(e??n,s),n.RouterDelegate.ref!=this&&n.RouterDelegate.ref.clearChildFocus(),!0}return this._FocusNameBeforeMount=e,this._BeforeMountStack=s,!1}console.error("error: name contain .")}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(i=!0,1==e.length)return this.focusBeforeMount(e[0],t,s);{let i=e[0],n=this._ChildMap[i];return this._FocusNodeName=i,n?n.RouterDelegate.ref.focusBeforeMount(e.slice(1),t,s):(this._FocusNameBeforeMount=e,this._BeforeMountStack=s,!1)}}return i||console.error("illegal name param",e),!1}focus(e,t,s){let i=this.focusBeforeMount(e,t,s);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 z extends T.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.AsHub=!1,this.InterfaceHub=null,this._TmpRouter=null,this._AutoShow=null,this.BranchName=e,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}async waitMounted(){if(this._Mounted)return;let e=this;return new Promise(((t,s)=>{e._MountWaitingList||(e._MountWaitingList=[]),e._MountWaitingList.push(t)}))}updateMountState(){this._Mounted=!0;let e=this.SubPages;for(let t in e)e[t].updateMountState();if(this._MountWaitingList&&this._MountWaitingList.length>0){for(const e of this._MountWaitingList)e();this._MountWaitingList=null}}getHub(){return this.InterfaceHub||(this.InterfaceHub=new V(!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 W(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}routerUnbind(e,t){let s;this.AsHub?this.GetParentPage()&&(s=this.GetParentPage().RouterDelegate.ref):s=this.RouterDelegate.ref,s&&s.remove(this.BranchName,this,e,t),this.RouterDelegate={ref:null}}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}static safeCallback(e){return e&&e instanceof Function?function(...t){try{return e(...t)}catch(t){console.error("FocusNode: callback error",e.name,t)}}:null}setOnKeyDown(e){this._OnKeyDown=z.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=z.safeCallback(e)}setOnFocus(e){this._OnFocus=z.safeCallback(e)}setOnBlur(e){this._OnBlur=z.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=z.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=z.safeCallback(e)}setOnCustomEvent(e){this._OnCustomEvent=z.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=z.safeCallback(e),this._DKeyUpProxy=z.safeCallback(t)}requestFocus(e){let t=null;O&&(t={askName:this.BranchName,deepToChild:e,from:"requestFocus",stack:J?new Error("simulate-stack").stack:null}),this.requestFocusInner(e,t)}ReturnFocusToParent(){if(this.IsFocus()){let e=this.GetParentPage();if(e){const t=e.BranchName;let s=null;O&&(s={askName:t,deepToChild:!1,from:"returnFocusToParent",stack:J?new Error("simulate-stack").stack:null}),e.RouterDelegate.ref.focus(t,!1,s)}}else super.ReturnFocusToParent()}requestFocusInner(e,t){let s=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(s=this.GetParentPage().RouterDelegate.ref),s?s.focus(this.BranchName,e,t):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomEvent(e){return!!this._OnCustomEvent&&this._OnCustomEvent(e)}bubbleCustomEvent(e){this.BubbleCustomEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return 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(),G()),e instanceof z)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let t=this.RouterDelegate.ref;this.RouterDelegate.ref=null,t.forEach(((t,s)=>{e.routerAdd(s,t)}))}e.routerAdd(this.BranchName,this)}}focus(e){this.Focus(e)}Focus(e){if(!this._Mounted)return z.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(){z.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(e){z.sLastFocus==this&&(z.sLastFocus=null);let t=this.IsFocus();if(O&&t){let t=this.GetParentPage();if(t){let s=null;s={askName:t.BranchName,deepToChild:!1,from:e?"deactive":"unmount",stack:J?new Error("simulate-stack").stack:null,originFStack:"Mark2:"+B(this)},A(t,s)}}let s=this.GetParentPage();s&&s.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind(s?.BranchName,e),this._Mounted=!1}getFullName(){let e=this,t=[this.RouterDelegate.ref.NameSpace];this.AsHub||t.push(this.BranchName);let s=this.RouterDelegate.ref;do{if(e=e.GetParentPage(),t[0]==_)break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return t[0]==_?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}z.sFocusMemos=[],z.sLastFocus=null,z.sRootPageNode=null;let G=()=>{let e=z.sFocusMemos.length;if(e>0){let t=z.sFocusMemos;z.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},K={};class U{constructor(e,t,s){this._Element=s,K.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),K[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),window.JsView?t.attachToActivity(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.RootView):(window.addEventListener("keydown",(e=>{var s=document.activeElement?.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var s=document.activeElement?.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())})))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),G()}}class H extends k{constructor(){super(k.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new N(t).href,this.jsvClientSizeStore={}}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&E.Dom.SetElementAttribute(this.jsvNativeId,e,t)}jsvOnEvent(e,...s){let i;super.jsvOnEvent(e,...s),"load"==e&&(i=new t(e),i.target=this),i&&this.dispatchEvent(i)}}class $ extends k{constructor(){super(k.JsvTagName.Link)}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new N(this.href);console.log("Ignore to load link from url="+s.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,s){if(console.log("Load link result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}}class q extends k{constructor(){super(k.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new N(this.src);console.log("Load script with url="+e.href);var t=this;window.JsView.runJsWithUrl(e.href,!1,((e,s)=>{t.jsvOnLoadResult(e,s)}))}}jsvOnLoadResult(e,s){if(console.log("Load script result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}}class X extends k{constructor(){super(k.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class Y extends k{constructor(){super(k.JsvTagName.Svg)}}class Z extends x{constructor(e){super(x.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let Q=1;class ee extends k{constructor(){super(k.JsvTagName.JsvFDiv),this.FocusNodeRef=new z("unnamed-"+Q++),this.hubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.hubRef){let e=new V(!1,t);this.hubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.hubRef}}class te extends x{constructor(){super(x.DOCUMENT_NODE),this.location=window.location,this.rootElement=new R,this.rootElement.ownerDocument=this,this.rootElement.id="root",E.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new M(e)}createElement(e){switch(e=e.toUpperCase()){case k.JsvTagName.Anchor:return new L;case k.JsvTagName.Div:return new R;case k.JsvTagName.Image:return new H;case k.JsvTagName.Link:return new $;case k.JsvTagName.Script:return new q;case k.JsvTagName.Style:return new X;case k.JsvTagName.Svg:return new Y;case k.JsvTagName.JsvFDiv:return new ee;case k.JsvTagName.IFrame:console.error("Unsupported element: "+e+". Your vue compilation may may have failed, please check it first.")}if("TEMPLATE"==e)return{};throw new TypeError("Unimplemented element: "+e)}createEvent(e){return"CUSTOMEVENT"===(e=e.toUpperCase())?new i(e):new t(e)}createTextNode(e){return new Z(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMException("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===k.JsvTagName.Head)return[this.head];if(e===k.JsvTagName.Link||e===k.JsvTagName.Script||e===k.JsvTagName.Style)return[];throw new DOMException("Failed to get element by name, 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("title"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMException("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new U(e,t,s)}}class se extends k{constructor(){super(k.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof $||e instanceof q)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class ie{constructor(){this.ready=!1,this.callbacks=[]}listenToReady(e){this.ready?e?.():this.callbacks.push(e)}dataReady(){this.ready=!0;for(let e of this.callbacks)e?.()}}class ne extends ie{constructor(){super(),this.TextureManager=null,this.RootActivity=null,this.RootView=null}setHandles(e,t,s){this.TextureManager=e,this.RootActivity=s,this.RootView=t,this.dataReady()}}let oe="@keyframes";class re{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.getName(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),E.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),E.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}getName(e){let t=e.indexOf(oe)+10,s=e.indexOf("{");return e.substring(t,s).trim()}}let ae=null;function le(e){return ae||(ae={global:new re("global")}),ae.global}class he{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,he.EnsureGlobalJsvCode(e,t),k.JsvEnableEventListener(),b.JsvDeclarePrototype()}static EnsureGlobalJsvCode(e,t){window.JsvCode.Dom||(window.JsvCode.Dom={}),window.JsvCode.Media||(window.JsvCode.Media={}),window.JsvCode.Dom.PlatformBridge||(window.JsvCode.Dom.PlatformBridge=e),window.JsvCode.Media.PlatformBridge||(window.JsvCode.Media.PlatformBridge=t),window.JsvCode.Dom.DeclareStyleSheets||(window.JsvCode.Dom.DeclareStyleSheets=E.Dom.DeclareStyleSheets),window.JsvCode.Dom.UndeclareStyleSheets||(window.JsvCode.Dom.UndeclareStyleSheets=E.Dom.UndeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=le),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new ne)}}class ce{static SetLevel(e){switch(ce.E=ce.W=ce.I=ce.D=function(){},e){case ce.Level.Verbose:ce.V=console.debug.bind(console);case ce.Level.Debug:ce.D=console.debug.bind(console);case ce.Level.Info:ce.I=console.info.bind(console)}}}ce.E=console.error.bind(console),ce.W=console.warn.bind(console),ce.I=console.info.bind(console),ce.D=function(){},ce.V=function(){},ce.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class de{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof x))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}}class ue extends te{constructor(){super(),this.head=new se}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}class ve{static DeclareGlobal(){ve.DeclareDocument(),ve.DeclareOthers(),ve.DeclareAddition()}static DeclareDocument(){window.document=new ue}static DeclareOthers(){window.MutationObserver=de,window.Element=k,window.SVGElement=Y;let e=new N(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.history={},window.navigator={userAgent:"jsview-runtime",platform:"jsview"}}static DeclareAddition(){window.JsView.Dom={Render:null,Extension:null,UrlRef:N}}}class me{constructor(e){this.activity=new T.ReactActivity("NativeForgeActivity",e,null,null),this.init()}init(){console.log("create NativeForgeActivity.");let e=new T.LayoutView;window.JsvCode.ForgeHandles.setHandles(this.activity.GetTextureManager(),e,this.activity);let t=null;T.DesignMap&&(t=T.DesignMap());let s=t?t.width:1280,i=Math.floor(9*s/16);this.activity.SetContentView(e,{x:0,y:0,width:s,height:i}),T.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{E.Dom.RequestSwapAllCachedTasks()})),window.JsView.Dom.Render()}}class fe{constructor(e){this.activityManager=e;let t=new me(e);e.RegisterActivity(t.activity),e.StartActivity(new T.Intent("NativeForgeActivity"))}}window.jsvIsBrowserDebug=!1;const pe=window.JsvCode.NativePlatformDomBridge,ge=window.JsvCode.NativePlatformMediaBridge;function we(){he.EnsureGlobalEnv(pe,ge),ve.DeclareGlobal(),ce.I("Using JsView Native Environment.")}export{we as InitEnv,fe as NativeForgeApp};
1
+ /* eslint-disable */ class e{static CreateAudioPlayer(e){return new Audio(e)}static CreateVideoPlayer(){const t=new Video;return t.jsvOnCssStyleChanged=e.OnCssStyleChanged.bind(t),t.jsvFinalize=e.JsvFinalize.bind(t),t}static OnCssStyleChanged(e,t){this.jsvSetStyles(t.left,t.top,t.width,t.height,t.objectFit,t.visibility)}static JsvFinalize(){console.log("NativePlatformMediaBridge.JsvFinalize()");const e=this;e.pause(),e.unload?.(),e.releaseResource&&(e.releaseResource(),e.onPlatformDestroy())}}window.JsvCode.NativePlatformMediaBridge||(window.JsvCode.NativePlatformMediaBridge=e);class t{constructor(e,t){this.prevented=!1,this.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.prevented=!0}jsvIsPrevented(){return this.prevented}}class s extends t{constructor(e){super(e)}}class i extends t{constructor(e,t){super(e),this.options=t}initCustomEvent(e,t,s,i){this.type=e}get detail(){return this.options?.detail}}void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var n,o,r,a,l,h,c,d,u,v,m,f,g,p,y,w,T=window.Forge;class N{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,s=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,s).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:")||!0===e.startsWith("jsvtexturestore:"))return void(this.href=e);let s=e.indexOf("://");if(!(s<0||s>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=window.location.origin+e;else if(!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!==window.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=window.location.href;let e=window.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.MainPath=window.location.origin+window.location.pathname.substring(0,e)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let i=this.href,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let o=i.indexOf("?");o>1&&(this.search=i.substring(o),i=i.substring(0,o));let r=i,a=r.indexOf("://");this.protocol=a>0?r.substring(0,a+1):"";let l=a>1?r.substring(a+3):"";a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>=1?l.substring(a):"","file:"==this.protocol&&(this.host="",this.pathname=l),this.origin=this.protocol+"//"+this.host,a=this.host.indexOf(":"),this.hostname=a>0?this.host.substring(0,a):this.host,this.port=a>1?this.host.substring(a+1):""}replace(e){this.href=e}}class D{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){D.PushLazyTask(D.LazyTaskType.CreateElement,e,t)}static BindElementToRootView(e){D.PushLazyTask(D.LazyTaskType.BindElementToRootView,e)}static InsertElementChild(e,t,s){D.PushLazyTask(D.LazyTaskType.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){D.PushLazyTask(D.LazyTaskType.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){D.PushLazyTask(D.LazyTaskType.MoveElementChild,e,t,s,i)}static ReOrderElementChild(e,t,s){D.PushLazyTask(D.LazyTaskType.ReOrderElementChild,e,t,s)}static AddElementEventListener(e,t,s){D.PushLazyTask(D.LazyTaskType.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){D.PushLazyTask(D.LazyTaskType.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){D.PushLazyTask(D.LazyTaskType.SetElementText,e,t)}static SetElementAttribute(e,t,s){D.PushLazyTask(D.LazyTaskType.SetElementAttribute,e,t,s),D.LazyTaskSyncedListenerMap.has(e)&&D.CachedSyncListenIdSet.add(e)}static GetElementBoundingClientStyles(e,t){return D.RunSyncTask(D.LazyTaskType.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),D.PushLazyTask(D.LazyTaskType.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){D.PushLazyTask(D.LazyTaskType.DeclareStyleSheets,-1,e)}static UndeclareStyleSheets(e){D.PushLazyTask(D.LazyTaskType.UndeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){D.PushLazyTask(D.LazyTaskType.SetStyleProperty,e,t,s),D.LazyTaskSyncedListenerMap.has(e)&&D.CachedSyncListenIdSet.add(e)}static GetStyleProperties(e,t){return D.RunSyncTask(D.LazyTaskType.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){D.LazyTaskSyncedListenerMap.set(e,t)}static RemoveLazyTaskSyncedListener(e){D.LazyTaskSyncedListenerMap.delete(e)}static RequestSwapAllCachedTasks(){if(0==D.CachedLazyTaskList.length)return;const e=JSON.stringify(D.CachedLazyTaskList);D.CachedLazyTaskList=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e),D.CachedLazyTaskAmount=0;for(const e of D.CachedSyncListenIdSet){const t=D.LazyTaskSyncedListenerMap.get(e);t?.()}D.CachedSyncListenIdSet.clear()}static GetElementAttribute(e,t){return D.RunSyncTask(D.LazyTaskType.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){D.PushLazyTask(D.LazyTaskType.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){D.PushLazyTask(D.LazyTaskType.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=D.RunSyncTask(D.LazyTaskType.GetRelativePosition,e,t);return JSON.parse(s)}static GetLazyTaskAmount(){return D.CachedLazyTaskAmount}static RunSyncTask(e,t,...s){D.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static PushLazyTask(e,t,...s){let i=1;e==D.LazyTaskType.SetStyleProperty?i=2:e==D.LazyTaskType.DeclareStyleSheets&&(i=3),D.CachedLazyTaskAmount+=i,D.CachedLazyTaskList.push([e,t,...s]),T.sRenderBridge?.RequestSwap()}}D.CachedLazyTaskAmount=0,D.CachedLazyTaskList=new Array,D.CachedSyncListenIdSet=new Set,D.LazyTaskSyncedListenerMap=new Map,D.LazyTaskType={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,ReOrderElementChild:22,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,UndeclareStyleSheets:39,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42};class S{}S.Dom=D,S.Media=class{static CreateAudioPlayer(){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer()}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}};class E{static GenerateId(){const e=this.UniqueId++;if(e>=this.MaxUniqueId)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}}E.UniqueId=0,E.MaxUniqueId=Math.pow(2,31)-1;class C{constructor(e){this.childNodes=[],this.nodeType=e,this.ownerDocument=window.document,this.parentNode=null,this.jsvEventListenerMap=null,this.jsvChildChangedCallback=null}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.jsvChildChangedCallback?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=null,this.jsvChildChangedCallback?.()}insertBefore(e,t){this.insertBeforeInner(e,t)}get previousSibling(){const e=this.parentNode?.childNodes;let t=e?.indexOf(this);if(void 0===t||t<0)throw new DOMException("Failed to call Node.previousSibling(), this node not found. this=",this);return e[t-1]}get nextSibling(){const e=this.parentNode?.childNodes;let t=e?.indexOf(this);if(void 0===t||t<0)throw new DOMException("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.jsvEventListenerMap||(this.jsvEventListenerMap=new Map);let i=this.jsvEventListenerMap?.get(e);i||(i=new Set,this.jsvEventListenerMap?.set(e,i)),i.add(t)}removeEventListener(e,t,s){let i=this.jsvEventListenerMap?.get(e);i&&(i.delete(t),i.size<=0&&this.jsvEventListenerMap?.delete(e),0==this.jsvEventListenerMap?.size&&(this.jsvEventListenerMap=null))}dispatchEvent(e){if(!this.jsvEventListenerMap)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.jsvEventListenerMap?.get(e.type);if(t){for(let s of t)if(s?.(e),e.jsvIsPrevented())break}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.jsvChildChangedCallback=e}jsvMoveChildReOrder(e,t){{let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to call jsvMoveChildReOrder, node not found. node=",e);this.childNodes.splice(t,1)}{let s=this.childNodes.length;if(t&&(s=this.childNodes.indexOf(t),s<0))throw new DOMException("Failed to call move node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e)}this.jsvChildChangedCallback?.()}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);if(i<0)throw new DOMException("Failed to call jsvMoveChildToNewParent, node not found. node=",e);this.childNodes.splice(i,1),e.parentNode=null,this.jsvChildChangedCallback?.(),t.insertBeforeInner(e,s)}jsvGetEventListenerSet(e){const t=this.jsvEventListenerMap?.get(e);return t}insertBeforeInner(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMException("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.");if(null!==t&&(s=this.childNodes.indexOf(t)),s<0)throw new DOMException("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.jsvChildChangedCallback?.()}}function x(e,t,s){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:s?"".concat(s," ",t):t})}C.ELEMENT_NODE=1,C.TEXT_NODE=3,C.COMMENT_NODE=8,C.DOCUMENT_NODE=9,C.NOLAYOUT_NODE=10;class I{static HasGetterMethod(e){switch(e){case I.Layout.Height:case I.Layout.Left:case I.Layout.Top:case I.Layout.Width:case I.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==I.Layout.Height?I.Layout.Height:e==I.Layout.Left?I.Layout.Left:e==I.Layout.Top?I.Layout.Top:e==I.Layout.Width?I.Layout.Width:e==I.Flex.FlexDirection?I.Flex.FlexDirection:e==I.Flex.FlexWrap?I.Flex.FlexWrap:e==I.Flex.JustifyContent?I.Flex.JustifyContent:e==I.Flex.AlignItems?I.Flex.AlignItems:e==I.Flex.AlignContent?I.Flex.AlignContent:e==I.Flex.AlignSelf?I.Flex.AlignSelf:e==I.Flex.FlexGrow?I.Flex.FlexGrow:e==I.Background.BackgroundColor?I.Background.BackgroundColor:e==I.Background.BackgroundImage?I.Background.BackgroundImage:e==I.Background.BorderRadius?I.Background.BorderRadius:e==I.Background.JsvImageBlendType?I.Background.JsvImageBlendType:e==I.Effect.BackfaceVisibility?I.Effect.BackfaceVisibility:e==I.Effect.BorderImage?I.Effect.BorderImage:e==I.Effect.BorderImageWidth?I.Effect.BorderImageWidth:e==I.Effect.BorderImageOutset?I.Effect.BorderImageOutset:e==I.Effect.Display?I.Effect.Display:e==I.Effect.ObjectFit?I.Effect.ObjectFit:e==I.Effect.Opacity?I.Effect.Opacity:e==I.Effect.Overflow?I.Effect.Overflow:e==I.Effect.Perspective?I.Effect.Perspective:e==I.Effect.PerspectiveOrigin?I.Effect.PerspectiveOrigin:e==I.Effect.Transform?I.Effect.Transform:e==I.Effect.TransformOrigin?I.Effect.TransformOrigin:e==I.Effect.TransformStyle?I.Effect.TransformStyle:e==I.Effect.Visibility?I.Effect.Visibility:e==I.Effect.ZIndex?I.Effect.ZIndex:e==I.Text.Color?I.Text.Color:e==I.Text.FontFamily?I.Text.FontFamily:e==I.Text.FontSize?I.Text.FontSize:e==I.Text.FontStyle?I.Text.FontStyle:e==I.Text.FontWeight?I.Text.FontWeight:e==I.Text.LineHeight?I.Text.LineHeight:e==I.Text.TextAlign?I.Text.TextAlign:e==I.Text.TextOverflow?I.Text.TextOverflow:e==I.Text.TextShadow?I.Text.TextShadow:e==I.Text.WebkitTextStroke?I.Text.WebkitTextStroke:e==I.Text.WhiteSpace?I.Text.WhiteSpace:e==I.Text.WordWrap?I.Text.WordWrap:e==I.Text.Direction?I.Text.Direction:e==I.Text.JsvTextEmoji?I.Text.JsvTextEmoji:e==I.Text.JsvTextLatex?I.Text.JsvTextLatex:e==I.Text.JsvTextAlignMinWidth?I.Text.JsvTextAlignMinWidth:e==I.Text.JsvTextVerticalAlign?I.Text.JsvTextVerticalAlign:e==I.Text.JsvTextLineAlign?I.Text.JsvTextLineAlign:e==I.Text.JsvTextInnerDirection?I.Text.JsvTextInnerDirection:e==I.Motion.Animation?I.Motion.Animation:e==I.Motion.Transition?I.Motion.Transition:e==I.Motion.AnimationFillMode?I.Motion.AnimationFillMode:null}constructor(){throw new Error("new StyleName() is forbidden.")}}I.Layout=(x(n=class{constructor(){throw new Error("new StyleName.Layout() is forbidden.")}},"Layout"),n.Height="height",n.Left="left",n.Top="top",n.Width="width",n),I.Flex=(x(o=class{constructor(){throw new Error("new StyleName.Flex() is forbidden.")}},"Flex"),o.FlexDirection="flexDirection",o.FlexWrap="flexWrap",o.JustifyContent="justifyContent",o.AlignItems="alignItems",o.AlignContent="alignContent",o.AlignSelf="alignSelf",o.FlexGrow="flexGrow",o),I.Background=(x(r=class{constructor(){throw new Error("new StyleName.Background() is forbidden.")}},"Background"),r.BackgroundColor="backgroundColor",r.BackgroundImage="backgroundImage",r.BorderRadius="borderRadius",r.JsvImageBlendType="JsvImageBlendType",r),I.Effect=(x(a=class{constructor(){throw new Error("new StyleName.Effect() is forbidden.")}},"Effect"),a.BackfaceVisibility="backfaceVisibility",a.BorderImage="borderImage",a.BorderImageWidth="borderImageWidth",a.BorderImageOutset="borderImageOutset",a.Display="display",a.ObjectFit="objectFit",a.Opacity="opacity",a.Overflow="overflow",a.Perspective="perspective",a.PerspectiveOrigin="perspectiveOrigin",a.Transform="transform",a.TransformOrigin="transformOrigin",a.TransformStyle="transformStyle",a.Visibility="visibility",a.ZIndex="zIndex",a),I.Text=(x(l=class{constructor(){throw new Error("new StyleName.Text() is forbidden.")}},"Text"),l.Color="color",l.FontFamily="fontFamily",l.FontSize="fontSize",l.FontStyle="fontStyle",l.FontWeight="fontWeight",l.LineHeight="lineHeight",l.TextAlign="textAlign",l.TextOverflow="textOverflow",l.TextShadow="textShadow",l.WebkitTextStroke="WebkitTextStroke",l.WhiteSpace="whiteSpace",l.WordWrap="wordWrap",l.Direction="direction",l.JsvTextEmoji="JsvTextEmoji",l.JsvTextLatex="JsvTextLatex",l.JsvTextAlignMinWidth="JsvTextAlignMinWidth",l.JsvTextVerticalAlign="JsvTextVerticalAlign",l.JsvTextLineAlign="JsvTextLineAlign",l.JsvTextInnerDirection="JsvTextInnerDirection",l),I.Motion=(x(h=class{constructor(){throw new Error("new StyleName.Motion() is forbidden.")}},"Motion"),h.Animation="animation",h.Transition="transition",h.AnimationFillMode="animationFillMode",h);class F{constructor(e){let t=-1,s=null;null==e?t=F.DataType.Null:Number(e)===e&&e%1==0?t=F.DataType.Int32:Number(e)===e&&e%1!=0?t=F.DataType.Float:"string"==typeof e||e instanceof String?t=F.DataType.String:e instanceof F.AnimationImpl?t=F.DataType.Animation:e instanceof F.CornerImpl?t=F.DataType.Corner:e instanceof F.RectImpl?t=F.DataType.Rect:e instanceof F.TextShadowImpl?t=F.DataType.TextShadow:e instanceof F.WebkitTextStrokeImpl?t=F.DataType.WebkitTextStroke:e instanceof F.TransitionImpl?t=F.DataType.Transition:e instanceof F.BorderImageImpl&&(t=F.DataType.BorderImage),e!=F.InvalidInt32&&e!=F.InvalidFloat&&e!=F.InvalidPointer?s=e:(t=F.DataType.Null,s=null),this.data=new F.DataInfo,this.data.index=t,this.data.value=s}toString(){let e=null;switch(this.data.index){case F.DataType.Null:return"";case F.DataType.Int32:case F.DataType.Float:return String(this.get());case F.DataType.String:e=this.get();break;case F.DataType.Animation:case F.DataType.Corner:case F.DataType.Rect:case F.DataType.TextShadow:case F.DataType.WebkitTextStroke:case F.DataType.Transition:case F.DataType.BorderImage:case F.DataType.BackgroundImage:e=this.get().rawValue;break;default:console.error("Failed to do StyleValue.toString()")}return e??""}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}}F.Base=class{constructor(e){this.rawValue=e}},F.AnimationImpl=class extends F.Base{constructor(e){super(e),this.name="",this.duration=0,this.timingFunction=null,this.delay=0,this.iterationCount=0,this.direction=!1}},F.CornerImpl=class extends F.Base{constructor(e){super(e),this.topLeft=0,this.topRight=0,this.bottomRight=0,this.bottomLeft=0}},F.RectImpl=class extends F.Base{constructor(e){super(e),this.top=0,this.right=0,this.left=0,this.bottom=0}},F.TextShadowImpl=class extends F.Base{constructor(e){super(e),this.hShadow=0,this.vShadow=0,this.blur=0,this.color=void 0}},F.WebkitTextStrokeImpl=class extends F.Base{constructor(e){super(e),this.length=0,this.color=void 0}},F.TransitionImpl=class extends F.Base{constructor(e){super(e),this.animationMap=new Map}},F.BorderImageImpl=class extends F.Base{constructor(e){super(e),this.source="",this.slice=null}},F.BackgroundImageImpl=(x(c=class extends F.Base{constructor(e){super(e),this.type=0,this.urlPath=""}},"BackgroundImageImpl"),c.eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2},c.LinearGradient=class{constructor(){this.fromX=0,this.fromY=0,this.toX=0,this.toY=0,this.stops=[]}},c),F.DataType=(x(d=class{},"DataType"),d.Null=0,d.Int32=1,d.Float=2,d.String=3,d.Animation=4,d.Corner=5,d.Rect=6,d.TextShadow=7,d.WebkitTextStroke=8,d.Transition=9,d.BorderImage=10,d.BackgroundImage=11,d),F.InvalidInt32=Number.MIN_VALUE,F.InvalidFloat=Number.NaN,F.InvalidPointer=null,F.DataInfo=class{constructor(){this.value=null,this.index=-1}},x(u=class{},"Text"),u.Color="#000000",u.FontFamily="黑体",u.FontSize=10,u.FontStyle="normal",u.FontWeight="normal",u.LineHeight=0,u.TextAlign="start",u.TextOverflow="clip",u.TextShadow=null,u.WebkitTextStroke=null,u.WhiteSpace="normal",u.WordWrap="normal",u.Direction="ltr",u.JsvTextEmoji=0,u.JsvTextLatex=0,u.JsvTextAlignMinWidth=0,u.JsvTextVerticalAlign="top",u.JsvTextLineAlign="middle",u.JsvTextInnerDirection="unset",x(v=class{constructor(){this.height=F.InvalidInt32,this.left=F.InvalidInt32,this.top=F.InvalidInt32,this.width=F.InvalidInt32}},"Layout"),v.Name="layout",x(m=class{constructor(){this.flexDirection=F.InvalidInt32,this.flexWrap=F.InvalidInt32,this.justifyContent=F.InvalidInt32,this.alignItems=F.InvalidInt32,this.alignContent=F.InvalidInt32,this.alignSelf=F.InvalidInt32,this.flexGrow=F.InvalidFloat}},"Flex"),m.Name="flex",x(f=class{constructor(){this.backgroundColor=F.InvalidPointer,this.backgroundImage=F.InvalidPointer,this.borderRadius=F.InvalidPointer,this.JsvImageBlendType=F.InvalidInt32}},"Background"),f.Name="background",x(g=class{constructor(){this.backfaceVisibility=F.InvalidPointer,this.borderImage=F.InvalidPointer,this.borderImageWidth=F.InvalidPointer,this.borderImageOutset=F.InvalidPointer,this.display=F.InvalidPointer,this.objectFit=F.InvalidPointer,this.opacity=F.InvalidFloat,this.overflow=F.InvalidPointer,this.perspective=F.InvalidInt32,this.perspectiveOrigin=F.InvalidPointer,this.transform=F.InvalidPointer,this.transformOrigin=F.InvalidPointer,this.transformStyle=F.InvalidPointer,this.visibility=F.InvalidPointer,this.zIndex=F.InvalidInt32}},"Effect"),g.Name="effect",x(p=class{constructor(){this.color=F.InvalidPointer,this.fontFamily=F.InvalidPointer,this.fontSize=F.InvalidInt32,this.fontStyle=F.InvalidPointer,this.fontWeight=F.InvalidPointer,this.lineHeight=F.InvalidInt32,this.textAlign=F.InvalidPointer,this.textOverflow=F.InvalidPointer,this.textShadow=F.InvalidPointer,this.webkitTextStroke=F.InvalidPointer,this.whiteSpace=F.InvalidPointer,this.wordWrap=F.InvalidPointer,this.direction=F.InvalidPointer,this.jsvTextEmoji=F.InvalidInt32,this.jsvTextLatex=F.InvalidInt32,this.jsvTextAlignMinWidth=F.InvalidInt32,this.jsvTextVerticalAlign=F.InvalidPointer,this.jsvTextLineAlign=F.InvalidPointer,this.jsvTextInnerDirection=F.InvalidPointer}},"Text"),p.Name="text",x(y=class{constructor(){this.animation=F.InvalidPointer,this.transition=F.InvalidPointer,this.animationFillMode="none"}},"Motion"),y.Name="motion";class b{static JsvDeclarePrototype(){for(let e in I){let t=I[e];for(let e in t){let s=t[e];if("string"!=typeof s)continue;const i={set:function(e){this.setProperty(s,e)},get:function(){return this.getPropertyValue(s)}};Object.defineProperty(b.prototype,s,i)}}}constructor(e){this.cachedProps={},this.nativeId=e}setProperty(e,t){if(window.JsvCode.Dom.CheckStyleFormat?.(e,t),e==I.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient")){const e=t.match(/\(/g)?.length,s=t.match(/\)/g)?.length;e!=s&&(console.error(`StyleError: illegal linear-gradient value '${t}'`),t="")}else{t=new N(t).href}else if(e==I.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new N(e[0]).href),t=e.join(" ")}else e==I.Effect.Display&&(this.cachedProps[e]=t);S.Dom.SetStyleProperty(this.nativeId,e,t)}getPropertyValue(e){if(e==I.Effect.Display)return this.cachedProps[e];throw console.error("StyleDeclaration.getPropertyValue() propName="+e),new Error("Get style value is unimplemented because it's low performance.")}jsvGetProperties(...e){const t=JSON.stringify(e),s=S.Dom.GetStyleProperties(this.nativeId,t);return JSON.parse(s)}}class k extends t{constructor(e){super(e)}}!function(e){e[e.Cancel=0]="Cancel",e[e.Click=1]="Click",e[e.LongPress=2]="LongPress",e[e.LongPressRelease=3]="LongPressRelease",e[e.touchFirstStart=4]="touchFirstStart",e[e.touchLastEnd=5]="touchLastEnd"}(w||(w={}));class L extends C{static JsvEnableEventListener(){S.Dom.EnableEventListener((function(e,t,...s){let i=L.JsvEventListenerMap.get(e);const n=i?.get(t);n?.(t,...s)}))}constructor(e){super(C.ELEMENT_NODE),this.jsvNativeId=-1,this.jsvAttrStore={},this.jsvClientSizeStore={},this.tagName=e,this.tagName!=L.JsvTagName.Audio&&this.tagName!=L.JsvTagName.Div&&this.tagName!=L.JsvTagName.Image&&this.tagName!=L.JsvTagName.Video&&this.tagName!=L.JsvTagName.JsvFDiv||(this.jsvNativeId=E.GenerateId(),this.style=new b(this.jsvNativeId),S.Dom.CreateElement(this.jsvNativeId,e))}appendChild(e){e.parentNode?this.moveChildNode(e,null):(super.appendChild(e),this.jsvInsertChild(e,null))}removeChild(e){super.removeChild(e),this.jsvRemoveChild(e),e instanceof L&&e.jsvNativeId>0&&S.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?e.parentNode==this?(this.jsvMoveChildReOrder(e,t),this.jsvReOrderChildNode(e,t)):this.moveChildNode(e,t):(super.insertBefore(e,t),this.jsvInsertChild(e,t))}addEventListener(e,t,s){const i=this.jsvGetEventListenerSet(e);i?.has(t)?console.warn("Element.addEventListener() Faild to add listener, func is exists"):(s=this.jsvCheckEventOptions(s),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),S.Dom.AddElementEventListener(this.jsvNativeId,e,s)),super.addEventListener(e,t,s))}removeEventListener(e,t,s){const i=this.jsvGetEventListenerSet(e);0!=!!i?.has(t)&&(s=this.jsvCheckEventOptions(s),super.removeEventListener(e,t,s),this.jsvNativeId&&(this.jsvRemoveListener(this.jsvNativeId,e),S.Dom.RemoveElementEventListener(this.jsvNativeId,e,s)))}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)}get clientWidth(){return this.jsvClientSizeStore.clientWidth||(this.jsvClientSizeStore.clientWidth=S.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvClientSizeStore.clientWidth}get clientHeight(){return this.jsvClientSizeStore.clientHeight||(this.jsvClientSizeStore.clientHeight=S.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvClientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?S.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?S.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&S.Dom.SetForgeViewInnerProps(this.jsvNativeId,"data-jsv-vw-id",t)))}removeAttribute(e){delete this.jsvAttrStore[e],("class"==e||e.startsWith("data-v-")||"src"==e)&&this.jsvNativeId&&S.Dom.SetElementAttribute(this.jsvNativeId,e,null)}getAttribute(e){return this.jsvAttrStore[e]}hasAttribute(e){return!!this.jsvAttrStore[e]}focus(){console.warn("warn: focus is invalid, use JsvFocusBlock to manager")}jsvGetBoundingClientRect(){const e="jsv-getbound",t=E.GenerateId();return new Promise(((s,i)=>{const n=o=>{const r=o.jsvParams?.[1];if(r!=t)return;o.preventDefault(),this.removeEventListener(e,n);const a=JSON.parse(o.jsvParams?.[0]??"{}");0===a.status?s(a.data):i(a.error)};this.addEventListener(e,n,{jsvtoken:t})}))}jsvSetTapListener(e){let t=this.jsvGetProxyView(!0);if(!e)return t.DragEnables(0),void t.SetTapListener(null);let s=0;e.onClick&&(s|=1),(e.onLongPress||e.onLongPressRelease)&&(s|=2),t.DragEnables(s),t.SetTapListener((t=>{switch(t){case w.Cancel:e.onCancel?.();break;case w.LongPress:e.onLongPress?.();break;case w.LongPressRelease:e.onLongPressRelease?.();break;case w.Click:e.onClick?.();break;default:console.error("Error:onTap unknown type:"+t)}}))}jsvSetOnLazyTaskSyncedListener(e){S.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...n){let o;e.startsWith("animation")?(o=new s(e),o.animationName=n[0]):e.startsWith("transition")?(o=new k(e),o.propertyName=n[0]):e.startsWith("jsv")?(o=new i(e),o.options={detail:n[0]},o.jsvParams=n):"click"==e&&(o=new t(e),o.target=this),o&&(o.target=this,this.dispatchEvent(o))}jsvGetProxyView(e){return e?(this.maskViewProxy||(this.maskViewProxy=T.NewDomProxyView(this.jsvNativeId,!0)),this.maskViewProxy):(this.mainViewProxy||(this.mainViewProxy=T.NewDomProxyView(this.jsvNativeId,!1)),this.mainViewProxy)}jsvGetProxyTexture(e){return this.mainViewTextureProxy||(this.mainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this.mainViewTextureProxy}jsvGetRelativePosition(e){return S.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}jsvAddListener(e,t){let s=L.JsvEventListenerMap.get(e);s||(s=new Map,L.JsvEventListenerMap.set(e,s));this.jsvGetEventListenerSet(t)||s.set(t,this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let s=L.JsvEventListenerMap.get(e);if(!s)return;this.jsvGetEventListenerSet(t)||s.delete(t)}moveChildNode(e,t){console.log("Do move child node");let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.jsvMoveChildNode(s,e,t)}jsvMoveChildNode(e,t,s){t.jsvNativeId&&(s=L.JsvFindBackwardForgeView(s),S.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}jsvReOrderChildNode(e,t){e.jsvNativeId&&(t=L.JsvFindBackwardForgeView(t),S.Dom.ReOrderElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvInsertChild(e,t){e.parentNode=this,e.nodeType===C.TEXT_NODE?this.textContent=e.nodeValue:e instanceof L&&e.jsvNativeId>0&&(t=L.JsvFindBackwardForgeView(t),S.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvRemoveChild(e){if(e instanceof L!=0){for(const t of e.childNodes)e.jsvRemoveChild(t);e.jsvFinalize(),S.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),L.JsvEventListenerMap.delete(e.jsvNativeId)}}jsvCheckEventOptions(e){if(null==e)return null;if("object"!=typeof e||e instanceof Array)return console.warn("Event options is invalid for ",e),null;const t=["capture","once","passive","signal"];for(const[s,i]of Object.entries(e))0==t.includes(s)&&0==s.startsWith("jsv")&&(console.warn("Event options name is invalid: ",s),delete e[s]),"boolean"==typeof i?e[s]=+e[s]:"number"!=typeof i&&(console.warn("Event options value is invalid: ",i),delete e[s]);return e}static JsvFindBackwardForgeView(e){let t=e;for(;t&&!(t instanceof L);)t=t.nextSibling;return t}}L.JsvTagName={Anchor:"A",Audio:"AUDIO",Div:"DIV",Head:"HEAD",Image:"IMG",IFrame:"IFRAME",Link:"LINK",Script:"SCRIPT",Style:"STYLE",Svg:"SVG",Video:"VIDEO",JsvAudioTrack:"JSV-AUDIOTRACK",JsvFDiv:"FDIV"},L.JsvEventListenerMap=new Map;class P extends L{constructor(){super(L.JsvTagName.Anchor),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname="",console.warn("Warnig: <a> is fake in JsView system")}jsvGetTagName(){return L.JsvTagName.Anchor}}class R extends C{constructor(e){super(C.COMMENT_NODE),this.textContent=e}}class M extends L{constructor(){super(L.JsvTagName.Div),this.textContentStore=null}get textContent(){return this.textContentStore}set textContent(e){this.textContentStore=e,this.jsvClientSizeStore={},S.Dom.SetElementText(this.jsvNativeId,e)}}const j="FocusDebug",_="__AppRoot__";let O=!1,J=!1;function B(e){let t="";if(e){let s=e,i=s.RouterDelegate?.ref?.NameSpace;for(i=i==_?"":i,t=`[${i?i+", ":""}${s.BranchName}]`,s=s.GetParentPage();s;)i=s.RouterDelegate?.ref?.NameSpace,i=i==_?"":i,t=`[${i?i+", ":""}${s.BranchName}]->`+t,s=s.GetParentPage()}return t}function A(e,t){let s=B(e);if(t.stack){let e=t.stack.split("\n");e.length>=3&&(t.stack=e.slice(2,6))}let i="";for(let e of t.stack)i+=e+"\n";delete t.stack,console.log(j,`focusChange(${t?.from}):${t?.askName}\n:originFocusStack:${t?.originFStack}\n:focusStack:${s}\n:trace:${i}:`,t)}class V{constructor(e,t){this._DefaultFocusNameSpace=null,this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new W(!1,t))}enableFocusTrace(e){O=!0,J=e}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==_?"":e}wrapWithNameSpace(e){let t=new V(!0);return t._DefaultFocusNameSpace=e,t.RouterDelegate=this.RouterDelegate,t}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t,s){if("string"==typeof e)return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t,s);console.error(`setFocus name=${e} is invalid`)}setFocus(e,t){this._DefaultFocusNameSpace&&this._DefaultFocusNameSpace.length>0&&(e=`${this._DefaultFocusNameSpace}.${e}`);let s=null;O&&(s={askName:e,deepToChild:t,from:"setFocus",stack:J?new Error("simulate-stack").stack:null});return this.focusByNameBeforeMount(e,t,s)}printAllFocusable(){this.RouterDelegate.ref.printAllFocusRecursive(this._DefaultFocusNameSpace,"")}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof z;){let s=t.RouterDelegate?.ref?.NameSpace;e.push({nameSpace:s==_||s==t.BranchName?"":s,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(z.sLastFocus){let e=z.sLastFocus;for(;e._LatestFocusChild;)e=e._LatestFocusChild;return e.BranchName}return null}getCurrentFocus(){if(this.RouterDelegate.ref){const e=this.RouterDelegate.ref.getCurrentFocusNode();if(e)return e.BranchName}return null}getDeactivedPageFocus(){return this.RouterDelegate.ref?this.RouterDelegate.ref.getDeactivePageFocusName():null}returnFocusToParent(){const e=this.RouterDelegate.ref.getCurrentFocusNode();e?e.ReturnFocusToParent():console.warn("returnFocusToParent: current focus node is null.")}}class W{constructor(e,t){this._ChildMap={},this._FocusNameBeforeMount=null,this._BeforeMountStack=null,this._FocusNodeName=null,this._IsTemp=!!e,this.NameSpace=t}getDeactivePageFocusName(){return this._FocusNodeName}getCurrentFocusNode(e=!1){if(null==this._FocusNodeName)return null;let t=this._ChildMap[this._FocusNodeName];if(!t)return e||console.error("Erorr: node not mounted name="+this._FocusNodeName),null;if(t.RouterDelegate.ref!=this){let e=t.RouterDelegate.ref.getCurrentFocusNode();return null==e?t:e}return t}getNodeByName(e,t){let s=e.split(".");return this._FindRouterSearchBase(s,t)._GetNodeFromPathArray(s,e)}printAllFocusRecursive(e,t){let s=this.NameSpace==_?"":this.NameSpace,i=t+(t&&t.length>0?".":"")+s;for(let t in this._ChildMap){let s=this._ChildMap[t];if(!e||0==e.length||i.indexOf(e)>=0){let e=i===_?t:i+"."+t;console.log(e,s)}s.RouterDelegate.ref!=this&&s.RouterDelegate.ref.printAllFocusRecursive(e,i)}}_FindRouterSearchBase(e,t){if(0==e[0].length){let t,s;for(let e in this._ChildMap){t=this._ChildMap[e];break}do{s=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),s.RouterDelegate.ref}return t&&t.AsHub&&t.GetParentPage()?t.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(e,t){let s=0,i=this;for(;s<e.length-1;){let n=!1;for(let t in i._ChildMap){let o=i._ChildMap[t].RouterDelegate.ref;if(o!=i&&o.NameSpace==e[s]){i=o,s++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${t}`)}let n=e[s];return i._ChildMap.hasOwnProperty(n)?i._ChildMap[n]:void console.error(`Error: no found fname=${t}`)}add(e,t){if(e.indexOf(".")>=0)console.error("ERROR: FDiv name can not contains '.'");else if(this._ChildMap.hasOwnProperty(e)&&this._ChildMap[e]!==t)console.error(`ERROR: FDiv router branch name duplicated:[${e}]`);else if(this._ChildMap[e]=t,this._FocusNameBeforeMount)if("string"==typeof this._FocusNameBeforeMount)this._FocusNameBeforeMount==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount,!1,this._BeforeMountStack);else{this._FocusNameBeforeMount[0]==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1),!1,this._BeforeMountStack)}}remove(e,t,s,i){let n=this._ChildMap[e];n&&n==t&&(delete this._ChildMap[e],n.OnRemoveFromTree()),this._FocusNodeName==e&&s&&(i||(this._FocusNodeName=s))}rename(e,t){if(!this._ChildMap.hasOwnProperty(e))return void console.error(`ERROR: alter name failed ${e}->${t}`);let s=this._ChildMap[e];delete this._ChildMap[e],this.add(t,s),this._FocusNodeName==e&&(this._FocusNodeName=t)}clearChildFocus(){this._FocusNodeName=null,this._FocusNameBeforeMount=null}hasPendingFocusRequest(){return!this._FocusNameBeforeMount}focusBeforeMount(e,t,s){if(O)if(s){if(!s.originFStack){let e=this.getCurrentFocusNode(!0);s.originFStack="Mark1:",s.originFStack+=e?B(e):`NoFocus[focusSet:${this._FocusNodeName} notMountFocus:${this._FocusNameBeforeMount}]`}}else console.error(j,`Error: found debug info missing from ${new Error("simulate-stack").stack}`);let i=!1;if("string"==typeof e){if(!e.includes(".")){i=!0;let n=this._ChildMap[e];if(this._FocusNodeName=e,n){this._FocusNameBeforeMount=null,this._BeforeMountStack=s,n.Focus(!t);let e=n.GetFocusChild();for(;e;){let t=e.GetFocusChild();if(!t){this._FocusNodeName=e.BranchName;break}e=t}return O&&A(e??n,s),n.RouterDelegate.ref!=this&&n.RouterDelegate.ref.clearChildFocus(),!0}return this._FocusNameBeforeMount=e,this._BeforeMountStack=s,!1}console.error("error: name contain .")}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(i=!0,1==e.length)return this.focusBeforeMount(e[0],t,s);{let i=e[0],n=this._ChildMap[i];return this._FocusNodeName=i,n?n.RouterDelegate.ref.focusBeforeMount(e.slice(1),t,s):(this._FocusNameBeforeMount=e,this._BeforeMountStack=s,!1)}}return i||console.error("illegal name param",e),!1}focus(e,t,s){let i=this.focusBeforeMount(e,t,s);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 z extends T.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.AsHub=!1,this.InterfaceHub=null,this._TmpRouter=null,this._AutoShow=null,this.BranchName=e,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}async waitMounted(){if(this._Mounted)return;let e=this;return new Promise(((t,s)=>{e._MountWaitingList||(e._MountWaitingList=[]),e._MountWaitingList.push(t)}))}updateMountState(){this._Mounted=!0;let e=this.SubPages;for(let t in e)e[t].updateMountState();if(this._MountWaitingList&&this._MountWaitingList.length>0){for(const e of this._MountWaitingList)e();this._MountWaitingList=null}}getHub(){return this.InterfaceHub||(this.InterfaceHub=new V(!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 W(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}routerUnbind(e,t){let s;this.AsHub?this.GetParentPage()&&(s=this.GetParentPage().RouterDelegate.ref):s=this.RouterDelegate.ref,s&&s.remove(this.BranchName,this,e,t),this.RouterDelegate={ref:null}}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}static safeCallback(e){return e&&e instanceof Function?function(...t){try{return e(...t)}catch(t){console.error("FocusNode: callback error",e.name,t)}}:null}setOnKeyDown(e){this._OnKeyDown=z.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=z.safeCallback(e)}setOnFocus(e){this._OnFocus=z.safeCallback(e)}setOnBlur(e){this._OnBlur=z.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=z.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=z.safeCallback(e)}setOnCustomEvent(e){this._OnCustomEvent=z.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=z.safeCallback(e),this._DKeyUpProxy=z.safeCallback(t)}requestFocus(e){let t=null;O&&(t={askName:this.BranchName,deepToChild:e,from:"requestFocus",stack:J?new Error("simulate-stack").stack:null}),this.requestFocusInner(e,t)}ReturnFocusToParent(){if(this.IsFocus()){let e=this.GetParentPage();if(e){const t=e.BranchName;let s=null;O&&(s={askName:t,deepToChild:!1,from:"returnFocusToParent",stack:J?new Error("simulate-stack").stack:null}),e.RouterDelegate.ref.focus(t,!1,s)}}else super.ReturnFocusToParent()}requestFocusInner(e,t){let s=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(s=this.GetParentPage().RouterDelegate.ref),s?s.focus(this.BranchName,e,t):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomEvent(e){return!!this._OnCustomEvent&&this._OnCustomEvent(e)}bubbleCustomEvent(e){this.BubbleCustomEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return 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(),G()),e instanceof z)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let t=this.RouterDelegate.ref;this.RouterDelegate.ref=null,t.forEach(((t,s)=>{e.routerAdd(s,t)}))}e.routerAdd(this.BranchName,this)}}focus(e){this.Focus(e)}Focus(e){if(!this._Mounted)return z.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(){z.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(e){z.sLastFocus==this&&(z.sLastFocus=null);let t=this.IsFocus();if(O&&t){let t=this.GetParentPage();if(t){let s=null;s={askName:t.BranchName,deepToChild:!1,from:e?"deactive":"unmount",stack:J?new Error("simulate-stack").stack:null,originFStack:"Mark2:"+B(this)},A(t,s)}}let s=this.GetParentPage();s&&s.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind(s?.BranchName,e),this._Mounted=!1}getFullName(){let e=this,t=[this.RouterDelegate.ref.NameSpace];this.AsHub||t.push(this.BranchName);let s=this.RouterDelegate.ref;do{if(e=e.GetParentPage(),t[0]==_)break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return t[0]==_?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}z.sFocusMemos=[],z.sLastFocus=null,z.sRootPageNode=null;let G=()=>{let e=z.sFocusMemos.length;if(e>0){let t=z.sFocusMemos;z.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},U={};class K{constructor(e,t,s){this._Element=s,U.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),U[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),t.attachToActivity(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.RootView)}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),G()}}class H extends L{constructor(){super(L.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new N(t).href,this.jsvClientSizeStore={}}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&S.Dom.SetElementAttribute(this.jsvNativeId,e,t)}jsvOnEvent(e,...s){let i;super.jsvOnEvent(e,...s),"load"==e&&(i=new t(e),i.target=this),i&&this.dispatchEvent(i)}}class $ extends L{constructor(){super(L.JsvTagName.Link)}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new N(this.href);console.log("Ignore to load link from url="+s.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,s){if(console.log("Load link result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}}class q extends L{constructor(){super(L.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new N(this.src);console.log("Load script with url="+e.href);var t=this;window.JsView.runJsWithUrl(e.href,!1,((e,s)=>{t.jsvOnLoadResult(e,s)}))}}jsvOnLoadResult(e,s){if(console.log("Load script result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}}class X extends L{constructor(){super(L.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class Y extends L{constructor(){super(L.JsvTagName.Svg)}}class Z extends C{constructor(e){super(C.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let Q=1;class ee extends L{constructor(){super(L.JsvTagName.JsvFDiv),this.FocusNodeRef=new z("unnamed-"+Q++),this.hubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.hubRef){let e=new V(!1,t);this.hubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.hubRef}}class te extends C{constructor(){super(C.DOCUMENT_NODE),this.location=window.location,this.rootElement=new M,this.rootElement.ownerDocument=this,this.rootElement.id="root",S.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new R(e)}createElement(e){switch(e=e.toUpperCase()){case L.JsvTagName.Anchor:return new P;case L.JsvTagName.Div:return new M;case L.JsvTagName.Image:return new H;case L.JsvTagName.Link:return new $;case L.JsvTagName.Script:return new q;case L.JsvTagName.Style:return new X;case L.JsvTagName.Svg:return new Y;case L.JsvTagName.JsvFDiv:return new ee;case L.JsvTagName.IFrame:console.error("Unsupported element: "+e+". Your vue compilation may may have failed, please check it first.")}if("TEMPLATE"==e)return{};throw new TypeError("Unimplemented element: "+e)}createEvent(e){return"CUSTOMEVENT"===(e=e.toUpperCase())?new i(e):new t(e)}createTextNode(e){return new Z(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMException("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===L.JsvTagName.Head)return[this.head];if(e===L.JsvTagName.Link||e===L.JsvTagName.Script||e===L.JsvTagName.Style)return[];throw new DOMException("Failed to get element by name, 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("title"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMException("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=this.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new K(e,t,s)}}class se extends L{constructor(){super(L.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof $||e instanceof q)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class ie{constructor(){this.ready=!1,this.callbacks=[]}listenToReady(e){this.ready?e?.():this.callbacks.push(e)}dataReady(){this.ready=!0;for(let e of this.callbacks)e?.()}}class ne extends ie{constructor(){super(),this.TextureManager=null,this.RootActivity=null,this.RootView=null}setHandles(e,t,s){this.TextureManager=e,this.RootActivity=s,this.RootView=t,this.dataReady()}}let oe="@keyframes";class re{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.getName(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),S.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),S.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}getName(e){let t=e.indexOf(oe)+10,s=e.indexOf("{");return e.substring(t,s).trim()}}let ae=null;function le(e){return ae||(ae={global:new re("global")}),ae.global}class he{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,he.EnsureGlobalJsvCode(e,t),L.JsvEnableEventListener(),b.JsvDeclarePrototype()}static EnsureGlobalJsvCode(e,t){window.JsvCode.Dom||(window.JsvCode.Dom={}),window.JsvCode.Media||(window.JsvCode.Media={}),window.JsvCode.Dom.PlatformBridge||(window.JsvCode.Dom.PlatformBridge=e),window.JsvCode.Media.PlatformBridge||(window.JsvCode.Media.PlatformBridge=t),window.JsvCode.Dom.DeclareStyleSheets||(window.JsvCode.Dom.DeclareStyleSheets=S.Dom.DeclareStyleSheets),window.JsvCode.Dom.UndeclareStyleSheets||(window.JsvCode.Dom.UndeclareStyleSheets=S.Dom.UndeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=le),window.JsvCode.Dom.GetLazyTaskAmount||(window.JsvCode.Dom.GetLazyTaskAmount=S.Dom.GetLazyTaskAmount),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new ne)}}class ce{static SetLevel(e){switch(ce.E=ce.W=ce.I=ce.D=function(){},e){case ce.Level.Verbose:ce.V=console.debug.bind(console);case ce.Level.Debug:ce.D=console.debug.bind(console);case ce.Level.Info:ce.I=console.info.bind(console)}}}ce.E=console.error.bind(console),ce.W=console.warn.bind(console),ce.I=console.info.bind(console),ce.D=function(){},ce.V=function(){},ce.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class de{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof C))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}}class ue extends te{constructor(){super(),this.head=new se}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}class ve{static DeclareGlobal(){ve.DeclareDocument(),ve.DeclareOthers(),ve.DeclareAddition()}static DeclareDocument(){window.document=new ue}static DeclareOthers(){window.MutationObserver=de,window.Element=L,window.SVGElement=Y;let e=new N(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.history={},window.navigator={userAgent:"jsview-runtime",platform:"jsview"}}static DeclareAddition(){window.JsView.Dom={Render:null,Extension:null,UrlRef:N}}}class me{constructor(e){this.activity=new T.ReactActivity("NativeForgeActivity",e,null,null),this.init()}init(){console.log("create NativeForgeActivity.");let e=new T.LayoutView;window.JsvCode.ForgeHandles.setHandles(this.activity.GetTextureManager(),e,this.activity);let t=null;T.DesignMap&&(t=T.DesignMap());let s=t?t.width:1280,i=Math.floor(9*s/16);this.activity.SetContentView(e,{x:0,y:0,width:s,height:i}),T.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{S.Dom.RequestSwapAllCachedTasks()})),window.JsView.Dom.Render()}}class fe{constructor(e){this.activityManager=e;let t=new me(e);e.RegisterActivity(t.activity),e.StartActivity(new T.Intent("NativeForgeActivity"))}}window.jsvIsBrowserDebug=!1;const ge=window.JsvCode.NativePlatformDomBridge,pe=window.JsvCode.NativePlatformMediaBridge;function ye(){he.EnsureGlobalEnv(ge,pe),ve.DeclareGlobal(),ce.I("Using JsView Native Environment.")}export{ye as InitEnv,fe as NativeForgeApp};
2
2