@shijiu/jsview 2.1.5 → 2.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- /* eslint-disable */ class e{static CreateAudioPlayer(){return new window.Audio}static CreateVideoPlayer(){const t=window.originDocument.createElement("video");return t.jsvOnCssStyleChanged=e.OnCssStyleChanged.bind(t),t.jsvFinalize=e.JsvFinalize.bind(t),t}static OnCssStyleChanged(e,t){const s=this;s.parentNode,s.style.position="fixed",s.style.left=(t.left?t.left:0)+"px",s.style.top=(t.top?t.top:0)+"px",s.style.width=(t.width?t.width:0)+"px",s.style.height=(t.height?t.height:0)+"px",s.style.objectFit=t.objectFit,s.style.visibility=t.visibility}static JsvFinalize(){console.log("BrowserPlatformMediaBridge.JsvFinalize()");this.pause()}}window.JsvCode.BrowserPlatformMediaBridge||(window.JsvCode.BrowserPlatformMediaBridge=e);class t{constructor(e,t){this.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.#e=!0}jsvIsPrevented(){return this.#e}#e=!1}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}options}class n extends t{constructor(e){super(e)}}void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var r=window.Forge;class o{constructor(e,t){if(!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:"))return void(this.href=e);let s=e.indexOf("://");if(!(s<0||s>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if(!0===e.startsWith("./")&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.MainPath||"undefined"===window.JsView.Dom.MainPathRef||window.JsView.Dom.MainPathRef!==document.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.MainPathRef=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.MainPath=document.location.origin+document.location.pathname.substring(0,e)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let i=this.href,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let r=i.indexOf("?");r>1&&(this.search=i.substring(r),i=i.substring(0,r));let o=i,a=o.indexOf("://");this.protocol=a>0?o.substring(0,a+1):"";let c=a>1?o.substring(a+3):"";a=c.indexOf("/"),this.host=a>0?c.substring(0,a):"",this.pathname=a>=1?c.substring(a):"","file:"==this.protocol&&(this.host="",this.pathname=c),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}href="";origin="";protocol="";host="";hostname="";port="";pathname="";search="";hash=""}class a{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){a.#t(a.#s.CreateElement,e,t)}static BindElementToRootView(e){a.#t(a.#s.BindElementToRootView,e)}static InsertElementChild(e,t,s){a.#t(a.#s.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){a.#t(a.#s.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){a.#t(a.#s.MoveElementChild,e,t,s,i)}static AddElementEventListener(e,t,s){a.#t(a.#s.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){a.#t(a.#s.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){a.#t(a.#s.SetElementText,e,t)}static SetElementAttribute(e,t,s){a.#t(a.#s.SetElementAttribute,e,t,s),a.#i.has(e)&&a.#n.add(e)}static GetElementBoundingClientStyles(e,t){return a.#r(a.#s.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),a.#t(a.#s.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){a.#t(a.#s.DeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){a.#t(a.#s.SetStyleProperty,e,t,s),a.#i.has(e)&&a.#n.add(e)}static GetStyleProperties(e,t){return a.#r(a.#s.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){a.#i.set(e,t)}static RemoveLazyTaskSyncedListener(e){a.#i.delete(e)}static RequestSwapAllCachedTasks(){if(0==a.#o.length)return;const e=JSON.stringify(a.#o);a.#o=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of a.#n){a.#i.get(e)?.()}a.#n.clear()}static GetElementAttribute(e,t){return a.#r(a.#s.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){a.#t(a.#s.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){a.#t(a.#s.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=a.#r(a.#s.GetRelativePosition,e,t);return JSON.parse(s)}static#r(e,t,...s){a.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static#t(e,t,...s){a.#o.push([e,t,...s]),r.sRenderBridge?.RequestSwap()}static#o=[];static#n=new Set;static#i=new Map;static#s={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42}}class c{static CreateAudioPlayer(e){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer(e)}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}}class l{static Dom=a;static Media=c}class d{static GenerateId(){const e=this.#a++;if(e>=this.#c)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}static#a=0;static#c=Math.pow(2,31)-1}class h{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[]}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.#l?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMError("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=void 0,this.#l?.()}insertBefore(e,t){this.#d(e,t)}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("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(t<0)throw new DOMError("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.#h||(this.#h={});let i=this.#h[e];i||(i=new Set,this.#h[e]=i),i.add(t)}removeEventListener(e,t,s){let i=this.#h?.[e];i&&(i.delete(t),i.size<=0&&this.#h.hasOwnProperty(e)&&delete this.#h[e],0===Object.values(this.#h).length&&(this.#h=void 0))}dispatchEvent(e){if(!this.#h)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.#h[e.type];if(t){e.target||(e.target=document.activeElement);for(let s of t)if(s?.(e),e.jsvIsPrevented())break}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.#l=e}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);i<0&&Log.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t.#d(e,s)}jsvGetEventListenerSet(e){const t=this.#h?.[e];return t}#d(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMError("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 DOMError("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.#l?.()}#h=void 0;#l=void 0;static ELEMENT_NODE=1;static TEXT_NODE=3;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static NOLAYOUT_NODE=10}class u{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(e){switch(e){case u.Layout.Height:case u.Layout.Left:case u.Layout.Top:case u.Layout.Width:case u.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==u.Layout.Height?u.Layout.Height:e==u.Layout.Left?u.Layout.Left:e==u.Layout.Top?u.Layout.Top:e==u.Layout.Width?u.Layout.Width:e==u.Background.BackgroundColor?u.Background.BackgroundColor:e==u.Background.BackgroundImage?u.Background.BackgroundImage:e==u.Background.BorderRadius?u.Background.BorderRadius:e==u.Effect.BackfaceVisibility?u.Effect.BackfaceVisibility:e==u.Effect.BorderImage?u.Effect.BorderImage:e==u.Effect.BorderImageWidth?u.Effect.BorderImageWidth:e==u.Effect.BorderImageOutset?u.Effect.BorderImageOutset:e==u.Effect.Display?u.Effect.Display:e==u.Effect.ObjectFit?u.Effect.ObjectFit:e==u.Effect.Opacity?u.Effect.Opacity:e==u.Effect.Overflow?u.Effect.Overflow:e==u.Effect.Perspective?u.Effect.Perspective:e==u.Effect.PerspectiveOrigin?u.Effect.PerspectiveOrigin:e==u.Effect.Transform?u.Effect.Transform:e==u.Effect.TransformOrigin?u.Effect.TransformOrigin:e==u.Effect.TransformStyle?u.Effect.TransformStyle:e==u.Effect.Visibility?u.Effect.Visibility:e==u.Effect.ZIndex?u.Effect.ZIndex:e==u.Text.Color?u.Text.Color:e==u.Text.FontFamily?u.Text.FontFamily:e==u.Text.FontSize?u.Text.FontSize:e==u.Text.FontStyle?u.Text.FontStyle:e==u.Text.FontWeight?u.Text.FontWeight:e==u.Text.LineHeight?u.Text.LineHeight:e==u.Text.TextAlign?u.Text.TextAlign:e==u.Text.TextOverflow?u.Text.TextOverflow:e==u.Text.TextShadow?u.Text.TextShadow:e==u.Text.WebkitTextStroke?u.Text.WebkitTextStroke:e==u.Text.WhiteSpace?u.Text.WhiteSpace:e==u.Text.WordWrap?u.Text.WordWrap:e==u.Text.Direction?u.Text.Direction:e==u.Text.JsvTextEmoji?u.Text.JsvTextEmoji:e==u.Text.JsvTextLatex?u.Text.JsvTextLatex:e==u.Text.JsvTextAlignMinWidth?u.Text.JsvTextAlignMinWidth:e==u.Text.JsvTextVerticalAlign?u.Text.JsvTextVerticalAlign:e==u.Text.JsvTextLineAlign?u.Text.JsvTextLineAlign:e==u.Text.JsvTextInnerDirection?u.Text.JsvTextInnerDirection:e==u.Motion.Animation?u.Motion.Animation:e==u.Motion.Transition?u.Motion.Transition:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class p{static Base=class{constructor(e){this.rawValue=e}rawValue};static AnimationImpl=class extends p.Base{constructor(e){super(e)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends p.Base{constructor(e){super(e)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends p.Base{constructor(e){super(e)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends p.Base{constructor(e){super(e)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends p.Base{constructor(e){super(e)}length=0;color=void 0};static TransitionImpl=class extends p.Base{constructor(e){super(e)}animationMap=new Map};static BorderImageImpl=class extends p.Base{constructor(e){super(e)}source="";slice=null};static BackgroundImageImpl=class extends p.Base{constructor(e){super(e)}type=0;static eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2};static LinearGradient=class{fromX=0;fromY=0;toX=0;toY=0;stops=[]};linearGradient;urlPath=""};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10;static BackgroundImage=11};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(e){let t=-1,s=null;null==e?t=p.DataType.Null:Number(e)===e&&e%1==0?t=p.DataType.Int32:Number(e)===e&&e%1!=0?t=p.DataType.Float:"string"==typeof e||e instanceof String?t=p.DataType.String:e instanceof p.AnimationImpl?t=p.DataType.Animation:e instanceof p.CornerImpl?t=p.DataType.Corner:e instanceof p.RectImpl?t=p.DataType.Rect:e instanceof p.TextShadowImpl?t=p.DataType.TextShadow:e instanceof p.WebkitTextStrokeImpl?t=p.DataType.WebkitTextStroke:e instanceof p.TransitionImpl?t=p.DataType.Transition:e instanceof p.BorderImageImpl&&(t=p.DataType.BorderImage),e!=p.InvalidInt32&&e!=p.InvalidFloat&&e!=p.InvalidPointer?s=e:(t=p.DataType.Null,s=null),this.data=new p.DataInfo,this.data.index=t,this.data.value=s}toString(){let e=null;switch(this.data.index){case p.DataType.Null:return"";case p.DataType.Int32:case p.DataType.Float:return String(this.get());case p.DataType.String:e=this.get();break;case p.DataType.Animation:case p.DataType.Corner:case p.DataType.Rect:case p.DataType.TextShadow:case p.DataType.WebkitTextStroke:case p.DataType.Transition:case p.DataType.BorderImage:case p.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}static DataInfo=class{value=null;index=-1};data}class m{static JsvDeclarePrototype(){for(let e in u){let t=u[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(m.prototype,s,i)}}}constructor(e){this.#u=e}setProperty(e,t){if(document.jsvCheckStyleFormat?.(e,t),e==u.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient"));else{t=new o(t).href}else if(e==u.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new o(e[0]).href),t=e.join(" ")}else e==u.Effect.Display&&(this.#p[e]=t);l.Dom.SetStyleProperty(this.#u,e,t)}getPropertyValue(e){if(e==u.Effect.Display)return this.#p[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=l.Dom.GetStyleProperties(this.#u,t);return JSON.parse(s)}#u;#p={}}class v extends t{constructor(e){super(e)}}class f extends h{static 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"};static JsvEnableEventListener(){l.Dom.EnableEventListener((function(e,t,...s){const i=f.#m[e]?.[t];i?.(t,...s)}))}constructor(e){super(h.ELEMENT_NODE),this.tagName=e,this.tagName!=f.JsvTagName.Audio&&this.tagName!=f.JsvTagName.Div&&this.tagName!=f.JsvTagName.Image&&this.tagName!=f.JsvTagName.Video&&this.tagName!=f.JsvTagName.JsvFDiv||(this.jsvNativeId=d.GenerateId(),this.style=new m(this.jsvNativeId),l.Dom.CreateElement(this.jsvNativeId,e)),this.jsvAttrStore={},this.clientSizeStore={}}appendChild(e){e.parentNode?this.#v(e,null):(super.appendChild(e),this.#f(e,null))}removeChild(e){super.removeChild(e),this.#g(e),e.jsvNativeId&&l.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?this.#v(e,t):(super.insertBefore(e,t),this.#f(e,t))}addEventListener(e,t,s){this.jsvGetEventListenerSet(e)?.has(t)?console.warn("Element.addEventListener() Faild to add listener, func is exists"):(s=this.#w(s),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),l.Dom.AddElementEventListener(this.jsvNativeId,e,s)),super.addEventListener(e,t,s))}removeEventListener(e,t,s){0!=!!this.jsvGetEventListenerSet(e)?.has(t)&&(s=this.#w(s),super.removeEventListener(e,t,s),this.jsvNativeId&&(this.jsvRemoveListener(this.jsvNativeId,e),l.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.clientSizeStore.clientWidth||(this.clientSizeStore.clientWidth=l.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.clientSizeStore.clientWidth}get clientHeight(){return this.clientSizeStore.clientHeight||(this.clientSizeStore.clientHeight=l.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.clientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?l.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?l.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&l.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&&l.Dom.SetElementAttribute(this.jsvNativeId,e,null)}getAttribute(e){return this.jsvAttrStore[e]}hasAttribute(e){return!!this.jsvAttrStore[e]}focus(){document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new n(n.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new n(n.JsvType.Focus);document.dispatchEvent(t)}jsvGetBoundingClientRect(){const e="jsvgetbound",t=d.GenerateId();return new Promise(((s,i)=>{const n=r=>{const o=r.jsvParams?.[1];if(o!=t)return;r.preventDefault(),this.removeEventListener(e,n);const a=JSON.parse(r.jsvParams?.[0]??"{}");0===a.status?s(a.data):i(a.error)};this.addEventListener(e,n,{jsvtoken:t})}))}jsvSetOnLazyTaskSyncedListener(e){l.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...t){let n;e.startsWith("animation")?(n=new s(e),n.animationName=t[0]):e.startsWith("transition")?(n=new v(e),n.propertyName=t[0]):e.startsWith("jsv")&&(n=new i(e),n.options={detail:t[0]},n.jsvParams=t),n&&(n.target=this,this.dispatchEvent(n))}jsvGetProxyView(e){return e?(this._MaskViewProxy||(this._MaskViewProxy=r.NewDomProxyView(this.jsvNativeId,!0)),this._MaskViewProxy):(this._MainViewProxy||(this._MainViewProxy=r.NewDomProxyView(this.jsvNativeId,!1)),this._MainViewProxy)}jsvGetProxyTexture(e){return this._MainViewTextureProxy||(this._MainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this._MainViewTextureProxy}jsvGetRelativePosition(e){return l.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}jsvAddListener(e,t){let s=f.#m[e];s||(s=new Map,f.#m[e]=s);this.jsvGetEventListenerSet(t)||(s[t]=this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let s=f.#m[e];if(!s)return;this.jsvGetEventListenerSet(t)||s.delete(t)}#v(e,t){let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.#y(s,e,t)}#y(e,t,s){t.jsvNativeId&&(s=f.#T(s),l.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}#f(e,t){e.parentNode=this,e.nodeType===h.TEXT_NODE?this.textContent=e.nodeValue:e.jsvNativeId&&(t=f.#T(t),l.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#g(e){for(const t of e.childNodes)e.#g(t);e.jsvFinalize(),l.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),delete f.#m[e.jsvNativeId]}#w(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#T(e){let t=e;for(;t&&!(t instanceof f);)t=t.nextSibling;return t}parentNode;tagName;style;jsvNativeId;jsvAttrStore;static#m={}}class g extends f{constructor(){super(f.JsvTagName.Anchor),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return f.TAG.ANCHOR}}class w extends h{constructor(e){super(h.COMMENT_NODE),this.textContent=e}}class y extends f{constructor(){super(f.JsvTagName.Div)}get textContent(){return this.#C}set textContent(e){this.#C=e,this.clientSizeStore={},l.Dom.SetElementText(this.jsvNativeId,e)}#C}const T="__AppRoot__";class C{constructor(e,t){this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new k(!1,t))}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==T?"":e}wrapWithNameSpace(e){let t=new C(!0);return t._DefaultFocusNameSpace=e,t.RouterDelegate=this.RouterDelegate,t}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t){if("string"==typeof e)return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t);console.error(`setFocus name=${e} is invalid`)}setFocus(e,t){return this._DefaultFocusNameSpace&&this._DefaultFocusNameSpace.length>0&&(e=`${this._DefaultFocusNameSpace}.${e}`),this.focusByNameBeforeMount(e,t)}printAllFocusable(){this.RouterDelegate.ref.printAllFocusRecursive(this._DefaultFocusNameSpace,"")}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof b;){let s=t.RouterDelegate.ref.NameSpace;e.push({nameSpace:s==T||s==t.BranchName?"":s,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(b.sLastFocus){let e=b.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}returnFocusToParent(){const e=this.RouterDelegate.ref.getCurrentFocusNode();e?e.ReturnFocusToParent():console.warn("returnFocusToParent: current focus node is null.")}}class k{constructor(e,t){this._IsTemp=!!e,this._ChildMap={},this._FocusNameBeforeMount=null,this._FocusNodeName=null,this.NameSpace=t}getCurrentFocusNode(){if(null==this._FocusNodeName)return null;let e=this._ChildMap[this._FocusNodeName];if(e.RouterDelegate.ref!=this){let t=e.RouterDelegate.ref.getCurrentFocusNode();return null==t?e:t}return e}getNodeByName(e,t){let s=e.split(".");return this._FindRouterSearchBase(s,t)._GetNodeFromPathArray(s,e)}printAllFocusRecursive(e,t){let s=this.NameSpace==T?"":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?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 r=i._ChildMap[t].RouterDelegate.ref;if(r!=i&&r.NameSpace==e[s]){i=r,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),this._FocusNameBeforeMount=null);else{this._FocusNameBeforeMount[0]==e&&(t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1)),this._FocusNameBeforeMount=null)}}remove(e,t){let s=this._ChildMap[e];s&&s==t&&delete this._ChildMap[e]}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}focusBeforeMount(e,t){let s=!1;if("string"==typeof e){if(!e.includes(".")){s=!0;let i=this._ChildMap[e];return this._FocusNodeName=e,i?(i.Focus(!t),i.RouterDelegate.ref!=this&&i.RouterDelegate.ref.clearChildFocus(),!0):(this._FocusNameBeforeMount=e,!1)}}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(s=!0,1==e.length)return this.focusBeforeMount(e[0]);{let t=e[0],s=this._ChildMap[t];return this._FocusNodeName=t,s?s.RouterDelegate.ref.focusBeforeMount(e.slice(1)):(this._FocusNameBeforeMount=e,!1)}}return s||console.error("illegal name param",e),!1}focus(e,t){let s=this.focusBeforeMount(e,t);return s||console.log("No found branch:"+e),s}forEach(e){for(let t in this._ChildMap)e(this._ChildMap[t],t,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class b extends r.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.BranchName=e,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}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 C(!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 k(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}routerUnbind(){let e;this.AsHub?this.GetParentPage()&&(e=this.GetParentPage().RouterDelegate.ref):e=this.RouterDelegate.ref,e&&e.remove(this.BranchName,this)}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}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=b.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=b.safeCallback(e)}setOnFocus(e){this._OnFocus=b.safeCallback(e)}setOnBlur(e){this._OnBlur=b.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=b.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=b.safeCallback(e)}setOnCustomerEvent(e){this._OnCustomerEvent=b.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=b.safeCallback(e),this._DKeyUpProxy=b.safeCallback(t)}requestFocus(e){let t=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(t=this.GetParentPage().RouterDelegate.ref),t?t.focus(this.BranchName,e):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomerEvent(e){return!!this._OnCustomerEvent&&this._OnCustomerEvent(e)}bubbleCustomerEvent(e){this.BubbleCustomerEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return this._DKeyDownProxy?this._DKeyDownProxy(e,this._OriginDispatchKeyDown):this._OriginDispatchKeyDown(e)}_OriginDispatchKeyDown(e){let t=!1;return this._DispatchKeyDown&&(t=this._DispatchKeyDown(e)),!!t||super.DispatchKeyDown(e)}dispatchKeyUp(e){return this.DispatchKeyUp(e)}DispatchKeyUp(e){return this.__DKeyUpProxy?this.__DKeyUpProxy(e,this._OriginDispatchKeyUp):this._OriginDispatchKeyUp(e)}_OriginDispatchKeyUp(e){let t=!1;return this._DispatchKeyUp&&(t=this._DispatchKeyUp(e)),!!t||super.DispatchKeyUp(e)}attachToActivity(e,t){this.AttachToActivity(e,t)}AttachToActivity(e,t){super.SetParent(e,t)}setParent(e){this.SetParent(e)}SetParent(e){if(null!=e&&(super.SetParent(e,null),this._ParentPage._Mounted&&(this.updateMountState(),D()),e instanceof b)){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 b.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(){b.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(){b.sLastFocus==this&&(b.sLastFocus=null);let e=this.GetParentPage();e&&e.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind()}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]==T)break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return t[0]==T?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}b.sFocusMemos=[],b.sLastFocus=null,b.sRootPageNode=null;let D=()=>{let e=b.sFocusMemos.length;if(e>0){let t=b.sFocusMemos;b.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},N={};class E{constructor(e,t,s){this._Element=s,N.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),N[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),window.JsView?t.attachToActivity(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.RootView):(window.addEventListener("keydown",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())})))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),D()}}class x extends f{constructor(){super(f.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new o(t).href,this.clientSizeStore={}}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&l.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 S extends f{constructor(){super(f.JsvTagName.Link),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new o(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 I extends f{constructor(){super(f.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new o(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})}src=null;onerror=null;onload=null;charset=null;timeout=120}class O extends f{constructor(){super(f.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class L extends f{constructor(){super(f.JsvTagName.Svg)}}class F extends h{constructor(e){super(h.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let B=1;class M extends f{constructor(){super(f.JsvTagName.JsvFDiv),this.FocusNodeRef=new b(""+B++),this.HubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new C(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.HubRef}}class J extends h{constructor(){super(h.DOCUMENT_NODE),this.location=window.location,this.rootElement=new y,this.rootElement.ownerDocument=this,this.rootElement.id="root",l.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new w(e)}createElement(e){switch(e=e.toUpperCase()){case f.JsvTagName.Anchor:return new g;case f.JsvTagName.Div:return new y;case f.JsvTagName.Image:return new x;case f.JsvTagName.Link:return new S;case f.JsvTagName.Script:return new I;case f.JsvTagName.Style:return new O;case f.JsvTagName.Svg:return new L;case f.JsvTagName.JsvFDiv:return new M;case f.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:new t(e)}createTextNode(e){return new F(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMError("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===f.JsvTagName.Head)return[this.head];if(e===f.JsvTagName.Link||e===f.JsvTagName.Script||e===f.JsvTagName.Style)return[];throw new DOMError("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(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMError("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new E(e,t,s)}}class R extends f{constructor(){super(f.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof S||e instanceof I)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class P{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 _ extends P{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 j="@keyframes",A=j.length;class V{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.#k(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),l.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),l.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}#k(e){let t=e.indexOf(j)+A,s=e.indexOf("{");return e.substring(t,s).trim()}}let U=null;function W(e){return U||(U={global:new V("global")}),U.global}class z{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,z.#b(e,t),f.JsvEnableEventListener(),m.JsvDeclarePrototype()}static#b(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=l.Dom.DeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=W),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new _)}}class H{static SetLevel(e){switch(H.E=H.W=H.I=H.D=function(){},e){case H.Level.Verbose:H.V=console.debug.bind(console);case H.Level.Debug:H.D=console.debug.bind(console);case H.Level.Info:H.I=console.info.bind(console)}}static E=console.error.bind(console);static W=console.warn.bind(console);static I=console.info.bind(console);static D=function(){};static V=function(){};static Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4}}class K{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof h))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 G{constructor(){this.#D(),G.#N()}#D(){r.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{l.Dom.RequestSwapAllCachedTasks()})),window.JsvCode.ForgeHandles.setHandles(new r.TextureManager,null,null);let e=null;r.DesignMap&&(e=r.DesignMap(),r.sRenderBridge.InitScreenBuffer(e.displayScale,e.width)),r.DomElementGetter=e=>{let t=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.GetInstance(t).forgeElementGetter(e)}}static SetRender(e){G.#N=e,window.Forge.RunApp({})}static#N=null}class q extends O{constructor(){super(),this.jsvBrowserElement=window.JsvCode.Dom.BrowserDocument.createElement(Element.JsvTagName.Style)}jsvBrowserElement}class $ extends R{constructor(){super()}appendChild(e){"HTMLLinkElement"==e.constructor.name||"HTMLScriptElement"==e.constructor.name?window.JsvCode.Dom.BrowserDocument.head.appendChild(e):e instanceof q?window.JsvCode.Dom.BrowserDocument.head.appendChild(e.jsvBrowserElement):super.appendChild(e)}removeChild(e){"HTMLLinkElement"==e.constructor.name||"HTMLScriptElement"==e.constructor.name?window.JsvCode.Dom.BrowserDocument.head.removeChild(e):e instanceof q?window.JsvCode.Dom.BrowserDocument.head.removeChild(e.jsvBrowserElement):super.removeChild(e)}}class X extends J{constructor(){super(),this.head=new $}createElement(e){switch(e=e.toUpperCase()){case f.JsvTagName.IFrame:case f.JsvTagName.Link:case f.JsvTagName.Script:return window.JsvCode.Dom.BrowserDocument.createElement(e);case f.JsvTagName.Style:return new q;default:return super.createElement(e)}}getElementsByTagName(e){return e.toUpperCase()===f.JsvTagName.Head?window.JsvCode.Dom.BrowserDocument.getElementsByTagName(e):super.getElementsByTagName(e)}}class Y{static Get(e){return Y.#E[e]}static#x(e,t){let s=void 0===t;return s&&console.error(e+" property is undefined!"),s}static#S(e,t){return!!Y.#x(e,t)||(""===t||"number"==typeof t)}static#I(e,t){Y.#x(e,t)||t.indexOf("transform")<0&&t.indexOf("opacity")<0&&console.error("keyframes property is only support transform and opacity, value:",t)}static#O(e,t){if(Y.#x(e,t))return;const s="fill contain cover none scale-down";s.indexOf(t)<0&&console.error(" objectFit is only support one of string["+s+"]")}static#L(e,t){Y.#x(e,t)||console.error(e+" property is not support, you can use transition property, e.g. transition='width 2s'")}static#F(e,t){Y.#x(e,t)||t.length>0&&(t.indexOf("left")<0&&t.indexOf("top")<0&&t.indexOf("width")<0&&t.indexOf("height")<0&&t.indexOf("transform")<0||t.indexOf("all")>=0)&&console.error("transition property's value only support [top, left, width, height, transform] value:",t)}static#B(e,t){Y.#x(e,t)||t.length>0&&t.indexOf("translate3d")<0&&t.indexOf("scale3d")<0&&t.indexOf("rotate3d")<0&&t.indexOf("skew")<0&&console.error("transform property's value only support translate3d、scale3d、rotate3d、skew, value:",t)}static#M(e,t){Y.#x(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("transformOrigin property's value only support XX%、left、top、right, bottom:",t)}static#J(e,t){if(!Y.#x(e,t))switch(t){case"clip":case"ellipsis":break;default:console.error("textOverflow property's value is not support, value:",t)}}static#R(e,t){if(!Y.#x(e,t))switch(t){case"normal":case"nowrap":case"pre-wrap":break;default:console.error("whiteSpace property's value is not support, value:",t)}}static#P(e,t){if(!Y.#x(e,t))switch(t){case"left":case"right":case"center":case"start":case"end":break;default:console.error("textAlign property's value is not support, value:",t)}}static#_(e,t){if(!Y.#S(e,t))switch(t){case"normal":case"inherit":console.error("lineHeight property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("lineHeight property's value is support number only, value:",t)}}static#j(e,t){Y.#x(e,t)||Y.#A("Color()",t)}static#V(e,t){Y.#x(e,t)||"visible"!==t&&"hidden"!==t&&"inherit"!==t&&console.error("visibility property's value is not support, value:",t)}static#U(e,t){Y.#x(e,t)||"block"!==t&&"inline"!==t&&"none"!==t&&"inline-block"!==t&&"inherit"!==t&&""!==t&&console.error("display property's value is not support, value:",t)}static#W(e,t){Y.#x(e,t)||"visible"!==t&&"hidden"!==t&&console.error("overflow property's value is support visible or hidden only, value:",t)}static#z(e,t){if(!Y.#S(e,t))switch(t){case"auto":case"inherit":console.error("top property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("top property's value is support number only, value:",t)}}static#H(e,t){if(!Y.#S(e,t))switch(t){case"auto":case"inherit":console.error("left property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("left property's value is support number only, value:",t)}}static#K(e,t){if(!Y.#S(e,t))switch(t){case"auto":case"inherit":console.error("height property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("height property's value is support number only, value:",t)}}static#G(e,t){if(!Y.#S(e,t))switch(t){case"auto":case"inherit":console.error("width property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("width property's value is support number only, value:",t)}}static#q(e,t){if(!Y.#x(e,t))switch(t){case"visible":case"hidden":break;default:console.error("backfaceVisibility property's value is support visible/hidden only, value: ",t)}}static#$(e,t){Y.#x(e,t)}static#X(e,t){if(Y.#x(e,t))return;t.split(" ").length<2&&console.error("Error: WebkitTextStroke should format of(width color) such as: '1px rgba(255,255,255,1.0)'")}static#Y(e,t){Y.#x(e,t)||isNaN(t)&&console.error("zIndex property's value is support number only, value: ",t)}static#Z(e,t){if(!Y.#S(e,t))switch(t){case"smaller":case"larger":case"inherit":case"x-small":case"xx-small":case"small":case"large":case"medium":case"x-large":case"xx-large":console.error("fontSize property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("fontSize property's value is support number only, value:",t)}}static#Q(e,t){Y.#x(e,t)||"bold"!==t&&console.error("fontWeight property's value is support bold only, value:",t)}static#ee(e,t){Y.#x(e,t)||"italic"!==t&&console.error("fontWeight property's value is support italic only, value:",t)}static#te(e,t){if(Y.#x(e,t))return;let s=[t];"string"==typeof t&&(s=t.split(" ")),s.length>4&&console.error("borderRadius property's value is not support, value:",t)}static#se(e,t){Y.#S(e,t)}static#ie(e,t){if(Y.#x(e,t))return;t.split(" ").length>4&&console.error("borderImageOutsetCheck property's value is not support, value:",t)}static#ne(e,t){Y.#x(e,t)||t.indexOf("fill")<0&&console.error("borderImage property's value is not contain fill, e.g. source slice, but value:",t)}static#re(e,t){console.error(e+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`")}static#oe(e,t){Y.#x(e,t)||"inherit"==t&&console.error("backgroundImage property's value is not support, value:",t)}static#ae(e,t){if(!Y.#x(e,t))return Y.#A("backgroundColor",t)}static#ce(e,t){}static#le(e,t){console.error(e+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'")}static#de(e,t){if(!Y.#x(e,t))switch(t){case"flat":case"preserve-3d":break;default:console.error("transformStyle property value is not valid",t)}}static#he(e,t){Y.#x(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("perspectiveOrigin property's value only support XX%、left、top、right, bottom:",t)}static#ue(e,t){if(!Y.#x(e,t)&&t.length>0){if(t.replace(/\(.*\)/g,"").split(",").length>1)return void console.error("textShadow: NOT support more than one part settings");const e=t.split(" ");if(4!==e.length&&(5!==e.length||0!==e[4].length)||isNaN(parseInt(e[0]))||isNaN(parseInt(e[1])))console.error('textShadow: format should be "offsetX offsetY blurSize color"(0 0 1 rgba(100,100,100,1)), !NOT space in rgba()');else{if(!(parseFloat(e[2])>0))return void console.error(`textShadow: blur shadow above 0(now=${t})`);if(!Y.#A("textShadow",e[3]))return}}}static#A(e,t){if(0===t.indexOf("rgba(")||0===t.indexOf("rgb("));else{if(0!==t.indexOf("#"))return console.error(`${e} color value is not valid, need startwith rgba or #, value:[${t}]`),!1;if(7!==t.length)return console.error(`${e} color value's length is not valid, value:${t}`),!1}return!0}static#pe(e,t){Y.#x(e,t)||"number"!=typeof t&&console.error("JsvTextLatex property's value is support number only, value: ",t)}static#me(e,t){Y.#x(e,t)||"number"!=typeof t&&console.error("JsvTextEmoji property's value is support number only, value: ",t)}static#ve(e,t){if(!Y.#x(e,t))switch(t){case"ltr":case"rtl":break;default:console.error("direction property's value is not support, value:",t)}}static#fe(e,t){Y.#x(e,t)||"number"!=typeof t&&console.error("JsvTextAlignMinWidth property's value is support number only, value: ",t)}static#ge(e,t){if(!Y.#x(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextVerticalAlign property's value is not support, value: ",t)}}static#we(e,t){if(!Y.#x(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextLineAlign property's value is not support, value: ",t)}}static#ye(e,t){if(!Y.#x(e,t))switch(t){case"unset":case"ltr":case"rtl":break;default:console.error("JsvTextInnerDirection property's value is not support, value: ",t)}}static#E={animation:{check:Y.#ce},animationName:{check:Y.#le},animationDuration:{check:Y.#le},animationTimingFunction:{check:Y.#le},animationDelay:{check:Y.#le},animationIterationCount:{check:Y.#le},animationDirection:{check:Y.#le},animationPlayState:{check:Y.#le},animationFillMode:{check:Y.#le},background:{check:Y.#re},backgroundColor:{check:Y.#ae},backgroundImage:{check:Y.#oe},borderImage:{check:Y.#ne},borderImageOutset:{check:Y.#ie},borderImageWidth:{check:Y.#se},borderRadius:{check:Y.#te},height:{check:Y.#K},width:{check:Y.#G},zIndex:{check:Y.#Y},fontFamily:{check:null},fontSize:{check:Y.#Z},fontStyle:{check:Y.#ee},fontWeight:{check:Y.#Q},left:{check:Y.#H},overflow:{check:Y.#W},top:{check:Y.#z},visibility:{check:Y.#V},display:{check:Y.#U},color:{check:Y.#j},lineHeight:{check:Y.#_},textAlign:{check:Y.#P},direction:{check:Y.#ve},whiteSpace:{check:Y.#R},textOverflow:{check:Y.#J},transform:{check:Y.#B},transformOrigin:{check:Y.#M},transition:{check:Y.#F},transitionProperty:{check:Y.#L},transitionDuration:{check:Y.#L},transitionTimingFunction:{check:Y.#L},transitionDelay:{check:Y.#L},keyframes:{check:Y.#I},objectFit:{check:Y.#O},perspective:{check:Y.#$},backfaceVisibility:{check:Y.#q},transformStyle:{check:Y.#de},perspectiveOrigin:{check:Y.#$},WebkitTextStroke:{check:Y.#X},textShadow:{check:Y.#ue},JsvTextLatex:{check:Y.#pe},JsvTextEmoji:{check:Y.#me},JsvTextAlignMinWidth:{check:Y.#fe},JsvTextVerticalAlign:{check:Y.#ge},JsvTextLineAlign:{check:Y.#we},JsvTextInnerDirection:{check:Y.#ye}}}class Z{static BackupBrowser(){return{createComment:window.document.createComment.bind(window.document),createElement:window.document.createElement.bind(window.document),createElementNS:window.document.createElementNS.bind(window.document),createTextNode:window.document.createTextNode.bind(window.document),dispatchEvent:window.document.dispatchEvent.bind(window.document),getElementById:window.document.getElementById.bind(window.document),getElementsByTagName:window.document.getElementsByTagName.bind(window.document),querySelector:window.document.querySelector.bind(window.document),head:{appendChild:window.document.head.appendChild.bind(window.document.head),removeChild:window.document.head.removeChild.bind(window.document.head)}}}static HookBrowser(e){Z.#Te(e),Z.#Ce(),Z.#ke()}static#Te(e){window.JsvCode.Dom.BrowserDocument=e;const t=new X;window.document.createComment=t.createComment.bind(t),window.document.createElement=t.createElement.bind(t),window.document.createTextNode=t.createTextNode.bind(t),window.document.dispatchEvent=t.dispatchEvent.bind(t),window.document.getElementById=t.getElementById.bind(t),window.document.getElementsByTagName=t.getElementsByTagName.bind(t),window.document.querySelector=t.querySelector.bind(t),window.document.head.appendChild=t.head.appendChild.bind(t.head),window.document.head.removeChild=t.head.removeChild.bind(t.head),window.JsvCode.Dom.JsViewDocument=t}static#Ce(){window.MutationObserver=K,window.Element=f,window.SVGElement=L}static#ke(){const e=window.JsvCode.Dom.JsViewDocument;window.document.jsvInitFDivRoot=e.jsvInitFDivRoot.bind(e),window.document.jsvCheckStyleFormat=window.jsvInAndroidWebView?null:Z.#be}static#be(e,t){if(e.startsWith("--"))return;let s=Y.Get(e);s?s.check&&t&&s.check(e,t):console.error(e+" property is not support.")}}window.jsvIsBrowserDebug=!0;const Q=window.JsvCode.BrowserPlatformDomBridge,ee=window.JsvCode.BrowserPlatformMediaBridge;function te(){const e=Z.BackupBrowser();Q.RegisterOriginDocument(e),z.EnsureGlobalEnv(Q,ee),Z.HookBrowser(e),H.I("Using JsView HTML Environment.")}export{G as BrowserForgeApp,te as InitEnv};
1
+ /* eslint-disable */ class e{static CreateAudioPlayer(){return new window.Audio}static CreateVideoPlayer(){const t=window.originDocument.createElement("video");return t.jsvOnCssStyleChanged=e.OnCssStyleChanged.bind(t),t.jsvFinalize=e.JsvFinalize.bind(t),t}static OnCssStyleChanged(e,t){const s=this;s.parentNode,s.style.position="fixed",s.style.left=(t.left?t.left:0)+"px",s.style.top=(t.top?t.top:0)+"px",s.style.width=(t.width?t.width:0)+"px",s.style.height=(t.height?t.height:0)+"px",s.style.objectFit=t.objectFit,s.style.visibility=t.visibility}static JsvFinalize(){console.log("BrowserPlatformMediaBridge.JsvFinalize()");this.pause()}}window.JsvCode.BrowserPlatformMediaBridge||(window.JsvCode.BrowserPlatformMediaBridge=e);class t{constructor(e,t){this.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.#e=!0}jsvIsPrevented(){return this.#e}#e=!1}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}options}class n extends t{constructor(e){super(e)}}void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var r=window.Forge;class o{constructor(e,t){if(!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:"))return void(this.href=e);let s=e.indexOf("://");if(!(s<0||s>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if(!0===e.startsWith("./")&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.MainPath||"undefined"===window.JsView.Dom.MainPathRef||window.JsView.Dom.MainPathRef!==document.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.MainPathRef=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.MainPath=document.location.origin+document.location.pathname.substring(0,e)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let i=this.href,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let r=i.indexOf("?");r>1&&(this.search=i.substring(r),i=i.substring(0,r));let o=i,a=o.indexOf("://");this.protocol=a>0?o.substring(0,a+1):"";let c=a>1?o.substring(a+3):"";a=c.indexOf("/"),this.host=a>0?c.substring(0,a):"",this.pathname=a>=1?c.substring(a):"","file:"==this.protocol&&(this.host="",this.pathname=c),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}href="";origin="";protocol="";host="";hostname="";port="";pathname="";search="";hash=""}class a{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){a.#t(a.#s.CreateElement,e,t)}static BindElementToRootView(e){a.#t(a.#s.BindElementToRootView,e)}static InsertElementChild(e,t,s){a.#t(a.#s.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){a.#t(a.#s.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){a.#t(a.#s.MoveElementChild,e,t,s,i)}static AddElementEventListener(e,t,s){a.#t(a.#s.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){a.#t(a.#s.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){a.#t(a.#s.SetElementText,e,t)}static SetElementAttribute(e,t,s){a.#t(a.#s.SetElementAttribute,e,t,s),a.#i.has(e)&&a.#n.add(e)}static GetElementBoundingClientStyles(e,t){return a.#r(a.#s.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),a.#t(a.#s.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){a.#t(a.#s.DeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){a.#t(a.#s.SetStyleProperty,e,t,s),a.#i.has(e)&&a.#n.add(e)}static GetStyleProperties(e,t){return a.#r(a.#s.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){a.#i.set(e,t)}static RemoveLazyTaskSyncedListener(e){a.#i.delete(e)}static RequestSwapAllCachedTasks(){if(0==a.#o.length)return;const e=JSON.stringify(a.#o);a.#o=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of a.#n){a.#i.get(e)?.()}a.#n.clear()}static GetElementAttribute(e,t){return a.#r(a.#s.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){a.#t(a.#s.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){a.#t(a.#s.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=a.#r(a.#s.GetRelativePosition,e,t);return JSON.parse(s)}static#r(e,t,...s){a.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static#t(e,t,...s){a.#o.push([e,t,...s]),r.sRenderBridge?.RequestSwap()}static#o=[];static#n=new Set;static#i=new Map;static#s={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42}}class c{static CreateAudioPlayer(e){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer(e)}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}}class l{static Dom=a;static Media=c}class d{static GenerateId(){const e=this.#a++;if(e>=this.#c)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}static#a=0;static#c=Math.pow(2,31)-1}class h{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[]}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.#l?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMError("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=void 0,this.#l?.()}insertBefore(e,t){this.#d(e,t)}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("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(t<0)throw new DOMError("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.#h||(this.#h={});let i=this.#h[e];i||(i=new Set,this.#h[e]=i),i.add(t)}removeEventListener(e,t,s){let i=this.#h?.[e];i&&(i.delete(t),i.size<=0&&this.#h.hasOwnProperty(e)&&delete this.#h[e],0===Object.values(this.#h).length&&(this.#h=void 0))}dispatchEvent(e){if(!this.#h)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.#h[e.type];if(t){e.target||(e.target=document.activeElement);for(let s of t)if(s?.(e),e.jsvIsPrevented())break}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.#l=e}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);i<0&&Log.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t.#d(e,s)}jsvGetEventListenerSet(e){const t=this.#h?.[e];return t}#d(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMError("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 DOMError("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.#l?.()}#h=void 0;#l=void 0;static ELEMENT_NODE=1;static TEXT_NODE=3;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static NOLAYOUT_NODE=10}class u{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(e){switch(e){case u.Layout.Height:case u.Layout.Left:case u.Layout.Top:case u.Layout.Width:case u.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==u.Layout.Height?u.Layout.Height:e==u.Layout.Left?u.Layout.Left:e==u.Layout.Top?u.Layout.Top:e==u.Layout.Width?u.Layout.Width:e==u.Background.BackgroundColor?u.Background.BackgroundColor:e==u.Background.BackgroundImage?u.Background.BackgroundImage:e==u.Background.BorderRadius?u.Background.BorderRadius:e==u.Effect.BackfaceVisibility?u.Effect.BackfaceVisibility:e==u.Effect.BorderImage?u.Effect.BorderImage:e==u.Effect.BorderImageWidth?u.Effect.BorderImageWidth:e==u.Effect.BorderImageOutset?u.Effect.BorderImageOutset:e==u.Effect.Display?u.Effect.Display:e==u.Effect.ObjectFit?u.Effect.ObjectFit:e==u.Effect.Opacity?u.Effect.Opacity:e==u.Effect.Overflow?u.Effect.Overflow:e==u.Effect.Perspective?u.Effect.Perspective:e==u.Effect.PerspectiveOrigin?u.Effect.PerspectiveOrigin:e==u.Effect.Transform?u.Effect.Transform:e==u.Effect.TransformOrigin?u.Effect.TransformOrigin:e==u.Effect.TransformStyle?u.Effect.TransformStyle:e==u.Effect.Visibility?u.Effect.Visibility:e==u.Effect.ZIndex?u.Effect.ZIndex:e==u.Text.Color?u.Text.Color:e==u.Text.FontFamily?u.Text.FontFamily:e==u.Text.FontSize?u.Text.FontSize:e==u.Text.FontStyle?u.Text.FontStyle:e==u.Text.FontWeight?u.Text.FontWeight:e==u.Text.LineHeight?u.Text.LineHeight:e==u.Text.TextAlign?u.Text.TextAlign:e==u.Text.TextOverflow?u.Text.TextOverflow:e==u.Text.TextShadow?u.Text.TextShadow:e==u.Text.WebkitTextStroke?u.Text.WebkitTextStroke:e==u.Text.WhiteSpace?u.Text.WhiteSpace:e==u.Text.WordWrap?u.Text.WordWrap:e==u.Text.Direction?u.Text.Direction:e==u.Text.JsvTextEmoji?u.Text.JsvTextEmoji:e==u.Text.JsvTextLatex?u.Text.JsvTextLatex:e==u.Text.JsvTextAlignMinWidth?u.Text.JsvTextAlignMinWidth:e==u.Text.JsvTextVerticalAlign?u.Text.JsvTextVerticalAlign:e==u.Text.JsvTextLineAlign?u.Text.JsvTextLineAlign:e==u.Text.JsvTextInnerDirection?u.Text.JsvTextInnerDirection:e==u.Motion.Animation?u.Motion.Animation:e==u.Motion.Transition?u.Motion.Transition:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class p{static Base=class{constructor(e){this.rawValue=e}rawValue};static AnimationImpl=class extends p.Base{constructor(e){super(e)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends p.Base{constructor(e){super(e)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends p.Base{constructor(e){super(e)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends p.Base{constructor(e){super(e)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends p.Base{constructor(e){super(e)}length=0;color=void 0};static TransitionImpl=class extends p.Base{constructor(e){super(e)}animationMap=new Map};static BorderImageImpl=class extends p.Base{constructor(e){super(e)}source="";slice=null};static BackgroundImageImpl=class extends p.Base{constructor(e){super(e)}type=0;static eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2};static LinearGradient=class{fromX=0;fromY=0;toX=0;toY=0;stops=[]};linearGradient;urlPath=""};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10;static BackgroundImage=11};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(e){let t=-1,s=null;null==e?t=p.DataType.Null:Number(e)===e&&e%1==0?t=p.DataType.Int32:Number(e)===e&&e%1!=0?t=p.DataType.Float:"string"==typeof e||e instanceof String?t=p.DataType.String:e instanceof p.AnimationImpl?t=p.DataType.Animation:e instanceof p.CornerImpl?t=p.DataType.Corner:e instanceof p.RectImpl?t=p.DataType.Rect:e instanceof p.TextShadowImpl?t=p.DataType.TextShadow:e instanceof p.WebkitTextStrokeImpl?t=p.DataType.WebkitTextStroke:e instanceof p.TransitionImpl?t=p.DataType.Transition:e instanceof p.BorderImageImpl&&(t=p.DataType.BorderImage),e!=p.InvalidInt32&&e!=p.InvalidFloat&&e!=p.InvalidPointer?s=e:(t=p.DataType.Null,s=null),this.data=new p.DataInfo,this.data.index=t,this.data.value=s}toString(){let e=null;switch(this.data.index){case p.DataType.Null:return"";case p.DataType.Int32:case p.DataType.Float:return String(this.get());case p.DataType.String:e=this.get();break;case p.DataType.Animation:case p.DataType.Corner:case p.DataType.Rect:case p.DataType.TextShadow:case p.DataType.WebkitTextStroke:case p.DataType.Transition:case p.DataType.BorderImage:case p.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}static DataInfo=class{value=null;index=-1};data}class m{static JsvDeclarePrototype(){for(let e in u){let t=u[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(m.prototype,s,i)}}}constructor(e){this.#u=e}setProperty(e,t){if(document.jsvCheckStyleFormat?.(e,t),e==u.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient")){t.match(/\(/g).length!=t.match(/\)/g).length&&(console.error(`StyleError: illegal linear-gradient value '${t}'`),t="")}else{t=new o(t).href}else if(e==u.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new o(e[0]).href),t=e.join(" ")}else e==u.Effect.Display&&(this.#p[e]=t);l.Dom.SetStyleProperty(this.#u,e,t)}getPropertyValue(e){if(e==u.Effect.Display)return this.#p[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=l.Dom.GetStyleProperties(this.#u,t);return JSON.parse(s)}#u;#p={}}class v extends t{constructor(e){super(e)}}class f extends h{static 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"};static JsvEnableEventListener(){l.Dom.EnableEventListener((function(e,t,...s){const i=f.#m[e]?.[t];i?.(t,...s)}))}constructor(e){super(h.ELEMENT_NODE),this.tagName=e,this.tagName!=f.JsvTagName.Audio&&this.tagName!=f.JsvTagName.Div&&this.tagName!=f.JsvTagName.Image&&this.tagName!=f.JsvTagName.Video&&this.tagName!=f.JsvTagName.JsvFDiv||(this.jsvNativeId=d.GenerateId(),this.style=new m(this.jsvNativeId),l.Dom.CreateElement(this.jsvNativeId,e)),this.jsvAttrStore={},this.clientSizeStore={}}appendChild(e){e.parentNode?this.#v(e,null):(super.appendChild(e),this.#f(e,null))}removeChild(e){super.removeChild(e),this.#g(e),e.jsvNativeId&&l.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?this.#v(e,t):(super.insertBefore(e,t),this.#f(e,t))}addEventListener(e,t,s){this.jsvGetEventListenerSet(e)?.has(t)?console.warn("Element.addEventListener() Faild to add listener, func is exists"):(s=this.#w(s),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),l.Dom.AddElementEventListener(this.jsvNativeId,e,s)),super.addEventListener(e,t,s))}removeEventListener(e,t,s){0!=!!this.jsvGetEventListenerSet(e)?.has(t)&&(s=this.#w(s),super.removeEventListener(e,t,s),this.jsvNativeId&&(this.jsvRemoveListener(this.jsvNativeId,e),l.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.clientSizeStore.clientWidth||(this.clientSizeStore.clientWidth=l.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.clientSizeStore.clientWidth}get clientHeight(){return this.clientSizeStore.clientHeight||(this.clientSizeStore.clientHeight=l.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.clientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?l.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?l.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&l.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&&l.Dom.SetElementAttribute(this.jsvNativeId,e,null)}getAttribute(e){return this.jsvAttrStore[e]}hasAttribute(e){return!!this.jsvAttrStore[e]}focus(){document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new n(n.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new n(n.JsvType.Focus);document.dispatchEvent(t)}jsvGetBoundingClientRect(){const e="jsvgetbound",t=d.GenerateId();return new Promise(((s,i)=>{const n=r=>{const o=r.jsvParams?.[1];if(o!=t)return;r.preventDefault(),this.removeEventListener(e,n);const a=JSON.parse(r.jsvParams?.[0]??"{}");0===a.status?s(a.data):i(a.error)};this.addEventListener(e,n,{jsvtoken:t})}))}jsvSetOnLazyTaskSyncedListener(e){l.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...t){let n;e.startsWith("animation")?(n=new s(e),n.animationName=t[0]):e.startsWith("transition")?(n=new v(e),n.propertyName=t[0]):e.startsWith("jsv")&&(n=new i(e),n.options={detail:t[0]},n.jsvParams=t),n&&(n.target=this,this.dispatchEvent(n))}jsvGetProxyView(e){return e?(this._MaskViewProxy||(this._MaskViewProxy=r.NewDomProxyView(this.jsvNativeId,!0)),this._MaskViewProxy):(this._MainViewProxy||(this._MainViewProxy=r.NewDomProxyView(this.jsvNativeId,!1)),this._MainViewProxy)}jsvGetProxyTexture(e){return this._MainViewTextureProxy||(this._MainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this._MainViewTextureProxy}jsvGetRelativePosition(e){return l.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}jsvAddListener(e,t){let s=f.#m[e];s||(s=new Map,f.#m[e]=s);this.jsvGetEventListenerSet(t)||(s[t]=this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let s=f.#m[e];if(!s)return;this.jsvGetEventListenerSet(t)||s.delete(t)}#v(e,t){let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.#y(s,e,t)}#y(e,t,s){t.jsvNativeId&&(s=f.#T(s),l.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}#f(e,t){e.parentNode=this,e.nodeType===h.TEXT_NODE?this.textContent=e.nodeValue:e.jsvNativeId&&(t=f.#T(t),l.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#g(e){for(const t of e.childNodes)e.#g(t);e.jsvFinalize(),l.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),delete f.#m[e.jsvNativeId]}#w(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#T(e){let t=e;for(;t&&!(t instanceof f);)t=t.nextSibling;return t}parentNode;tagName;style;jsvNativeId;jsvAttrStore;static#m={}}class g extends f{constructor(){super(f.JsvTagName.Anchor),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return f.TAG.ANCHOR}}class w extends h{constructor(e){super(h.COMMENT_NODE),this.textContent=e}}class y extends f{constructor(){super(f.JsvTagName.Div)}get textContent(){return this.#C}set textContent(e){this.#C=e,this.clientSizeStore={},l.Dom.SetElementText(this.jsvNativeId,e)}#C}const T="__AppRoot__";class C{constructor(e,t){this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new k(!1,t))}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==T?"":e}wrapWithNameSpace(e){let t=new C(!0);return t._DefaultFocusNameSpace=e,t.RouterDelegate=this.RouterDelegate,t}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t){if("string"==typeof e)return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t);console.error(`setFocus name=${e} is invalid`)}setFocus(e,t){return this._DefaultFocusNameSpace&&this._DefaultFocusNameSpace.length>0&&(e=`${this._DefaultFocusNameSpace}.${e}`),this.focusByNameBeforeMount(e,t)}printAllFocusable(){this.RouterDelegate.ref.printAllFocusRecursive(this._DefaultFocusNameSpace,"")}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof b;){let s=t.RouterDelegate.ref.NameSpace;e.push({nameSpace:s==T||s==t.BranchName?"":s,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(b.sLastFocus){let e=b.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}returnFocusToParent(){const e=this.RouterDelegate.ref.getCurrentFocusNode();e?e.ReturnFocusToParent():console.warn("returnFocusToParent: current focus node is null.")}}class k{constructor(e,t){this._IsTemp=!!e,this._ChildMap={},this._FocusNameBeforeMount=null,this._FocusNodeName=null,this.NameSpace=t}getCurrentFocusNode(){if(null==this._FocusNodeName)return null;let e=this._ChildMap[this._FocusNodeName];if(e.RouterDelegate.ref!=this){let t=e.RouterDelegate.ref.getCurrentFocusNode();return null==t?e:t}return e}getNodeByName(e,t){let s=e.split(".");return this._FindRouterSearchBase(s,t)._GetNodeFromPathArray(s,e)}printAllFocusRecursive(e,t){let s=this.NameSpace==T?"":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?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 r=i._ChildMap[t].RouterDelegate.ref;if(r!=i&&r.NameSpace==e[s]){i=r,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),this._FocusNameBeforeMount=null);else{this._FocusNameBeforeMount[0]==e&&(t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1)),this._FocusNameBeforeMount=null)}}remove(e,t){let s=this._ChildMap[e];s&&s==t&&(delete this._ChildMap[e],s.OnRemoveFromTree())}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}focusBeforeMount(e,t){let s=!1;if("string"==typeof e){if(!e.includes(".")){s=!0;let i=this._ChildMap[e];return this._FocusNodeName=e,i?(i.Focus(!t),i.RouterDelegate.ref!=this&&i.RouterDelegate.ref.clearChildFocus(),!0):(this._FocusNameBeforeMount=e,!1)}}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(s=!0,1==e.length)return this.focusBeforeMount(e[0]);{let t=e[0],s=this._ChildMap[t];return this._FocusNodeName=t,s?s.RouterDelegate.ref.focusBeforeMount(e.slice(1)):(this._FocusNameBeforeMount=e,!1)}}return s||console.error("illegal name param",e),!1}focus(e,t){let s=this.focusBeforeMount(e,t);return s||console.log("No found branch:"+e),s}forEach(e){for(let t in this._ChildMap)e(this._ChildMap[t],t,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class b extends r.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.BranchName=e,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}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 C(!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 k(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}routerUnbind(){let e;this.AsHub?this.GetParentPage()&&(e=this.GetParentPage().RouterDelegate.ref):e=this.RouterDelegate.ref,e&&e.remove(this.BranchName,this)}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}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=b.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=b.safeCallback(e)}setOnFocus(e){this._OnFocus=b.safeCallback(e)}setOnBlur(e){this._OnBlur=b.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=b.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=b.safeCallback(e)}setOnCustomerEvent(e){this._OnCustomerEvent=b.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=b.safeCallback(e),this._DKeyUpProxy=b.safeCallback(t)}requestFocus(e){let t=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(t=this.GetParentPage().RouterDelegate.ref),t?t.focus(this.BranchName,e):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomerEvent(e){return!!this._OnCustomerEvent&&this._OnCustomerEvent(e)}bubbleCustomerEvent(e){this.BubbleCustomerEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return this._DKeyDownProxy?this._DKeyDownProxy(e,this._OriginDispatchKeyDown):this._OriginDispatchKeyDown(e)}_OriginDispatchKeyDown(e){let t=!1;return this._DispatchKeyDown&&(t=this._DispatchKeyDown(e)),!!t||super.DispatchKeyDown(e)}dispatchKeyUp(e){return this.DispatchKeyUp(e)}DispatchKeyUp(e){return this.__DKeyUpProxy?this.__DKeyUpProxy(e,this._OriginDispatchKeyUp):this._OriginDispatchKeyUp(e)}_OriginDispatchKeyUp(e){let t=!1;return this._DispatchKeyUp&&(t=this._DispatchKeyUp(e)),!!t||super.DispatchKeyUp(e)}attachToActivity(e,t){this.AttachToActivity(e,t)}AttachToActivity(e,t){super.SetParent(e,t)}setParent(e){this.SetParent(e)}SetParent(e){if(null!=e&&(super.SetParent(e,null),this._ParentPage._Mounted&&(this.updateMountState(),D()),e instanceof b)){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 b.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(){b.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(){b.sLastFocus==this&&(b.sLastFocus=null);let e=this.GetParentPage();e&&e.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind()}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]==T)break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return t[0]==T?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}b.sFocusMemos=[],b.sLastFocus=null,b.sRootPageNode=null;let D=()=>{let e=b.sFocusMemos.length;if(e>0){let t=b.sFocusMemos;b.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},N={};class E{constructor(e,t,s){this._Element=s,N.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),N[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),window.JsView?t.attachToActivity(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.RootView):(window.addEventListener("keydown",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())})))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),D()}}class x extends f{constructor(){super(f.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new o(t).href,this.clientSizeStore={}}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&l.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 S extends f{constructor(){super(f.JsvTagName.Link),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new o(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 I extends f{constructor(){super(f.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new o(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})}src=null;onerror=null;onload=null;charset=null;timeout=120}class O extends f{constructor(){super(f.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class L extends f{constructor(){super(f.JsvTagName.Svg)}}class F extends h{constructor(e){super(h.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let B=1;class M extends f{constructor(){super(f.JsvTagName.JsvFDiv),this.FocusNodeRef=new b(""+B++),this.HubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new C(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.HubRef}}class J extends h{constructor(){super(h.DOCUMENT_NODE),this.location=window.location,this.rootElement=new y,this.rootElement.ownerDocument=this,this.rootElement.id="root",l.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new w(e)}createElement(e){switch(e=e.toUpperCase()){case f.JsvTagName.Anchor:return new g;case f.JsvTagName.Div:return new y;case f.JsvTagName.Image:return new x;case f.JsvTagName.Link:return new S;case f.JsvTagName.Script:return new I;case f.JsvTagName.Style:return new O;case f.JsvTagName.Svg:return new L;case f.JsvTagName.JsvFDiv:return new M;case f.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:new t(e)}createTextNode(e){return new F(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMError("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===f.JsvTagName.Head)return[this.head];if(e===f.JsvTagName.Link||e===f.JsvTagName.Script||e===f.JsvTagName.Style)return[];throw new DOMError("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(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMError("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new E(e,t,s)}}class R extends f{constructor(){super(f.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof S||e instanceof I)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class P{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 _ extends P{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 j="@keyframes",A=j.length;class V{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.#k(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),l.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),l.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}#k(e){let t=e.indexOf(j)+A,s=e.indexOf("{");return e.substring(t,s).trim()}}let U=null;function W(e){return U||(U={global:new V("global")}),U.global}class z{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,z.#b(e,t),f.JsvEnableEventListener(),m.JsvDeclarePrototype()}static#b(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=l.Dom.DeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=W),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new _)}}class H{static SetLevel(e){switch(H.E=H.W=H.I=H.D=function(){},e){case H.Level.Verbose:H.V=console.debug.bind(console);case H.Level.Debug:H.D=console.debug.bind(console);case H.Level.Info:H.I=console.info.bind(console)}}static E=console.error.bind(console);static W=console.warn.bind(console);static I=console.info.bind(console);static D=function(){};static V=function(){};static Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4}}class K{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof h))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 G{constructor(){this.#D(),G.#N()}#D(){r.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{l.Dom.RequestSwapAllCachedTasks()})),window.JsvCode.ForgeHandles.setHandles(new r.TextureManager,null,null);let e=null;r.DesignMap&&(e=r.DesignMap(),r.sRenderBridge.InitScreenBuffer(e.displayScale,e.width)),r.DomElementGetter=e=>{let t=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.GetInstance(t).forgeElementGetter(e)}}static SetRender(e){G.#N=e,window.Forge.RunApp({})}static#N=null}class q extends O{constructor(){super(),this.jsvBrowserElement=window.JsvCode.Dom.BrowserDocument.createElement(Element.JsvTagName.Style)}jsvBrowserElement}class $ extends R{constructor(){super()}appendChild(e){"HTMLLinkElement"==e.constructor.name||"HTMLScriptElement"==e.constructor.name?window.JsvCode.Dom.BrowserDocument.head.appendChild(e):e instanceof q?window.JsvCode.Dom.BrowserDocument.head.appendChild(e.jsvBrowserElement):super.appendChild(e)}removeChild(e){"HTMLLinkElement"==e.constructor.name||"HTMLScriptElement"==e.constructor.name?window.JsvCode.Dom.BrowserDocument.head.removeChild(e):e instanceof q?window.JsvCode.Dom.BrowserDocument.head.removeChild(e.jsvBrowserElement):super.removeChild(e)}}class X extends J{constructor(){super(),this.head=new $}createElement(e){switch(e=e.toUpperCase()){case f.JsvTagName.IFrame:case f.JsvTagName.Link:case f.JsvTagName.Script:return window.JsvCode.Dom.BrowserDocument.createElement(e);case f.JsvTagName.Style:return new q;default:return super.createElement(e)}}getElementsByTagName(e){return e.toUpperCase()===f.JsvTagName.Head?window.JsvCode.Dom.BrowserDocument.getElementsByTagName(e):super.getElementsByTagName(e)}}class Y{static Get(e){return Y.#E[e]}static#x(e,t){let s=void 0===t;return s&&console.error(e+" property is undefined!"),s}static#S(e,t){return!!Y.#x(e,t)||(""===t||"number"==typeof t)}static#I(e,t){Y.#x(e,t)||t.indexOf("transform")<0&&t.indexOf("opacity")<0&&console.error("keyframes property is only support transform and opacity, value:",t)}static#O(e,t){if(Y.#x(e,t))return;const s="fill contain cover none scale-down";s.indexOf(t)<0&&console.error(" objectFit is only support one of string["+s+"]")}static#L(e,t){Y.#x(e,t)||console.error(e+" property is not support, you can use transition property, e.g. transition='width 2s'")}static#F(e,t){Y.#x(e,t)||t.length>0&&(t.indexOf("left")<0&&t.indexOf("top")<0&&t.indexOf("width")<0&&t.indexOf("height")<0&&t.indexOf("transform")<0||t.indexOf("all")>=0)&&console.error("transition property's value only support [top, left, width, height, transform] value:",t)}static#B(e,t){Y.#x(e,t)||t.length>0&&t.indexOf("translate3d")<0&&t.indexOf("scale3d")<0&&t.indexOf("rotate3d")<0&&t.indexOf("skew")<0&&console.error("transform property's value only support translate3d、scale3d、rotate3d、skew, value:",t)}static#M(e,t){Y.#x(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("transformOrigin property's value only support XX%、left、top、right, bottom:",t)}static#J(e,t){if(!Y.#x(e,t))switch(t){case"clip":case"ellipsis":break;default:console.error("textOverflow property's value is not support, value:",t)}}static#R(e,t){if(!Y.#x(e,t))switch(t){case"normal":case"nowrap":case"pre-wrap":break;default:console.error("whiteSpace property's value is not support, value:",t)}}static#P(e,t){if(!Y.#x(e,t))switch(t){case"left":case"right":case"center":case"start":case"end":break;default:console.error("textAlign property's value is not support, value:",t)}}static#_(e,t){if(!Y.#S(e,t))switch(t){case"normal":case"inherit":console.error("lineHeight property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("lineHeight property's value is support number only, value:",t)}}static#j(e,t){Y.#x(e,t)||Y.#A("Color()",t)}static#V(e,t){Y.#x(e,t)||"visible"!==t&&"hidden"!==t&&"inherit"!==t&&console.error("visibility property's value is not support, value:",t)}static#U(e,t){Y.#x(e,t)||"block"!==t&&"inline"!==t&&"none"!==t&&"inline-block"!==t&&"inherit"!==t&&""!==t&&console.error("display property's value is not support, value:",t)}static#W(e,t){Y.#x(e,t)||"visible"!==t&&"hidden"!==t&&console.error("overflow property's value is support visible or hidden only, value:",t)}static#z(e,t){if(!Y.#S(e,t))switch(t){case"auto":case"inherit":console.error("top property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("top property's value is support number only, value:",t)}}static#H(e,t){if(!Y.#S(e,t))switch(t){case"auto":case"inherit":console.error("left property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("left property's value is support number only, value:",t)}}static#K(e,t){if(!Y.#S(e,t))switch(t){case"auto":case"inherit":console.error("height property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("height property's value is support number only, value:",t)}}static#G(e,t){if(!Y.#S(e,t))switch(t){case"auto":case"inherit":console.error("width property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("width property's value is support number only, value:",t)}}static#q(e,t){if(!Y.#x(e,t))switch(t){case"visible":case"hidden":break;default:console.error("backfaceVisibility property's value is support visible/hidden only, value: ",t)}}static#$(e,t){Y.#x(e,t)}static#X(e,t){if(Y.#x(e,t))return;t.split(" ").length<2&&console.error("Error: WebkitTextStroke should format of(width color) such as: '1px rgba(255,255,255,1.0)'")}static#Y(e,t){Y.#x(e,t)||isNaN(t)&&console.error("zIndex property's value is support number only, value: ",t)}static#Z(e,t){if(!Y.#S(e,t))switch(t){case"smaller":case"larger":case"inherit":case"x-small":case"xx-small":case"small":case"large":case"medium":case"x-large":case"xx-large":console.error("fontSize property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("fontSize property's value is support number only, value:",t)}}static#Q(e,t){Y.#x(e,t)||"bold"!==t&&console.error("fontWeight property's value is support bold only, value:",t)}static#ee(e,t){Y.#x(e,t)||"italic"!==t&&console.error("fontWeight property's value is support italic only, value:",t)}static#te(e,t){if(Y.#x(e,t))return;let s=[t];"string"==typeof t&&(s=t.split(" ")),s.length>4&&console.error("borderRadius property's value is not support, value:",t)}static#se(e,t){Y.#S(e,t)}static#ie(e,t){if(Y.#x(e,t))return;t.split(" ").length>4&&console.error("borderImageOutsetCheck property's value is not support, value:",t)}static#ne(e,t){Y.#x(e,t)||t.indexOf("fill")<0&&console.error("borderImage property's value is not contain fill, e.g. source slice, but value:",t)}static#re(e,t){console.error(e+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`")}static#oe(e,t){Y.#x(e,t)||"inherit"==t&&console.error("backgroundImage property's value is not support, value:",t)}static#ae(e,t){if(!Y.#x(e,t))return Y.#A("backgroundColor",t)}static#ce(e,t){}static#le(e,t){console.error(e+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'")}static#de(e,t){if(!Y.#x(e,t))switch(t){case"flat":case"preserve-3d":break;default:console.error("transformStyle property value is not valid",t)}}static#he(e,t){Y.#x(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("perspectiveOrigin property's value only support XX%、left、top、right, bottom:",t)}static#ue(e,t){if(!Y.#x(e,t)&&t.length>0){if(t.replace(/\(.*\)/g,"").split(",").length>1)return void console.error("textShadow: NOT support more than one part settings");const e=t.split(" ");if(4!==e.length&&(5!==e.length||0!==e[4].length)||isNaN(parseInt(e[0]))||isNaN(parseInt(e[1])))console.error('textShadow: format should be "offsetX offsetY blurSize color"(0 0 1 rgba(100,100,100,1)), !NOT space in rgba()');else{if(!(parseFloat(e[2])>0))return void console.error(`textShadow: blur shadow above 0(now=${t})`);if(!Y.#A("textShadow",e[3]))return}}}static#A(e,t){if(0===t.indexOf("rgba(")||0===t.indexOf("rgb("));else{if(0!==t.indexOf("#"))return console.error(`${e} color value is not valid, need startwith rgba or #, value:[${t}]`),!1;if(7!==t.length)return console.error(`${e} color value's length is not valid, value:${t}`),!1}return!0}static#pe(e,t){Y.#x(e,t)||"number"!=typeof t&&console.error("JsvTextLatex property's value is support number only, value: ",t)}static#me(e,t){Y.#x(e,t)||"number"!=typeof t&&console.error("JsvTextEmoji property's value is support number only, value: ",t)}static#ve(e,t){if(!Y.#x(e,t))switch(t){case"ltr":case"rtl":break;default:console.error("direction property's value is not support, value:",t)}}static#fe(e,t){Y.#x(e,t)||"number"!=typeof t&&console.error("JsvTextAlignMinWidth property's value is support number only, value: ",t)}static#ge(e,t){if(!Y.#x(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextVerticalAlign property's value is not support, value: ",t)}}static#we(e,t){if(!Y.#x(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextLineAlign property's value is not support, value: ",t)}}static#ye(e,t){if(!Y.#x(e,t))switch(t){case"unset":case"ltr":case"rtl":break;default:console.error("JsvTextInnerDirection property's value is not support, value: ",t)}}static#E={animation:{check:Y.#ce},animationName:{check:Y.#le},animationDuration:{check:Y.#le},animationTimingFunction:{check:Y.#le},animationDelay:{check:Y.#le},animationIterationCount:{check:Y.#le},animationDirection:{check:Y.#le},animationPlayState:{check:Y.#le},animationFillMode:{check:Y.#le},background:{check:Y.#re},backgroundColor:{check:Y.#ae},backgroundImage:{check:Y.#oe},borderImage:{check:Y.#ne},borderImageOutset:{check:Y.#ie},borderImageWidth:{check:Y.#se},borderRadius:{check:Y.#te},height:{check:Y.#K},width:{check:Y.#G},zIndex:{check:Y.#Y},fontFamily:{check:null},fontSize:{check:Y.#Z},fontStyle:{check:Y.#ee},fontWeight:{check:Y.#Q},left:{check:Y.#H},overflow:{check:Y.#W},top:{check:Y.#z},visibility:{check:Y.#V},display:{check:Y.#U},color:{check:Y.#j},lineHeight:{check:Y.#_},textAlign:{check:Y.#P},direction:{check:Y.#ve},whiteSpace:{check:Y.#R},textOverflow:{check:Y.#J},transform:{check:Y.#B},transformOrigin:{check:Y.#M},transition:{check:Y.#F},transitionProperty:{check:Y.#L},transitionDuration:{check:Y.#L},transitionTimingFunction:{check:Y.#L},transitionDelay:{check:Y.#L},keyframes:{check:Y.#I},objectFit:{check:Y.#O},perspective:{check:Y.#$},backfaceVisibility:{check:Y.#q},transformStyle:{check:Y.#de},perspectiveOrigin:{check:Y.#$},WebkitTextStroke:{check:Y.#X},textShadow:{check:Y.#ue},JsvTextLatex:{check:Y.#pe},JsvTextEmoji:{check:Y.#me},JsvTextAlignMinWidth:{check:Y.#fe},JsvTextVerticalAlign:{check:Y.#ge},JsvTextLineAlign:{check:Y.#we},JsvTextInnerDirection:{check:Y.#ye}}}class Z{static BackupBrowser(){return{createComment:window.document.createComment.bind(window.document),createElement:window.document.createElement.bind(window.document),createElementNS:window.document.createElementNS.bind(window.document),createTextNode:window.document.createTextNode.bind(window.document),dispatchEvent:window.document.dispatchEvent.bind(window.document),getElementById:window.document.getElementById.bind(window.document),getElementsByTagName:window.document.getElementsByTagName.bind(window.document),querySelector:window.document.querySelector.bind(window.document),head:{appendChild:window.document.head.appendChild.bind(window.document.head),removeChild:window.document.head.removeChild.bind(window.document.head)}}}static HookBrowser(e){Z.#Te(e),Z.#Ce(),Z.#ke()}static#Te(e){window.JsvCode.Dom.BrowserDocument=e;const t=new X;window.document.createComment=t.createComment.bind(t),window.document.createElement=t.createElement.bind(t),window.document.createTextNode=t.createTextNode.bind(t),window.document.dispatchEvent=t.dispatchEvent.bind(t),window.document.getElementById=t.getElementById.bind(t),window.document.getElementsByTagName=t.getElementsByTagName.bind(t),window.document.querySelector=t.querySelector.bind(t),window.document.head.appendChild=t.head.appendChild.bind(t.head),window.document.head.removeChild=t.head.removeChild.bind(t.head),window.JsvCode.Dom.JsViewDocument=t}static#Ce(){window.MutationObserver=K,window.Element=f,window.SVGElement=L}static#ke(){const e=window.JsvCode.Dom.JsViewDocument;window.document.jsvInitFDivRoot=e.jsvInitFDivRoot.bind(e),window.document.jsvCheckStyleFormat=window.jsvInAndroidWebView?null:Z.#be}static#be(e,t){if(e.startsWith("--"))return;let s=Y.Get(e);s?s.check&&t&&s.check(e,t):console.error(e+" property is not support.")}}window.jsvIsBrowserDebug=!0;const Q=window.JsvCode.BrowserPlatformDomBridge,ee=window.JsvCode.BrowserPlatformMediaBridge;function te(){const e=Z.BackupBrowser();Q.RegisterOriginDocument(e),z.EnsureGlobalEnv(Q,ee),Z.HookBrowser(e),H.I("Using JsView HTML Environment.")}export{G as BrowserForgeApp,te as InitEnv};
2
2
 
@@ -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.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.#e=!0}jsvIsPrevented(){return this.#e}#e=!1}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}options}class n extends t{constructor(e){super(e)}}void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var a=window.Forge;class o{constructor(e,t){if(!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:"))return void(this.href=e);let s=e.indexOf("://");if(!(s<0||s>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if(!0===e.startsWith("./")&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.MainPath||"undefined"===window.JsView.Dom.MainPathRef||window.JsView.Dom.MainPathRef!==document.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.MainPathRef=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.MainPath=document.location.origin+document.location.pathname.substring(0,e)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let i=this.href,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let a=i.indexOf("?");a>1&&(this.search=i.substring(a),i=i.substring(0,a));let o=i,r=o.indexOf("://");this.protocol=r>0?o.substring(0,r+1):"";let l=r>1?o.substring(r+3):"";r=l.indexOf("/"),this.host=r>0?l.substring(0,r):"",this.pathname=r>=1?l.substring(r):"","file:"==this.protocol&&(this.host="",this.pathname=l),this.origin=this.protocol+"//"+this.host,r=this.host.indexOf(":"),this.hostname=r>0?this.host.substring(0,r):this.host,this.port=r>1?this.host.substring(r+1):""}replace(e){this.href=e}href="";origin="";protocol="";host="";hostname="";port="";pathname="";search="";hash=""}class r{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){r.#t(r.#s.CreateElement,e,t)}static BindElementToRootView(e){r.#t(r.#s.BindElementToRootView,e)}static InsertElementChild(e,t,s){r.#t(r.#s.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){r.#t(r.#s.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){r.#t(r.#s.MoveElementChild,e,t,s,i)}static AddElementEventListener(e,t,s){r.#t(r.#s.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){r.#t(r.#s.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){r.#t(r.#s.SetElementText,e,t)}static SetElementAttribute(e,t,s){r.#t(r.#s.SetElementAttribute,e,t,s),r.#i.has(e)&&r.#n.add(e)}static GetElementBoundingClientStyles(e,t){return r.#a(r.#s.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),r.#t(r.#s.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){r.#t(r.#s.DeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){r.#t(r.#s.SetStyleProperty,e,t,s),r.#i.has(e)&&r.#n.add(e)}static GetStyleProperties(e,t){return r.#a(r.#s.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){r.#i.set(e,t)}static RemoveLazyTaskSyncedListener(e){r.#i.delete(e)}static RequestSwapAllCachedTasks(){if(0==r.#o.length)return;const e=JSON.stringify(r.#o);r.#o=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of r.#n){r.#i.get(e)?.()}r.#n.clear()}static GetElementAttribute(e,t){return r.#a(r.#s.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){r.#t(r.#s.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){r.#t(r.#s.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=r.#a(r.#s.GetRelativePosition,e,t);return JSON.parse(s)}static#a(e,t,...s){r.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static#t(e,t,...s){r.#o.push([e,t,...s]),a.sRenderBridge?.RequestSwap()}static#o=[];static#n=new Set;static#i=new Map;static#s={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42}}class l{static CreateAudioPlayer(e){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer(e)}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}}class c{static Dom=r;static Media=l}class h{static GenerateId(){const e=this.#r++;if(e>=this.#l)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}static#r=0;static#l=Math.pow(2,31)-1}class d{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[]}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.#c?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMError("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=void 0,this.#c?.()}insertBefore(e,t){this.#h(e,t)}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("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(t<0)throw new DOMError("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.#d||(this.#d={});let i=this.#d[e];i||(i=new Set,this.#d[e]=i),i.add(t)}removeEventListener(e,t,s){let i=this.#d?.[e];i&&(i.delete(t),i.size<=0&&this.#d.hasOwnProperty(e)&&delete this.#d[e],0===Object.values(this.#d).length&&(this.#d=void 0))}dispatchEvent(e){if(!this.#d)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.#d[e.type];if(t){e.target||(e.target=document.activeElement);for(let s of t)if(s?.(e),e.jsvIsPrevented())break}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.#c=e}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);i<0&&Log.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t.#h(e,s)}jsvGetEventListenerSet(e){const t=this.#d?.[e];return t}#h(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMError("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 DOMError("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.#c?.()}#d=void 0;#c=void 0;static ELEMENT_NODE=1;static TEXT_NODE=3;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static NOLAYOUT_NODE=10}class u{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(e){switch(e){case u.Layout.Height:case u.Layout.Left:case u.Layout.Top:case u.Layout.Width:case u.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==u.Layout.Height?u.Layout.Height:e==u.Layout.Left?u.Layout.Left:e==u.Layout.Top?u.Layout.Top:e==u.Layout.Width?u.Layout.Width:e==u.Background.BackgroundColor?u.Background.BackgroundColor:e==u.Background.BackgroundImage?u.Background.BackgroundImage:e==u.Background.BorderRadius?u.Background.BorderRadius:e==u.Effect.BackfaceVisibility?u.Effect.BackfaceVisibility:e==u.Effect.BorderImage?u.Effect.BorderImage:e==u.Effect.BorderImageWidth?u.Effect.BorderImageWidth:e==u.Effect.BorderImageOutset?u.Effect.BorderImageOutset:e==u.Effect.Display?u.Effect.Display:e==u.Effect.ObjectFit?u.Effect.ObjectFit:e==u.Effect.Opacity?u.Effect.Opacity:e==u.Effect.Overflow?u.Effect.Overflow:e==u.Effect.Perspective?u.Effect.Perspective:e==u.Effect.PerspectiveOrigin?u.Effect.PerspectiveOrigin:e==u.Effect.Transform?u.Effect.Transform:e==u.Effect.TransformOrigin?u.Effect.TransformOrigin:e==u.Effect.TransformStyle?u.Effect.TransformStyle:e==u.Effect.Visibility?u.Effect.Visibility:e==u.Effect.ZIndex?u.Effect.ZIndex:e==u.Text.Color?u.Text.Color:e==u.Text.FontFamily?u.Text.FontFamily:e==u.Text.FontSize?u.Text.FontSize:e==u.Text.FontStyle?u.Text.FontStyle:e==u.Text.FontWeight?u.Text.FontWeight:e==u.Text.LineHeight?u.Text.LineHeight:e==u.Text.TextAlign?u.Text.TextAlign:e==u.Text.TextOverflow?u.Text.TextOverflow:e==u.Text.TextShadow?u.Text.TextShadow:e==u.Text.WebkitTextStroke?u.Text.WebkitTextStroke:e==u.Text.WhiteSpace?u.Text.WhiteSpace:e==u.Text.WordWrap?u.Text.WordWrap:e==u.Text.Direction?u.Text.Direction:e==u.Text.JsvTextEmoji?u.Text.JsvTextEmoji:e==u.Text.JsvTextLatex?u.Text.JsvTextLatex:e==u.Text.JsvTextAlignMinWidth?u.Text.JsvTextAlignMinWidth:e==u.Text.JsvTextVerticalAlign?u.Text.JsvTextVerticalAlign:e==u.Text.JsvTextLineAlign?u.Text.JsvTextLineAlign:e==u.Text.JsvTextInnerDirection?u.Text.JsvTextInnerDirection:e==u.Motion.Animation?u.Motion.Animation:e==u.Motion.Transition?u.Motion.Transition:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class v{static Base=class{constructor(e){this.rawValue=e}rawValue};static AnimationImpl=class extends v.Base{constructor(e){super(e)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends v.Base{constructor(e){super(e)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends v.Base{constructor(e){super(e)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends v.Base{constructor(e){super(e)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends v.Base{constructor(e){super(e)}length=0;color=void 0};static TransitionImpl=class extends v.Base{constructor(e){super(e)}animationMap=new Map};static BorderImageImpl=class extends v.Base{constructor(e){super(e)}source="";slice=null};static BackgroundImageImpl=class extends v.Base{constructor(e){super(e)}type=0;static eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2};static LinearGradient=class{fromX=0;fromY=0;toX=0;toY=0;stops=[]};linearGradient;urlPath=""};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10;static BackgroundImage=11};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(e){let t=-1,s=null;null==e?t=v.DataType.Null:Number(e)===e&&e%1==0?t=v.DataType.Int32:Number(e)===e&&e%1!=0?t=v.DataType.Float:"string"==typeof e||e instanceof String?t=v.DataType.String:e instanceof v.AnimationImpl?t=v.DataType.Animation:e instanceof v.CornerImpl?t=v.DataType.Corner:e instanceof v.RectImpl?t=v.DataType.Rect:e instanceof v.TextShadowImpl?t=v.DataType.TextShadow:e instanceof v.WebkitTextStrokeImpl?t=v.DataType.WebkitTextStroke:e instanceof v.TransitionImpl?t=v.DataType.Transition:e instanceof v.BorderImageImpl&&(t=v.DataType.BorderImage),e!=v.InvalidInt32&&e!=v.InvalidFloat&&e!=v.InvalidPointer?s=e:(t=v.DataType.Null,s=null),this.data=new v.DataInfo,this.data.index=t,this.data.value=s}toString(){let e=null;switch(this.data.index){case v.DataType.Null:return"";case v.DataType.Int32:case v.DataType.Float:return String(this.get());case v.DataType.String:e=this.get();break;case v.DataType.Animation:case v.DataType.Corner:case v.DataType.Rect:case v.DataType.TextShadow:case v.DataType.WebkitTextStroke:case v.DataType.Transition:case v.DataType.BorderImage:case v.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}static DataInfo=class{value=null;index=-1};data}class m{static JsvDeclarePrototype(){for(let e in u){let t=u[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(m.prototype,s,i)}}}constructor(e){this.#u=e}setProperty(e,t){if(document.jsvCheckStyleFormat?.(e,t),e==u.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient"));else{t=new o(t).href}else if(e==u.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new o(e[0]).href),t=e.join(" ")}else e==u.Effect.Display&&(this.#v[e]=t);c.Dom.SetStyleProperty(this.#u,e,t)}getPropertyValue(e){if(e==u.Effect.Display)return this.#v[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.#u,t);return JSON.parse(s)}#u;#v={}}class f extends t{constructor(e){super(e)}}class p extends d{static 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"};static JsvEnableEventListener(){c.Dom.EnableEventListener((function(e,t,...s){const i=p.#m[e]?.[t];i?.(t,...s)}))}constructor(e){super(d.ELEMENT_NODE),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=h.GenerateId(),this.style=new m(this.jsvNativeId),c.Dom.CreateElement(this.jsvNativeId,e)),this.jsvAttrStore={},this.clientSizeStore={}}appendChild(e){e.parentNode?this.#f(e,null):(super.appendChild(e),this.#p(e,null))}removeChild(e){super.removeChild(e),this.#g(e),e.jsvNativeId&&c.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?this.#f(e,t):(super.insertBefore(e,t),this.#p(e,t))}addEventListener(e,t,s){this.jsvGetEventListenerSet(e)?.has(t)?console.warn("Element.addEventListener() Faild to add listener, func is exists"):(s=this.#y(s),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),c.Dom.AddElementEventListener(this.jsvNativeId,e,s)),super.addEventListener(e,t,s))}removeEventListener(e,t,s){0!=!!this.jsvGetEventListenerSet(e)?.has(t)&&(s=this.#y(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.clientSizeStore.clientWidth||(this.clientSizeStore.clientWidth=c.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.clientSizeStore.clientWidth}get clientHeight(){return this.clientSizeStore.clientHeight||(this.clientSizeStore.clientHeight=c.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.clientSizeStore.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(){document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new n(n.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new n(n.JsvType.Focus);document.dispatchEvent(t)}jsvGetBoundingClientRect(){const e="jsvgetbound",t=h.GenerateId();return new Promise(((s,i)=>{const n=a=>{const o=a.jsvParams?.[1];if(o!=t)return;a.preventDefault(),this.removeEventListener(e,n);const r=JSON.parse(a.jsvParams?.[0]??"{}");0===r.status?s(r.data):i(r.error)};this.addEventListener(e,n,{jsvtoken:t})}))}jsvSetOnLazyTaskSyncedListener(e){c.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...t){let n;e.startsWith("animation")?(n=new s(e),n.animationName=t[0]):e.startsWith("transition")?(n=new f(e),n.propertyName=t[0]):e.startsWith("jsv")&&(n=new i(e),n.options={detail:t[0]},n.jsvParams=t),n&&(n.target=this,this.dispatchEvent(n))}jsvGetProxyView(e){return e?(this._MaskViewProxy||(this._MaskViewProxy=a.NewDomProxyView(this.jsvNativeId,!0)),this._MaskViewProxy):(this._MainViewProxy||(this._MainViewProxy=a.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=p.#m[e];s||(s=new Map,p.#m[e]=s);this.jsvGetEventListenerSet(t)||(s[t]=this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let s=p.#m[e];if(!s)return;this.jsvGetEventListenerSet(t)||s.delete(t)}#f(e,t){let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.#w(s,e,t)}#w(e,t,s){t.jsvNativeId&&(s=p.#T(s),c.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}#p(e,t){e.parentNode=this,e.nodeType===d.TEXT_NODE?this.textContent=e.nodeValue:e.jsvNativeId&&(t=p.#T(t),c.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#g(e){for(const t of e.childNodes)e.#g(t);e.jsvFinalize(),c.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),delete p.#m[e.jsvNativeId]}#y(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#T(e){let t=e;for(;t&&!(t instanceof p);)t=t.nextSibling;return t}parentNode;tagName;style;jsvNativeId;jsvAttrStore;static#m={}}class g extends p{constructor(){super(p.JsvTagName.Anchor),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return p.TAG.ANCHOR}}class y extends d{constructor(e){super(d.COMMENT_NODE),this.textContent=e}}class w extends p{constructor(){super(p.JsvTagName.Div)}get textContent(){return this.#D}set textContent(e){this.#D=e,this.clientSizeStore={},c.Dom.SetElementText(this.jsvNativeId,e)}#D}const T="__AppRoot__";class D{constructor(e,t){this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new N(!1,t))}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==T?"":e}wrapWithNameSpace(e){let t=new D(!0);return t._DefaultFocusNameSpace=e,t.RouterDelegate=this.RouterDelegate,t}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t){if("string"==typeof e)return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t);console.error(`setFocus name=${e} is invalid`)}setFocus(e,t){return this._DefaultFocusNameSpace&&this._DefaultFocusNameSpace.length>0&&(e=`${this._DefaultFocusNameSpace}.${e}`),this.focusByNameBeforeMount(e,t)}printAllFocusable(){this.RouterDelegate.ref.printAllFocusRecursive(this._DefaultFocusNameSpace,"")}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof E;){let s=t.RouterDelegate.ref.NameSpace;e.push({nameSpace:s==T||s==t.BranchName?"":s,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(E.sLastFocus){let e=E.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}returnFocusToParent(){const e=this.RouterDelegate.ref.getCurrentFocusNode();e?e.ReturnFocusToParent():console.warn("returnFocusToParent: current focus node is null.")}}class N{constructor(e,t){this._IsTemp=!!e,this._ChildMap={},this._FocusNameBeforeMount=null,this._FocusNodeName=null,this.NameSpace=t}getCurrentFocusNode(){if(null==this._FocusNodeName)return null;let e=this._ChildMap[this._FocusNodeName];if(e.RouterDelegate.ref!=this){let t=e.RouterDelegate.ref.getCurrentFocusNode();return null==t?e:t}return e}getNodeByName(e,t){let s=e.split(".");return this._FindRouterSearchBase(s,t)._GetNodeFromPathArray(s,e)}printAllFocusRecursive(e,t){let s=this.NameSpace==T?"":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?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 a=i._ChildMap[t].RouterDelegate.ref;if(a!=i&&a.NameSpace==e[s]){i=a,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),this._FocusNameBeforeMount=null);else{this._FocusNameBeforeMount[0]==e&&(t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1)),this._FocusNameBeforeMount=null)}}remove(e,t){let s=this._ChildMap[e];s&&s==t&&delete this._ChildMap[e]}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}focusBeforeMount(e,t){let s=!1;if("string"==typeof e){if(!e.includes(".")){s=!0;let i=this._ChildMap[e];return this._FocusNodeName=e,i?(i.Focus(!t),i.RouterDelegate.ref!=this&&i.RouterDelegate.ref.clearChildFocus(),!0):(this._FocusNameBeforeMount=e,!1)}}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(s=!0,1==e.length)return this.focusBeforeMount(e[0]);{let t=e[0],s=this._ChildMap[t];return this._FocusNodeName=t,s?s.RouterDelegate.ref.focusBeforeMount(e.slice(1)):(this._FocusNameBeforeMount=e,!1)}}return s||console.error("illegal name param",e),!1}focus(e,t){let s=this.focusBeforeMount(e,t);return s||console.log("No found branch:"+e),s}forEach(e){for(let t in this._ChildMap)e(this._ChildMap[t],t,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class E extends a.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.BranchName=e,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}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 D(!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 N(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}routerUnbind(){let e;this.AsHub?this.GetParentPage()&&(e=this.GetParentPage().RouterDelegate.ref):e=this.RouterDelegate.ref,e&&e.remove(this.BranchName,this)}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}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=E.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=E.safeCallback(e)}setOnFocus(e){this._OnFocus=E.safeCallback(e)}setOnBlur(e){this._OnBlur=E.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=E.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=E.safeCallback(e)}setOnCustomerEvent(e){this._OnCustomerEvent=E.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=E.safeCallback(e),this._DKeyUpProxy=E.safeCallback(t)}requestFocus(e){let t=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(t=this.GetParentPage().RouterDelegate.ref),t?t.focus(this.BranchName,e):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomerEvent(e){return!!this._OnCustomerEvent&&this._OnCustomerEvent(e)}bubbleCustomerEvent(e){this.BubbleCustomerEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return this._DKeyDownProxy?this._DKeyDownProxy(e,this._OriginDispatchKeyDown):this._OriginDispatchKeyDown(e)}_OriginDispatchKeyDown(e){let t=!1;return this._DispatchKeyDown&&(t=this._DispatchKeyDown(e)),!!t||super.DispatchKeyDown(e)}dispatchKeyUp(e){return this.DispatchKeyUp(e)}DispatchKeyUp(e){return this.__DKeyUpProxy?this.__DKeyUpProxy(e,this._OriginDispatchKeyUp):this._OriginDispatchKeyUp(e)}_OriginDispatchKeyUp(e){let t=!1;return this._DispatchKeyUp&&(t=this._DispatchKeyUp(e)),!!t||super.DispatchKeyUp(e)}attachToActivity(e,t){this.AttachToActivity(e,t)}AttachToActivity(e,t){super.SetParent(e,t)}setParent(e){this.SetParent(e)}SetParent(e){if(null!=e&&(super.SetParent(e,null),this._ParentPage._Mounted&&(this.updateMountState(),C()),e instanceof E)){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 E.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(){E.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(){E.sLastFocus==this&&(E.sLastFocus=null);let e=this.GetParentPage();e&&e.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind()}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]==T)break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return t[0]==T?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}E.sFocusMemos=[],E.sLastFocus=null,E.sRootPageNode=null;let C=()=>{let e=E.sFocusMemos.length;if(e>0){let t=E.sFocusMemos;E.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},S={};class b{constructor(e,t,s){this._Element=s,S.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),S[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),window.JsView?t.attachToActivity(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.RootView):(window.addEventListener("keydown",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())})))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),C()}}class x extends p{constructor(){super(p.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new o(t).href,this.clientSizeStore={}}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 L extends p{constructor(){super(p.JsvTagName.Link),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new o(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 I extends p{constructor(){super(p.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new o(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})}src=null;onerror=null;onload=null;charset=null;timeout=120}class R extends p{constructor(){super(p.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class M extends p{constructor(){super(p.JsvTagName.Svg)}}class _ extends d{constructor(e){super(d.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let P=1;class F extends p{constructor(){super(p.JsvTagName.JsvFDiv),this.FocusNodeRef=new E(""+P++),this.HubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new D(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.HubRef}}class k extends d{constructor(){super(d.DOCUMENT_NODE),this.location=window.location,this.rootElement=new w,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 y(e)}createElement(e){switch(e=e.toUpperCase()){case p.JsvTagName.Anchor:return new g;case p.JsvTagName.Div:return new w;case p.JsvTagName.Image:return new x;case p.JsvTagName.Link:return new L;case p.JsvTagName.Script:return new I;case p.JsvTagName.Style:return new R;case p.JsvTagName.Svg:return new M;case p.JsvTagName.JsvFDiv:return new F;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:new t(e)}createTextNode(e){return new _(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMError("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 DOMError("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(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMError("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new b(e,t,s)}}class j extends p{constructor(){super(p.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof L||e instanceof I)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class O{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 J extends O{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 B="@keyframes",A=B.length;class V{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.#N(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)}#N(e){let t=e.indexOf(B)+A,s=e.indexOf("{");return e.substring(t,s).trim()}}let W=null;function z(e){return W||(W={global:new V("global")}),W.global}class K{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,K.#E(e,t),p.JsvEnableEventListener(),m.JsvDeclarePrototype()}static#E(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.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=z),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new J)}}class G{static SetLevel(e){switch(G.E=G.W=G.I=G.D=function(){},e){case G.Level.Verbose:G.V=console.debug.bind(console);case G.Level.Debug:G.D=console.debug.bind(console);case G.Level.Info:G.I=console.info.bind(console)}}static E=console.error.bind(console);static W=console.warn.bind(console);static I=console.info.bind(console);static D=function(){};static V=function(){};static Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4}}class U{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof d))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 H extends k{constructor(){super(),this.head=new j}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}class q{static DeclareGlobal(){q.#C(),q.#S(),q.#b()}static#C(){window.document=new H}static#S(){window.MutationObserver=U,window.Element=p,window.SVGElement=M;let e=new o(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.history={},window.navigator={userAgent:"jsview-runtime"}}static#b(){window.JsView.Dom={Render:null,Extension:null,UrlRef:o}}}class ${constructor(e){this.activity=new a.ReactActivity("NativeForgeActivity",e,null,null),this.#x()}#x(){console.log("create NativeForgeActivity.");let e=new a.LayoutView;window.JsvCode.ForgeHandles.setHandles(this.activity.GetTextureManager(),e,this.activity);let t=null;a.DesignMap&&(t=a.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}),a.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{c.Dom.RequestSwapAllCachedTasks()})),window.JsView.Dom.Render()}}class X{constructor(e){this.activityManager=e;let t=new $(e);e.RegisterActivity(t.activity),e.StartActivity(new a.Intent("NativeForgeActivity"))}}window.jsvIsBrowserDebug=!1;const Y=window.JsvCode.NativePlatformDomBridge,Z=window.JsvCode.NativePlatformMediaBridge;function Q(){K.EnsureGlobalEnv(Y,Z),q.DeclareGlobal(),G.I("Using JsView Native Environment.")}export{Q as InitEnv,X 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.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.#e=!0}jsvIsPrevented(){return this.#e}#e=!1}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}options}class n extends t{constructor(e){super(e)}}void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var a=window.Forge;class o{constructor(e,t){if(!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:"))return void(this.href=e);let s=e.indexOf("://");if(!(s<0||s>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if(!0===e.startsWith("./")&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.MainPath||"undefined"===window.JsView.Dom.MainPathRef||window.JsView.Dom.MainPathRef!==document.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.MainPathRef=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.MainPath=document.location.origin+document.location.pathname.substring(0,e)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let i=this.href,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let a=i.indexOf("?");a>1&&(this.search=i.substring(a),i=i.substring(0,a));let o=i,r=o.indexOf("://");this.protocol=r>0?o.substring(0,r+1):"";let l=r>1?o.substring(r+3):"";r=l.indexOf("/"),this.host=r>0?l.substring(0,r):"",this.pathname=r>=1?l.substring(r):"","file:"==this.protocol&&(this.host="",this.pathname=l),this.origin=this.protocol+"//"+this.host,r=this.host.indexOf(":"),this.hostname=r>0?this.host.substring(0,r):this.host,this.port=r>1?this.host.substring(r+1):""}replace(e){this.href=e}href="";origin="";protocol="";host="";hostname="";port="";pathname="";search="";hash=""}class r{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){r.#t(r.#s.CreateElement,e,t)}static BindElementToRootView(e){r.#t(r.#s.BindElementToRootView,e)}static InsertElementChild(e,t,s){r.#t(r.#s.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){r.#t(r.#s.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){r.#t(r.#s.MoveElementChild,e,t,s,i)}static AddElementEventListener(e,t,s){r.#t(r.#s.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){r.#t(r.#s.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){r.#t(r.#s.SetElementText,e,t)}static SetElementAttribute(e,t,s){r.#t(r.#s.SetElementAttribute,e,t,s),r.#i.has(e)&&r.#n.add(e)}static GetElementBoundingClientStyles(e,t){return r.#a(r.#s.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),r.#t(r.#s.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){r.#t(r.#s.DeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){r.#t(r.#s.SetStyleProperty,e,t,s),r.#i.has(e)&&r.#n.add(e)}static GetStyleProperties(e,t){return r.#a(r.#s.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){r.#i.set(e,t)}static RemoveLazyTaskSyncedListener(e){r.#i.delete(e)}static RequestSwapAllCachedTasks(){if(0==r.#o.length)return;const e=JSON.stringify(r.#o);r.#o=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of r.#n){r.#i.get(e)?.()}r.#n.clear()}static GetElementAttribute(e,t){return r.#a(r.#s.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){r.#t(r.#s.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){r.#t(r.#s.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=r.#a(r.#s.GetRelativePosition,e,t);return JSON.parse(s)}static#a(e,t,...s){r.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static#t(e,t,...s){r.#o.push([e,t,...s]),a.sRenderBridge?.RequestSwap()}static#o=[];static#n=new Set;static#i=new Map;static#s={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42}}class l{static CreateAudioPlayer(e){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer(e)}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}}class c{static Dom=r;static Media=l}class h{static GenerateId(){const e=this.#r++;if(e>=this.#l)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}static#r=0;static#l=Math.pow(2,31)-1}class d{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[]}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.#c?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMError("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=void 0,this.#c?.()}insertBefore(e,t){this.#h(e,t)}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("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(t<0)throw new DOMError("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.#d||(this.#d={});let i=this.#d[e];i||(i=new Set,this.#d[e]=i),i.add(t)}removeEventListener(e,t,s){let i=this.#d?.[e];i&&(i.delete(t),i.size<=0&&this.#d.hasOwnProperty(e)&&delete this.#d[e],0===Object.values(this.#d).length&&(this.#d=void 0))}dispatchEvent(e){if(!this.#d)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.#d[e.type];if(t){e.target||(e.target=document.activeElement);for(let s of t)if(s?.(e),e.jsvIsPrevented())break}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.#c=e}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);i<0&&Log.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t.#h(e,s)}jsvGetEventListenerSet(e){const t=this.#d?.[e];return t}#h(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMError("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 DOMError("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.#c?.()}#d=void 0;#c=void 0;static ELEMENT_NODE=1;static TEXT_NODE=3;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static NOLAYOUT_NODE=10}class u{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(e){switch(e){case u.Layout.Height:case u.Layout.Left:case u.Layout.Top:case u.Layout.Width:case u.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==u.Layout.Height?u.Layout.Height:e==u.Layout.Left?u.Layout.Left:e==u.Layout.Top?u.Layout.Top:e==u.Layout.Width?u.Layout.Width:e==u.Background.BackgroundColor?u.Background.BackgroundColor:e==u.Background.BackgroundImage?u.Background.BackgroundImage:e==u.Background.BorderRadius?u.Background.BorderRadius:e==u.Effect.BackfaceVisibility?u.Effect.BackfaceVisibility:e==u.Effect.BorderImage?u.Effect.BorderImage:e==u.Effect.BorderImageWidth?u.Effect.BorderImageWidth:e==u.Effect.BorderImageOutset?u.Effect.BorderImageOutset:e==u.Effect.Display?u.Effect.Display:e==u.Effect.ObjectFit?u.Effect.ObjectFit:e==u.Effect.Opacity?u.Effect.Opacity:e==u.Effect.Overflow?u.Effect.Overflow:e==u.Effect.Perspective?u.Effect.Perspective:e==u.Effect.PerspectiveOrigin?u.Effect.PerspectiveOrigin:e==u.Effect.Transform?u.Effect.Transform:e==u.Effect.TransformOrigin?u.Effect.TransformOrigin:e==u.Effect.TransformStyle?u.Effect.TransformStyle:e==u.Effect.Visibility?u.Effect.Visibility:e==u.Effect.ZIndex?u.Effect.ZIndex:e==u.Text.Color?u.Text.Color:e==u.Text.FontFamily?u.Text.FontFamily:e==u.Text.FontSize?u.Text.FontSize:e==u.Text.FontStyle?u.Text.FontStyle:e==u.Text.FontWeight?u.Text.FontWeight:e==u.Text.LineHeight?u.Text.LineHeight:e==u.Text.TextAlign?u.Text.TextAlign:e==u.Text.TextOverflow?u.Text.TextOverflow:e==u.Text.TextShadow?u.Text.TextShadow:e==u.Text.WebkitTextStroke?u.Text.WebkitTextStroke:e==u.Text.WhiteSpace?u.Text.WhiteSpace:e==u.Text.WordWrap?u.Text.WordWrap:e==u.Text.Direction?u.Text.Direction:e==u.Text.JsvTextEmoji?u.Text.JsvTextEmoji:e==u.Text.JsvTextLatex?u.Text.JsvTextLatex:e==u.Text.JsvTextAlignMinWidth?u.Text.JsvTextAlignMinWidth:e==u.Text.JsvTextVerticalAlign?u.Text.JsvTextVerticalAlign:e==u.Text.JsvTextLineAlign?u.Text.JsvTextLineAlign:e==u.Text.JsvTextInnerDirection?u.Text.JsvTextInnerDirection:e==u.Motion.Animation?u.Motion.Animation:e==u.Motion.Transition?u.Motion.Transition:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class v{static Base=class{constructor(e){this.rawValue=e}rawValue};static AnimationImpl=class extends v.Base{constructor(e){super(e)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends v.Base{constructor(e){super(e)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends v.Base{constructor(e){super(e)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends v.Base{constructor(e){super(e)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends v.Base{constructor(e){super(e)}length=0;color=void 0};static TransitionImpl=class extends v.Base{constructor(e){super(e)}animationMap=new Map};static BorderImageImpl=class extends v.Base{constructor(e){super(e)}source="";slice=null};static BackgroundImageImpl=class extends v.Base{constructor(e){super(e)}type=0;static eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2};static LinearGradient=class{fromX=0;fromY=0;toX=0;toY=0;stops=[]};linearGradient;urlPath=""};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10;static BackgroundImage=11};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(e){let t=-1,s=null;null==e?t=v.DataType.Null:Number(e)===e&&e%1==0?t=v.DataType.Int32:Number(e)===e&&e%1!=0?t=v.DataType.Float:"string"==typeof e||e instanceof String?t=v.DataType.String:e instanceof v.AnimationImpl?t=v.DataType.Animation:e instanceof v.CornerImpl?t=v.DataType.Corner:e instanceof v.RectImpl?t=v.DataType.Rect:e instanceof v.TextShadowImpl?t=v.DataType.TextShadow:e instanceof v.WebkitTextStrokeImpl?t=v.DataType.WebkitTextStroke:e instanceof v.TransitionImpl?t=v.DataType.Transition:e instanceof v.BorderImageImpl&&(t=v.DataType.BorderImage),e!=v.InvalidInt32&&e!=v.InvalidFloat&&e!=v.InvalidPointer?s=e:(t=v.DataType.Null,s=null),this.data=new v.DataInfo,this.data.index=t,this.data.value=s}toString(){let e=null;switch(this.data.index){case v.DataType.Null:return"";case v.DataType.Int32:case v.DataType.Float:return String(this.get());case v.DataType.String:e=this.get();break;case v.DataType.Animation:case v.DataType.Corner:case v.DataType.Rect:case v.DataType.TextShadow:case v.DataType.WebkitTextStroke:case v.DataType.Transition:case v.DataType.BorderImage:case v.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}static DataInfo=class{value=null;index=-1};data}class m{static JsvDeclarePrototype(){for(let e in u){let t=u[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(m.prototype,s,i)}}}constructor(e){this.#u=e}setProperty(e,t){if(document.jsvCheckStyleFormat?.(e,t),e==u.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient")){t.match(/\(/g).length!=t.match(/\)/g).length&&(console.error(`StyleError: illegal linear-gradient value '${t}'`),t="")}else{t=new o(t).href}else if(e==u.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new o(e[0]).href),t=e.join(" ")}else e==u.Effect.Display&&(this.#v[e]=t);c.Dom.SetStyleProperty(this.#u,e,t)}getPropertyValue(e){if(e==u.Effect.Display)return this.#v[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.#u,t);return JSON.parse(s)}#u;#v={}}class f extends t{constructor(e){super(e)}}class p extends d{static 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"};static JsvEnableEventListener(){c.Dom.EnableEventListener((function(e,t,...s){const i=p.#m[e]?.[t];i?.(t,...s)}))}constructor(e){super(d.ELEMENT_NODE),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=h.GenerateId(),this.style=new m(this.jsvNativeId),c.Dom.CreateElement(this.jsvNativeId,e)),this.jsvAttrStore={},this.clientSizeStore={}}appendChild(e){e.parentNode?this.#f(e,null):(super.appendChild(e),this.#p(e,null))}removeChild(e){super.removeChild(e),this.#g(e),e.jsvNativeId&&c.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?this.#f(e,t):(super.insertBefore(e,t),this.#p(e,t))}addEventListener(e,t,s){this.jsvGetEventListenerSet(e)?.has(t)?console.warn("Element.addEventListener() Faild to add listener, func is exists"):(s=this.#y(s),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),c.Dom.AddElementEventListener(this.jsvNativeId,e,s)),super.addEventListener(e,t,s))}removeEventListener(e,t,s){0!=!!this.jsvGetEventListenerSet(e)?.has(t)&&(s=this.#y(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.clientSizeStore.clientWidth||(this.clientSizeStore.clientWidth=c.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.clientSizeStore.clientWidth}get clientHeight(){return this.clientSizeStore.clientHeight||(this.clientSizeStore.clientHeight=c.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.clientSizeStore.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(){document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new n(n.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new n(n.JsvType.Focus);document.dispatchEvent(t)}jsvGetBoundingClientRect(){const e="jsvgetbound",t=h.GenerateId();return new Promise(((s,i)=>{const n=a=>{const o=a.jsvParams?.[1];if(o!=t)return;a.preventDefault(),this.removeEventListener(e,n);const r=JSON.parse(a.jsvParams?.[0]??"{}");0===r.status?s(r.data):i(r.error)};this.addEventListener(e,n,{jsvtoken:t})}))}jsvSetOnLazyTaskSyncedListener(e){c.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...t){let n;e.startsWith("animation")?(n=new s(e),n.animationName=t[0]):e.startsWith("transition")?(n=new f(e),n.propertyName=t[0]):e.startsWith("jsv")&&(n=new i(e),n.options={detail:t[0]},n.jsvParams=t),n&&(n.target=this,this.dispatchEvent(n))}jsvGetProxyView(e){return e?(this._MaskViewProxy||(this._MaskViewProxy=a.NewDomProxyView(this.jsvNativeId,!0)),this._MaskViewProxy):(this._MainViewProxy||(this._MainViewProxy=a.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=p.#m[e];s||(s=new Map,p.#m[e]=s);this.jsvGetEventListenerSet(t)||(s[t]=this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let s=p.#m[e];if(!s)return;this.jsvGetEventListenerSet(t)||s.delete(t)}#f(e,t){let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.#w(s,e,t)}#w(e,t,s){t.jsvNativeId&&(s=p.#T(s),c.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}#p(e,t){e.parentNode=this,e.nodeType===d.TEXT_NODE?this.textContent=e.nodeValue:e.jsvNativeId&&(t=p.#T(t),c.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#g(e){for(const t of e.childNodes)e.#g(t);e.jsvFinalize(),c.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),delete p.#m[e.jsvNativeId]}#y(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#T(e){let t=e;for(;t&&!(t instanceof p);)t=t.nextSibling;return t}parentNode;tagName;style;jsvNativeId;jsvAttrStore;static#m={}}class g extends p{constructor(){super(p.JsvTagName.Anchor),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return p.TAG.ANCHOR}}class y extends d{constructor(e){super(d.COMMENT_NODE),this.textContent=e}}class w extends p{constructor(){super(p.JsvTagName.Div)}get textContent(){return this.#D}set textContent(e){this.#D=e,this.clientSizeStore={},c.Dom.SetElementText(this.jsvNativeId,e)}#D}const T="__AppRoot__";class D{constructor(e,t){this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new N(!1,t))}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==T?"":e}wrapWithNameSpace(e){let t=new D(!0);return t._DefaultFocusNameSpace=e,t.RouterDelegate=this.RouterDelegate,t}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t){if("string"==typeof e)return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t);console.error(`setFocus name=${e} is invalid`)}setFocus(e,t){return this._DefaultFocusNameSpace&&this._DefaultFocusNameSpace.length>0&&(e=`${this._DefaultFocusNameSpace}.${e}`),this.focusByNameBeforeMount(e,t)}printAllFocusable(){this.RouterDelegate.ref.printAllFocusRecursive(this._DefaultFocusNameSpace,"")}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof E;){let s=t.RouterDelegate.ref.NameSpace;e.push({nameSpace:s==T||s==t.BranchName?"":s,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(E.sLastFocus){let e=E.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}returnFocusToParent(){const e=this.RouterDelegate.ref.getCurrentFocusNode();e?e.ReturnFocusToParent():console.warn("returnFocusToParent: current focus node is null.")}}class N{constructor(e,t){this._IsTemp=!!e,this._ChildMap={},this._FocusNameBeforeMount=null,this._FocusNodeName=null,this.NameSpace=t}getCurrentFocusNode(){if(null==this._FocusNodeName)return null;let e=this._ChildMap[this._FocusNodeName];if(e.RouterDelegate.ref!=this){let t=e.RouterDelegate.ref.getCurrentFocusNode();return null==t?e:t}return e}getNodeByName(e,t){let s=e.split(".");return this._FindRouterSearchBase(s,t)._GetNodeFromPathArray(s,e)}printAllFocusRecursive(e,t){let s=this.NameSpace==T?"":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?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 a=i._ChildMap[t].RouterDelegate.ref;if(a!=i&&a.NameSpace==e[s]){i=a,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),this._FocusNameBeforeMount=null);else{this._FocusNameBeforeMount[0]==e&&(t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1)),this._FocusNameBeforeMount=null)}}remove(e,t){let s=this._ChildMap[e];s&&s==t&&(delete this._ChildMap[e],s.OnRemoveFromTree())}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}focusBeforeMount(e,t){let s=!1;if("string"==typeof e){if(!e.includes(".")){s=!0;let i=this._ChildMap[e];return this._FocusNodeName=e,i?(i.Focus(!t),i.RouterDelegate.ref!=this&&i.RouterDelegate.ref.clearChildFocus(),!0):(this._FocusNameBeforeMount=e,!1)}}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(s=!0,1==e.length)return this.focusBeforeMount(e[0]);{let t=e[0],s=this._ChildMap[t];return this._FocusNodeName=t,s?s.RouterDelegate.ref.focusBeforeMount(e.slice(1)):(this._FocusNameBeforeMount=e,!1)}}return s||console.error("illegal name param",e),!1}focus(e,t){let s=this.focusBeforeMount(e,t);return s||console.log("No found branch:"+e),s}forEach(e){for(let t in this._ChildMap)e(this._ChildMap[t],t,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class E extends a.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.BranchName=e,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}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 D(!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 N(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}routerUnbind(){let e;this.AsHub?this.GetParentPage()&&(e=this.GetParentPage().RouterDelegate.ref):e=this.RouterDelegate.ref,e&&e.remove(this.BranchName,this)}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}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=E.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=E.safeCallback(e)}setOnFocus(e){this._OnFocus=E.safeCallback(e)}setOnBlur(e){this._OnBlur=E.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=E.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=E.safeCallback(e)}setOnCustomerEvent(e){this._OnCustomerEvent=E.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=E.safeCallback(e),this._DKeyUpProxy=E.safeCallback(t)}requestFocus(e){let t=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(t=this.GetParentPage().RouterDelegate.ref),t?t.focus(this.BranchName,e):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomerEvent(e){return!!this._OnCustomerEvent&&this._OnCustomerEvent(e)}bubbleCustomerEvent(e){this.BubbleCustomerEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return this._DKeyDownProxy?this._DKeyDownProxy(e,this._OriginDispatchKeyDown):this._OriginDispatchKeyDown(e)}_OriginDispatchKeyDown(e){let t=!1;return this._DispatchKeyDown&&(t=this._DispatchKeyDown(e)),!!t||super.DispatchKeyDown(e)}dispatchKeyUp(e){return this.DispatchKeyUp(e)}DispatchKeyUp(e){return this.__DKeyUpProxy?this.__DKeyUpProxy(e,this._OriginDispatchKeyUp):this._OriginDispatchKeyUp(e)}_OriginDispatchKeyUp(e){let t=!1;return this._DispatchKeyUp&&(t=this._DispatchKeyUp(e)),!!t||super.DispatchKeyUp(e)}attachToActivity(e,t){this.AttachToActivity(e,t)}AttachToActivity(e,t){super.SetParent(e,t)}setParent(e){this.SetParent(e)}SetParent(e){if(null!=e&&(super.SetParent(e,null),this._ParentPage._Mounted&&(this.updateMountState(),C()),e instanceof E)){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 E.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(){E.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(){E.sLastFocus==this&&(E.sLastFocus=null);let e=this.GetParentPage();e&&e.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind()}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]==T)break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return t[0]==T?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}E.sFocusMemos=[],E.sLastFocus=null,E.sRootPageNode=null;let C=()=>{let e=E.sFocusMemos.length;if(e>0){let t=E.sFocusMemos;E.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},S={};class b{constructor(e,t,s){this._Element=s,S.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),S[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),window.JsView?t.attachToActivity(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.RootView):(window.addEventListener("keydown",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())})))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),C()}}class x extends p{constructor(){super(p.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new o(t).href,this.clientSizeStore={}}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 L extends p{constructor(){super(p.JsvTagName.Link),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new o(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 I extends p{constructor(){super(p.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new o(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})}src=null;onerror=null;onload=null;charset=null;timeout=120}class R extends p{constructor(){super(p.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class M extends p{constructor(){super(p.JsvTagName.Svg)}}class _ extends d{constructor(e){super(d.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let F=1;class P extends p{constructor(){super(p.JsvTagName.JsvFDiv),this.FocusNodeRef=new E(""+F++),this.HubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new D(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.HubRef}}class k extends d{constructor(){super(d.DOCUMENT_NODE),this.location=window.location,this.rootElement=new w,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 y(e)}createElement(e){switch(e=e.toUpperCase()){case p.JsvTagName.Anchor:return new g;case p.JsvTagName.Div:return new w;case p.JsvTagName.Image:return new x;case p.JsvTagName.Link:return new L;case p.JsvTagName.Script:return new I;case p.JsvTagName.Style:return new R;case p.JsvTagName.Svg:return new M;case p.JsvTagName.JsvFDiv:return new P;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:new t(e)}createTextNode(e){return new _(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMError("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 DOMError("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(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMError("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new b(e,t,s)}}class j extends p{constructor(){super(p.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof L||e instanceof I)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class O{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 J extends O{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 B="@keyframes",A=B.length;class V{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.#N(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)}#N(e){let t=e.indexOf(B)+A,s=e.indexOf("{");return e.substring(t,s).trim()}}let W=null;function z(e){return W||(W={global:new V("global")}),W.global}class K{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,K.#E(e,t),p.JsvEnableEventListener(),m.JsvDeclarePrototype()}static#E(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.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=z),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new J)}}class G{static SetLevel(e){switch(G.E=G.W=G.I=G.D=function(){},e){case G.Level.Verbose:G.V=console.debug.bind(console);case G.Level.Debug:G.D=console.debug.bind(console);case G.Level.Info:G.I=console.info.bind(console)}}static E=console.error.bind(console);static W=console.warn.bind(console);static I=console.info.bind(console);static D=function(){};static V=function(){};static Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4}}class U{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof d))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 H extends k{constructor(){super(),this.head=new j}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}class q{static DeclareGlobal(){q.#C(),q.#S(),q.#b()}static#C(){window.document=new H}static#S(){window.MutationObserver=U,window.Element=p,window.SVGElement=M;let e=new o(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.history={},window.navigator={userAgent:"jsview-runtime"}}static#b(){window.JsView.Dom={Render:null,Extension:null,UrlRef:o}}}class ${constructor(e){this.activity=new a.ReactActivity("NativeForgeActivity",e,null,null),this.#x()}#x(){console.log("create NativeForgeActivity.");let e=new a.LayoutView;window.JsvCode.ForgeHandles.setHandles(this.activity.GetTextureManager(),e,this.activity);let t=null;a.DesignMap&&(t=a.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}),a.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{c.Dom.RequestSwapAllCachedTasks()})),window.JsView.Dom.Render()}}class X{constructor(e){this.activityManager=e;let t=new $(e);e.RegisterActivity(t.activity),e.StartActivity(new a.Intent("NativeForgeActivity"))}}window.jsvIsBrowserDebug=!1;const Y=window.JsvCode.NativePlatformDomBridge,Z=window.JsvCode.NativePlatformMediaBridge;function Q(){K.EnsureGlobalEnv(Y,Z),q.DeclareGlobal(),G.I("Using JsView Native Environment.")}export{Q as InitEnv,X as NativeForgeApp};
2
2