@shijiu/jsview 2.2.373 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dom/bin/DroidNaskh-Regular.ttf +0 -0
- package/dom/bin/DroidSans.ttf +0 -0
- package/dom/bin/DroidSansFallback.ttf +0 -0
- package/dom/bin/NotoColorEmoji.ttf +0 -0
- package/dom/bin/jsview-dom-browser-engine-core.min.js +2 -0
- package/dom/bin/jsview-dom-browser-engine-modules.min.js +2 -0
- package/dom/bin/jsview-dom-browser-forge.1436.54c9.wasm +0 -0
- package/dom/bin/jsview-dom-browser-forge.min.js +1 -0
- package/dom/bin/jsview-dom-browser-forge.worker.min.js +1 -0
- package/dom/bin/jsview-dom-browser.min.js +1 -1
- package/dom/bin/jsview-dom-native.min.js +1 -1
- package/dom/bin/jsview-engine-js-browser.min.js +1 -22
- package/dom/bin/jsview-engine-js-native.min.js +1 -1
- package/dom/bin/jsview-forge-define.min.js +1 -1
- package/dom/index.mjs +8 -10
- package/dom/target_core_revision.mjs +3 -3
- package/loader/jsv-core-api/jsview-core-api-glue.js +74 -0
- package/loader/jsv-core-api/wasm/backgroundtask.js +66 -0
- package/loader/jsv-core-api/wasm/core-api.js +208 -0
- package/loader/jsv-core-api/wasm/wasm-extension.js +37 -0
- package/loader/jsview-config.js +4 -1
- package/loader/jsview-loader.js +67 -77
- package/loader/jsview-main.mjs +1 -1
- package/package.json +1 -1
- package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +67 -6
- package/tools/https-server-config/cert.pem +61 -0
- package/tools/https-server-config/key.pem +27 -0
- package/tools/https-server-config/serve.config.json +16 -0
- package/tools/jsview-common.mjs +86 -3
- package/tools/jsview-post-build.mjs +153 -3
- package/tools/jsview-post-install.mjs +7 -4
- package/tools/jsview-retrieve-sourcemap.mjs +64 -49
- package/tools/jsview-run-tool.mjs +88 -10
|
@@ -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}}if(void 0===window.Forge)throw new Error("Error: EngineJs missing");var n,o,r,a,l,c,h,d,u,v,m,f,p,g,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:!0===e.startsWith("./")&&void 0!==window.JsView&&(e=window.location.jsvGetLocation()+e.substring(2)),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.TaskType.CreateElement,e,t)}static BindElementToRootView(e){D.PushLazyTask(D.TaskType.BindElementToRootView,e)}static InsertElementChild(e,t,s){D.PushLazyTask(D.TaskType.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){D.PushLazyTask(D.TaskType.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){D.PushLazyTask(D.TaskType.MoveElementChild,e,t,s,i)}static ReOrderElementChild(e,t,s){D.PushLazyTask(D.TaskType.ReOrderElementChild,e,t,s)}static AddElementEventListener(e,t,s){D.PushLazyTask(D.TaskType.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){D.PushLazyTask(D.TaskType.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){D.PushLazyTask(D.TaskType.SetElementText,e,t)}static SetElementAttribute(e,t,s){D.PushLazyTask(D.TaskType.SetElementAttribute,e,t,s),D.LazyTaskSyncedListenerMap.has(e)&&D.CachedSyncListenIdSet.add(e)}static GetElementBoundingClientStyles(e,t){return D.RunSyncTask(D.TaskType.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")?(i=1,t=t.substr(5)):t.startsWith("mmask")&&(i=2,t=t.substr(6)),D.PushLazyTask(D.TaskType.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){D.PushLazyTask(D.TaskType.DeclareStyleSheets,-1,e)}static UndeclareStyleSheets(e){D.PushLazyTask(D.TaskType.UndeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){D.PushLazyTask(D.TaskType.SetStyleProperty,e,t,s),D.LazyTaskSyncedListenerMap.has(e)&&D.CachedSyncListenIdSet.add(e)}static GetStyleProperties(e,t){return D.RunSyncTask(D.TaskType.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.TaskType.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){D.PushLazyTask(D.TaskType.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){D.PushLazyTask(D.TaskType.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=D.RunSyncTask(D.TaskType.GetRelativePosition,e,t);return JSON.parse(s)}static SearchNextFocus(e,t){return D.RunSyncTask(D.TaskType.SearchNextFocus,e,t)}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.TaskType.SetStyleProperty?i=2:e==D.TaskType.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.TaskType={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,SearchNextFocus:23,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,UndeclareStyleSheets:39,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42};class C{}C.Dom=D,C.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 E{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})}E.ELEMENT_NODE=1,E.TEXT_NODE=3,E.COMMENT_NODE=8,E.DOCUMENT_NODE=9,E.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(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=(x(h=class extends F.Base{constructor(e){super(e),this.type=0,this.urlPath=""}},"BackgroundImageImpl"),h.eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2},h.LinearGradient=class{constructor(){this.fromX=0,this.fromY=0,this.toX=0,this.toY=0,this.stops=[]}},h),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(p=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"),p.Name="effect",x(g=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"),g.Name="text",x(y=class{constructor(){this.animation=F.InvalidPointer,this.transition=F.InvalidPointer,this.animationFillMode="none"}},"Motion"),y.Name="motion";class k{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(k.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);C.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=C.Dom.GetStyleProperties(this.nativeId,t);return JSON.parse(s)}}class b 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 E{static JsvEnableEventListener(){C.Dom.EnableEventListener((function(e,t,...s){let i=L.JsvEventListenerMap.get(e);const n=i?.get(t);n?.(t,...s)}))}constructor(e){super(E.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=S.GenerateId(),this.style=new k(this.jsvNativeId),C.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&&C.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),C.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),C.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=C.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvClientSizeStore.clientWidth}get clientHeight(){return this.jsvClientSizeStore.clientHeight||(this.jsvClientSizeStore.clientHeight=C.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvClientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?C.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?C.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&C.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&&C.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=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})}))}jsvSetTapListener(e,t=0){let s=this.jsvGetProxyView(!0);if(!e)return s.DragEnables(0),void s.SetTapListener(null);e.onClick&&(t|=1),(e.onLongPress||e.onLongPressRelease)&&(t|=2),e.onTouchStart&&(t|=8),e.onTouchEnd&&(t|=16),s.DragEnables(t),s.SetTapListener(((t,s)=>{switch(t){case w.Cancel:e.onCancel?.(s);break;case w.LongPress:e.onLongPress?.(s);break;case w.LongPressRelease:e.onLongPressRelease?.(s);break;case w.Click:e.onClick?.(s);break;case w.touchFirstStart:e.onTouchStart?.(s);break;case w.touchLastEnd:e.onTouchEnd?.(s);break;default:console.error("Error:onTap unknown type:"+t)}}))}jsvSetOnLazyTaskSyncedListener(e){C.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 b(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 C.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),C.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}jsvReOrderChildNode(e,t){e.jsvNativeId&&(t=L.JsvFindBackwardForgeView(t),C.Dom.ReOrderElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvInsertChild(e,t){e.parentNode=this,e.nodeType===E.TEXT_NODE?this.textContent=e.nodeValue:e instanceof L&&e.jsvNativeId>0&&(t=L.JsvFindBackwardForgeView(t),C.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(),C.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 E{constructor(e){super(E.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={},C.Dom.SetElementText(this.jsvNativeId,e)}}const j="FocusDebug",_="__AppRoot__";let O=!1,A=!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 J(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 W{constructor(e,t){this._DefaultFocusNameSpace=null,this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new V(!1,t))}enableFocusTrace(e){O=!0,A=e}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==_?"":e}wrapWithNameSpace(e){let t=new W(!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:A?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 G;){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(G.sLastFocus){let e=G.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}getCurrentFocusNode(){return this.RouterDelegate.ref?.getCurrentFocusNode()}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 V{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&&J(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 G extends T.PageBase{constructor(e,t){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.NativeId=-1,this.BranchName=e,this.NativeId=t,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1,G.sFocusNodeMap.set(this.NativeId,this)}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 W(!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 V(!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;let s=this.GetParentPage();s&&s.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=G.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=G.safeCallback(e)}setOnFocus(e){this._OnFocus=G.safeCallback(e)}setOnBlur(e){this._OnBlur=G.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=G.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=G.safeCallback(e)}setOnCustomEvent(e){this._OnCustomEvent=G.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=G.safeCallback(e),this._DKeyUpProxy=G.safeCallback(t)}requestFocus(e){let t=null;O&&(t={askName:this.BranchName,deepToChild:e,from:"requestFocus",stack:A?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:A?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.GetParentPage()._Mounted&&(this.updateMountState(),K()),e instanceof G)){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 G.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(){G.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(e){G.sFocusNodeMap.delete(this.NativeId),G.sLastFocus==this&&(G.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:A?new Error("simulate-stack").stack:null,originFStack:"Mark2:"+B(this)},J(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)}}G.sFocusMemos=[],G.sLastFocus=null,G.sRootPageNode=null,G.sFocusNodeMap=new Map;let K=()=>{let e=G.sFocusMemos.length;if(e>0){let t=G.sFocusMemos;G.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}};class z extends t{constructor(e){super(e),this.keyCode=-1,this.key=-1,this.repeat=0,this.keyCode=-1,this.key=-1,this.repeat=0}}z.KeyCode={Enter:13,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40};let U={};class H{constructor(e,t,s){this._AutoSearchFocus=!1,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.setOnKeyDown((e=>{if(!this._AutoSearchFocus)return!1;switch(e.keyCode){case z.KeyCode.ArrowLeft:case z.KeyCode.ArrowUp:case z.KeyCode.ArrowRight:case z.KeyCode.ArrowDown:const t=this.getHub().getCurrentFocusNode();if(t){const s=C.Dom.SearchNextFocus(t.NativeId,e.keyCode),i=G.sFocusNodeMap.get(s);if(i)return this.getHub().setFocus(i.getFullName()),!0}}return!1})),t.attachToActivity(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.RootView)}enableAutoSearchFocus(e){this._AutoSearchFocus=e}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),K()}}class $ 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&&C.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 q 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 X 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 Y extends L{constructor(){super(L.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class Z extends L{constructor(){super(L.JsvTagName.Svg)}}class Q extends E{constructor(e){super(E.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let ee=1;class te extends L{constructor(){super(L.JsvTagName.JsvFDiv),this.FocusNodeRef=new G("unnamed-"+ee++,this.jsvNativeId),this.hubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e){if(""!==t&&!this.hubRef){let e=new W(!1,t);this.hubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}else super.setAttribute(e,t)}removeAttribute(e){}jsvGetHub(){return this.hubRef}}class se extends E{constructor(){super(E.DOCUMENT_NODE),this.location=window.location,this.rootElement=new M,this.rootElement.ownerDocument=this,this.rootElement.id="root",C.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 $;case L.JsvTagName.Link:return new q;case L.JsvTagName.Script:return new X;case L.JsvTagName.Style:return new Y;case L.JsvTagName.Svg:return new Z;case L.JsvTagName.JsvFDiv:return new te;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 Q(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 H(e,t,s)}}class ie extends L{constructor(){super(L.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof q||e instanceof X)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class ne{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 oe extends ne{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 re="@keyframes";class ae{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),C.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),C.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(re)+10,s=e.indexOf("{");return e.substring(t,s).trim()}}let le=null;function ce(e){return le||(le={global:new ae("global")}),le.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(),k.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=C.Dom.DeclareStyleSheets),window.JsvCode.Dom.UndeclareStyleSheets||(window.JsvCode.Dom.UndeclareStyleSheets=C.Dom.UndeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=ce),window.JsvCode.Dom.GetLazyTaskAmount||(window.JsvCode.Dom.GetLazyTaskAmount=C.Dom.GetLazyTaskAmount),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new oe)}}class de{static SetLevel(e){switch(de.E=de.W=de.I=de.D=function(){},e){case de.Level.Verbose:de.V=console.debug.bind(console);case de.Level.Debug:de.D=console.debug.bind(console);case de.Level.Info:de.I=console.info.bind(console)}}}de.E=console.error.bind(console),de.W=console.warn.bind(console),de.I=console.info.bind(console),de.D=function(){},de.V=function(){},de.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class ue{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof E))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 ve extends se{constructor(){super(),this.head=new ie}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}class me{static DeclareGlobal(){me.DeclareDocument(),me.DeclareOthers(),me.DeclareAddition()}static DeclareDocument(){window.document=new ve}static DeclareOthers(){window.MutationObserver=ue,window.Element=L,window.SVGElement=Z;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 fe{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",(()=>{C.Dom.RequestSwapAllCachedTasks()})),window.JsView.Dom.Render()}}class pe{constructor(e){this.activityManager=e;let t=new fe(e);e.StartActivity(t.activity)}}window.jsvIsBrowserDebug=!1;const ge=window.JsvCode.NativePlatformDomBridge,ye=window.JsvCode.NativePlatformMediaBridge;function we(){he.EnsureGlobalEnv(ge,ye),me.DeclareGlobal(),de.I("Using JsView Native Environment.")}export{we as InitEnv,pe 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}}if(void 0===window.Forge)throw new Error("Error: EngineJs missing");var n,o,r,a,l,c,h,d,u,v,m,f,g,p,w,y,T=window.Forge;window.JsvCoreApi.setForgeJsHandle(T);class N{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){N.PushLazyTask(N.TaskType.CreateElement,e,t)}static BindElementToRootView(e){N.PushLazyTask(N.TaskType.BindElementToRootView,e)}static InsertElementChild(e,t,s){N.PushLazyTask(N.TaskType.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){N.PushLazyTask(N.TaskType.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){N.PushLazyTask(N.TaskType.MoveElementChild,e,t,s,i)}static ReOrderElementChild(e,t,s){N.PushLazyTask(N.TaskType.ReOrderElementChild,e,t,s)}static AddElementEventListener(e,t,s){N.PushLazyTask(N.TaskType.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){N.PushLazyTask(N.TaskType.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){N.PushLazyTask(N.TaskType.SetElementText,e,t)}static SetElementAttribute(e,t,s){N.PushLazyTask(N.TaskType.SetElementAttribute,e,t,s),N.LazyTaskSyncedListenerMap.has(e)&&N.CachedSyncListenIdSet.add(e)}static GetElementBoundingClientStyles(e,t){return N.RunSyncTask(N.TaskType.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")?(i=1,t=t.substr(5)):t.startsWith("mmask")&&(i=2,t=t.substr(6)),N.PushLazyTask(N.TaskType.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){N.PushLazyTask(N.TaskType.DeclareStyleSheets,-1,e)}static UndeclareStyleSheets(e){N.PushLazyTask(N.TaskType.UndeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){N.PushLazyTask(N.TaskType.SetStyleProperty,e,t,s),N.LazyTaskSyncedListenerMap.has(e)&&N.CachedSyncListenIdSet.add(e)}static GetStyleProperties(e,t){return N.RunSyncTask(N.TaskType.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){N.LazyTaskSyncedListenerMap.set(e,t)}static RemoveLazyTaskSyncedListener(e){N.LazyTaskSyncedListenerMap.delete(e)}static RequestSwapAllCachedTasks(){if(0==N.CachedLazyTaskList.length)return;const e=JSON.stringify(N.CachedLazyTaskList);N.CachedLazyTaskList=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e),N.CachedLazyTaskAmount=0;for(const e of N.CachedSyncListenIdSet){const t=N.LazyTaskSyncedListenerMap.get(e);t?.()}N.CachedSyncListenIdSet.clear()}static GetElementAttribute(e,t){return N.RunSyncTask(N.TaskType.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){N.PushLazyTask(N.TaskType.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){N.PushLazyTask(N.TaskType.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=N.RunSyncTask(N.TaskType.GetRelativePosition,e,t);return JSON.parse(s)}static SearchNextFocus(e,t){return N.RunSyncTask(N.TaskType.SearchNextFocus,e,t)}static GetLazyTaskAmount(){return 0}static RunSyncTask(e,t,...s){N.RequestSwapAllCachedTasks(),console.log("RunSyncTask()"+window.NativeMicroTime());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==N.TaskType.SetStyleProperty?i=2:e==N.TaskType.DeclareStyleSheets&&(i=3),N.CachedLazyTaskAmount+=i,N.CachedLazyTaskList.push([e,t,...s]),T.sRenderBridge?.RequestSwap()}}N.CachedLazyTaskAmount=0,N.CachedLazyTaskList=new Array,N.CachedSyncListenIdSet=new Set,N.LazyTaskSyncedListenerMap=new Map,N.TaskType={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,SearchNextFocus:23,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,UndeclareStyleSheets:39,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42};class D{}D.Dom=N,D.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 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 E(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=(E(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=(E(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=(E(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=(E(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=(E(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=(E(c=class{constructor(){throw new Error("new StyleName.Motion() is forbidden.")}},"Motion"),c.Animation="animation",c.Transition="transition",c.AnimationFillMode="animationFillMode",c);class x{constructor(e){let t=-1,s=null;null==e?t=x.DataType.Null:Number(e)===e&&e%1==0?t=x.DataType.Int32:Number(e)===e&&e%1!=0?t=x.DataType.Float:"string"==typeof e||e instanceof String?t=x.DataType.String:e instanceof x.AnimationImpl?t=x.DataType.Animation:e instanceof x.CornerImpl?t=x.DataType.Corner:e instanceof x.RectImpl?t=x.DataType.Rect:e instanceof x.TextShadowImpl?t=x.DataType.TextShadow:e instanceof x.WebkitTextStrokeImpl?t=x.DataType.WebkitTextStroke:e instanceof x.TransitionImpl?t=x.DataType.Transition:e instanceof x.BorderImageImpl&&(t=x.DataType.BorderImage),e!=x.InvalidInt32&&e!=x.InvalidFloat&&e!=x.InvalidPointer?s=e:(t=x.DataType.Null,s=null),this.data=new x.DataInfo,this.data.index=t,this.data.value=s}toString(){let e=null;switch(this.data.index){case x.DataType.Null:return"";case x.DataType.Int32:case x.DataType.Float:return String(this.get());case x.DataType.String:e=this.get();break;case x.DataType.Animation:case x.DataType.Corner:case x.DataType.Rect:case x.DataType.TextShadow:case x.DataType.WebkitTextStroke:case x.DataType.Transition:case x.DataType.BorderImage:case x.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}}x.Base=class{constructor(e){this.rawValue=e}},x.AnimationImpl=class extends x.Base{constructor(e){super(e),this.name="",this.duration=0,this.timingFunction=null,this.delay=0,this.iterationCount=0,this.direction=!1}},x.CornerImpl=class extends x.Base{constructor(e){super(e),this.topLeft=0,this.topRight=0,this.bottomRight=0,this.bottomLeft=0}},x.RectImpl=class extends x.Base{constructor(e){super(e),this.top=0,this.right=0,this.left=0,this.bottom=0}},x.TextShadowImpl=class extends x.Base{constructor(e){super(e),this.hShadow=0,this.vShadow=0,this.blur=0,this.color=void 0}},x.WebkitTextStrokeImpl=class extends x.Base{constructor(e){super(e),this.length=0,this.color=void 0}},x.TransitionImpl=class extends x.Base{constructor(e){super(e),this.animationMap=new Map}},x.BorderImageImpl=class extends x.Base{constructor(e){super(e),this.source="",this.slice=null}},x.BackgroundImageImpl=(E(h=class extends x.Base{constructor(e){super(e),this.type=0,this.urlPath=""}},"BackgroundImageImpl"),h.eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2},h.LinearGradient=class{constructor(){this.fromX=0,this.fromY=0,this.toX=0,this.toY=0,this.stops=[]}},h),x.DataType=(E(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),x.InvalidInt32=Number.MIN_VALUE,x.InvalidFloat=Number.NaN,x.InvalidPointer=null,x.DataInfo=class{constructor(){this.value=null,this.index=-1}},E(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",E(v=class{constructor(){this.height=x.InvalidInt32,this.left=x.InvalidInt32,this.top=x.InvalidInt32,this.width=x.InvalidInt32}},"Layout"),v.Name="layout",E(m=class{constructor(){this.flexDirection=x.InvalidInt32,this.flexWrap=x.InvalidInt32,this.justifyContent=x.InvalidInt32,this.alignItems=x.InvalidInt32,this.alignContent=x.InvalidInt32,this.alignSelf=x.InvalidInt32,this.flexGrow=x.InvalidFloat}},"Flex"),m.Name="flex",E(f=class{constructor(){this.backgroundColor=x.InvalidPointer,this.backgroundImage=x.InvalidPointer,this.borderRadius=x.InvalidPointer,this.JsvImageBlendType=x.InvalidInt32}},"Background"),f.Name="background",E(g=class{constructor(){this.backfaceVisibility=x.InvalidPointer,this.borderImage=x.InvalidPointer,this.borderImageWidth=x.InvalidPointer,this.borderImageOutset=x.InvalidPointer,this.display=x.InvalidPointer,this.objectFit=x.InvalidPointer,this.opacity=x.InvalidFloat,this.overflow=x.InvalidPointer,this.perspective=x.InvalidInt32,this.perspectiveOrigin=x.InvalidPointer,this.transform=x.InvalidPointer,this.transformOrigin=x.InvalidPointer,this.transformStyle=x.InvalidPointer,this.visibility=x.InvalidPointer,this.zIndex=x.InvalidInt32}},"Effect"),g.Name="effect",E(p=class{constructor(){this.color=x.InvalidPointer,this.fontFamily=x.InvalidPointer,this.fontSize=x.InvalidInt32,this.fontStyle=x.InvalidPointer,this.fontWeight=x.InvalidPointer,this.lineHeight=x.InvalidInt32,this.textAlign=x.InvalidPointer,this.textOverflow=x.InvalidPointer,this.textShadow=x.InvalidPointer,this.webkitTextStroke=x.InvalidPointer,this.whiteSpace=x.InvalidPointer,this.wordWrap=x.InvalidPointer,this.direction=x.InvalidPointer,this.jsvTextEmoji=x.InvalidInt32,this.jsvTextLatex=x.InvalidInt32,this.jsvTextAlignMinWidth=x.InvalidInt32,this.jsvTextVerticalAlign=x.InvalidPointer,this.jsvTextLineAlign=x.InvalidPointer,this.jsvTextInnerDirection=x.InvalidPointer}},"Text"),p.Name="text",E(w=class{constructor(){this.animation=x.InvalidPointer,this.transition=x.InvalidPointer,this.animationFillMode="none"}},"Motion"),w.Name="motion";class F{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 k{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(k.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 F(t).href}else if(e==I.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new F(e[0]).href),t=e.join(" ")}else e==I.Effect.Display&&(this.cachedProps[e]=t);D.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=D.Dom.GetStyleProperties(this.nativeId,t);return JSON.parse(s)}}class b 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"}(y||(y={}));class P extends C{static JsvEnableEventListener(){D.Dom.EnableEventListener((function(e,t,...s){let i=P.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!=P.JsvTagName.Audio&&this.tagName!=P.JsvTagName.Div&&this.tagName!=P.JsvTagName.Image&&this.tagName!=P.JsvTagName.Video&&this.tagName!=P.JsvTagName.JsvFDiv||(this.jsvNativeId=S.GenerateId(),this.style=new k(this.jsvNativeId),D.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 P&&e.jsvNativeId>0&&D.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),D.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),D.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=D.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvClientSizeStore.clientWidth}get clientHeight(){return this.jsvClientSizeStore.clientHeight||(this.jsvClientSizeStore.clientHeight=D.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvClientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?D.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?D.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&D.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&&D.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=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})}))}jsvSetTapListener(e,t=0){let s=this.jsvGetProxyView(!0);if(!e)return s.DragEnables(0),void s.SetTapListener(null);e.onClick&&(t|=1),(e.onLongPress||e.onLongPressRelease)&&(t|=2),e.onTouchStart&&(t|=8),e.onTouchEnd&&(t|=16),s.DragEnables(t),s.SetTapListener(((t,s)=>{switch(t){case y.Cancel:e.onCancel?.(s);break;case y.LongPress:e.onLongPress?.(s);break;case y.LongPressRelease:e.onLongPressRelease?.(s);break;case y.Click:e.onClick?.(s);break;case y.touchFirstStart:e.onTouchStart?.(s);break;case y.touchLastEnd:e.onTouchEnd?.(s);break;default:console.error("Error:onTap unknown type:"+t)}}))}jsvSetOnLazyTaskSyncedListener(e){D.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 b(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 D.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}jsvAddListener(e,t){let s=P.JsvEventListenerMap.get(e);s||(s=new Map,P.JsvEventListenerMap.set(e,s));this.jsvGetEventListenerSet(t)||s.set(t,this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let s=P.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=P.JsvFindBackwardForgeView(s),D.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}jsvReOrderChildNode(e,t){e.jsvNativeId&&(t=P.JsvFindBackwardForgeView(t),D.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 P&&e.jsvNativeId>0&&(t=P.JsvFindBackwardForgeView(t),D.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvRemoveChild(e){if(e instanceof P!=0){for(const t of e.childNodes)e.jsvRemoveChild(t);e.jsvFinalize(),D.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),P.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 P);)t=t.nextSibling;return t}}P.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"},P.JsvEventListenerMap=new Map;class L extends P{constructor(){super(P.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 P.JsvTagName.Anchor}}class M extends C{constructor(e){super(C.COMMENT_NODE),this.textContent=e}}class R extends P{constructor(){super(P.JsvTagName.Div),this.textContentStore=null}get textContent(){return this.textContentStore}set textContent(e){this.textContentStore=e,this.jsvClientSizeStore={},D.Dom.SetElementText(this.jsvNativeId,e)}}const j="FocusDebug",_="__AppRoot__";let O=1,A=!1,J=!1,B=!1,V=[];function W(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 G(e,t){let s=W(e);if(null!=t){if(t.stack){let e=t.stack.split("\n");e.length>=3&&(t.stack=e.slice(2,6).join("\n"))}let e=t?.stack;t.stack=null,console.log(j,`focusChange(${t.from}):${t.askName}\n:originFocusStack:${t.originFStack}\n:focusStack:${s}\n:trace:${e}:`,t)}else console.log(j,`focusChange:${s} but empty debugSaveInfo`)}class K{constructor(e,t){this._DefaultFocusNameSpace=null,this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new z(!1,t))}enableFocusTrace(e){A=!0,J=e}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==_?"":e}wrapWithNameSpace(e){let t=new K(!0);return t._DefaultFocusNameSpace=e,t.RouterDelegate=this.RouterDelegate,t}getNodeByName(e,t){return this.RouterDelegate.ref.getNodeByName(e,t)}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;A&&(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 U;){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(U.sLastFocus){let e=U.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}getCurrentFocusNode(){return this.RouterDelegate.ref?.getCurrentFocusNode()}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 z{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=null;for(let e in this._ChildMap){t=this._ChildMap[e];break}if(null!=t){let s;do{s=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),s.RouterDelegate.ref}return null}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(null!=o&&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(A)if(null==s)console.error(j,`Error: found debug info missing from ${new Error("simulate-stack").stack}`);else if(!s.originFStack){let e=this.getCurrentFocusNode(!0);s.originFStack="Mark1:",s.originFStack+=e?W(e):`NoFocus[focusSet:${this._FocusNodeName} notMountFocus:${this._FocusNameBeforeMount}]`}if(B){let i=this;return V.push((()=>{i.focusBeforeMount(e,t,s)})),!0}B=!0;try{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 A&&G(e??n,s),n.RouterDelegate.ref!=this&&n.RouterDelegate.ref.clearChildFocus(),!0}return this._FocusNameBeforeMount=e,this._BeforeMountStack=s,A&&function(e,t){if(null!=t){if(t.stack){let e=t.stack.split("\n");e.length>=3&&(t.stack=e.slice(2,6).join("\n"))}let s=t?.stack;t.stack=null,console.log(j,`focusChange(wait-mount)(${t.from}):${t.askName}\n:originFocusStack:${t.originFStack}\n:focusName:${e}\n:trace:${s}:`,t)}else console.log(j,`focusChange(wait-mount):${e} but empty debugSaveInfo`)}(e,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)}}i||console.error("illegal name param",e)}finally{B=!1;let e=V.length;if(e>0){let t=O++;A&&console.log(j,`stash onFocus pop start(token=${t}) len=${e}`);let s=V;V=[];for(let t=0;t<e;t++)s[t]();A&&console.log(j,`stash onFocus pop done(token=${t})`)}}return!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 U extends T.PageBase{constructor(e,t){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.NativeId=-1,this.BranchName=e,this.NativeId=t,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1,U.sFocusNodeMap.set(this.NativeId,this)}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 K(!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 z(!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;let s=this.GetParentPage();s&&s.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=U.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=U.safeCallback(e)}setOnFocus(e){this._OnFocus=U.safeCallback(e)}setOnBlur(e){this._OnBlur=U.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=U.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=U.safeCallback(e)}setOnCustomEvent(e){this._OnCustomEvent=U.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=U.safeCallback(e),this._DKeyUpProxy=U.safeCallback(t)}requestFocus(e){let t=null;A&&(t={askName:this.BranchName,deepToChild:e,from:"requestFocus",stack:J?new Error("simulate-stack").stack:null,originFStack:null}),this.requestFocusInner(e,t)}ReturnFocusToParent(){if(this.IsFocus()){let e=this.GetParentPage();if(e){const t=e.BranchName;let s=null;A&&(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.GetParentPage()._Mounted&&(this.updateMountState(),H()),e instanceof U)){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 U.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(){U.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(e){U.sFocusNodeMap.delete(this.NativeId),U.sLastFocus==this&&(U.sLastFocus=null);let t=this.IsFocus();if(A&&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:"+W(this)},G(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)}}U.sFocusMemos=[],U.sLastFocus=null,U.sRootPageNode=null,U.sFocusNodeMap=new Map;let H=()=>{let e=U.sFocusMemos.length;if(e>0){let t=U.sFocusMemos;U.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}};class $ extends t{constructor(e){super(e),this.keyCode=-1,this.key=-1,this.repeat=0,this.keyCode=-1,this.key=-1,this.repeat=0}}$.KeyCode={Enter:13,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40};let q={};class X{constructor(e,t,s){this._AutoSearchFocus=!1,this._Element=s,q.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),q[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.setOnKeyDown((e=>{if(!this._AutoSearchFocus)return!1;switch(e.keyCode){case $.KeyCode.ArrowLeft:case $.KeyCode.ArrowUp:case $.KeyCode.ArrowRight:case $.KeyCode.ArrowDown:const t=this.getHub().getCurrentFocusNode();if(t){const s=D.Dom.SearchNextFocus(t.NativeId,e.keyCode),i=U.sFocusNodeMap.get(s);if(i)return this.getHub().setFocus(i.getFullName()),!0}}return!1})),t.attachToActivity(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.RootView)}enableAutoSearchFocus(e){this._AutoSearchFocus=e}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),H()}}class Y extends P{constructor(){super(P.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new F(t).href,this.jsvClientSizeStore={}}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&D.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 Z extends P{constructor(){super(P.JsvTagName.Link)}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new F(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 P{constructor(){super(P.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new F(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 ee extends P{constructor(){super(P.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class te extends P{constructor(){super(P.JsvTagName.Svg)}}class se 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 ie=1;class ne extends P{constructor(){super(P.JsvTagName.JsvFDiv),this.FocusNodeRef=new U("unnamed-"+ie++,this.jsvNativeId),this.hubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e){if(""!==t&&!this.hubRef){let e=new K(!1,t);this.hubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}else super.setAttribute(e,t)}removeAttribute(e){}jsvGetHub(){return this.hubRef}}class oe extends C{constructor(){super(C.DOCUMENT_NODE),this.location=window.location,this.rootElement=new R,this.rootElement.ownerDocument=this,this.rootElement.id="root",D.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 P.JsvTagName.Anchor:return new L;case P.JsvTagName.Div:return new R;case P.JsvTagName.Image:return new Y;case P.JsvTagName.Link:return new Z;case P.JsvTagName.Script:return new Q;case P.JsvTagName.Style:return new ee;case P.JsvTagName.Svg:return new te;case P.JsvTagName.JsvFDiv:return new ne;case P.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 se(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())===P.JsvTagName.Head)return[this.head];if(e===P.JsvTagName.Link||e===P.JsvTagName.Script||e===P.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 X(e,t,s)}}class re extends P{constructor(){super(P.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof Z||e instanceof Q)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class ae{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 le extends ae{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 ce="@keyframes";class he{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),D.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),D.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(ce)+10,s=e.indexOf("{");return e.substring(t,s).trim()}}let de=null;function ue(e){return de||(de={global:new he("global")}),de.global}class ve{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,ve.EnsureGlobalJsvCode(e,t),P.JsvEnableEventListener(),k.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=D.Dom.DeclareStyleSheets),window.JsvCode.Dom.UndeclareStyleSheets||(window.JsvCode.Dom.UndeclareStyleSheets=D.Dom.UndeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=ue),window.JsvCode.Dom.GetLazyTaskAmount||(window.JsvCode.Dom.GetLazyTaskAmount=D.Dom.GetLazyTaskAmount),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new le)}}class me{static SetLevel(e){switch(me.E=me.W=me.I=me.D=function(){},e){case me.Level.Verbose:me.V=console.debug.bind(console);case me.Level.Debug:me.D=console.debug.bind(console);case me.Level.Info:me.I=console.info.bind(console)}}}me.E=console.error.bind(console),me.W=console.warn.bind(console),me.I=console.info.bind(console),me.D=function(){},me.V=function(){},me.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class fe{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 ge extends oe{constructor(){super(),this.head=new re}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}class pe{static DeclareGlobal(){pe.DeclareDocument(),pe.DeclareOthers(),pe.DeclareAddition()}static DeclareDocument(){window.document=new ge}static DeclareOthers(){window.MutationObserver=fe,window.Element=P,window.SVGElement=te;let e=new F(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:F}}}class we{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",(()=>{D.Dom.RequestSwapAllCachedTasks()}))}}class ye{constructor(e){this.activityManager=e;let t=new we(e);e.StartActivity(t.activity)}}window.jsvIsBrowserDebug=!1;const Te=window.JsvCode.NativePlatformDomBridge,Ne=window.JsvCode.NativePlatformMediaBridge;function De(){ve.EnsureGlobalEnv(Te,Ne),pe.DeclareGlobal(),me.I("Using JsView Native Environment.")}export{ye as ForgeAppClass,De as InitEnv};
|
|
2
2
|
|