@quicktvui/naddons 1.0.0-rc.4 → 1.0.0-rc.6

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.
@@ -86,6 +86,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
86
86
  onChange?: ((...args: any[]) => any) | undefined;
87
87
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
88
88
  }>, {
89
+ direction: string;
89
90
  gravity: string;
90
91
  showBackground: boolean;
91
92
  modelValue: any[];
@@ -95,7 +96,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
95
96
  disabled?: boolean | undefined;
96
97
  props?: any;
97
98
  }[];
98
- direction: string;
99
99
  itemWidth: number;
100
100
  itemHeight: number;
101
101
  itemGap: number;
@@ -86,6 +86,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
86
86
  onChange?: ((...args: any[]) => any) | undefined;
87
87
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
88
88
  }>, {
89
+ direction: string;
89
90
  gravity: string;
90
91
  showBackground: boolean;
91
92
  modelValue: string | number | boolean;
@@ -95,7 +96,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
95
96
  disabled?: boolean | undefined;
96
97
  props?: any;
97
98
  }[];
98
- direction: string;
99
99
  itemWidth: number;
100
100
  itemHeight: number;
101
101
  itemGap: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),T=require("@extscreen/es3-vue"),U=require("@extscreen/es3-core"),Me={inheritAttrs:!1},z=a.defineComponent({...Me,__name:"GridTabs",props:{protocolVersion:{},pageSpec:{},tabsData:{},actionPayload:{}},emits:["onTabSelected","onTabClick","onTabNeedsData","onLoadMore","onScroll","onScrollStateChanged","onItemPresence","onTabFocused","onItemClick","onItemLongClick","onItemFocused","onProtocolMismatch"],setup(e,{expose:r}){const f=a.ref(),d=q(),m="QtGridTabs",v=m+"_Plugin",c=(d.isPluginActive?v:m).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value},dispatchAction:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;if(i)if(l.length>0){let A=l[0];typeof A=="object"&&(A=JSON.stringify(A)),T.Native.callUIFunction(i,"dispatchAction",[A])}else T.Native.callUIFunction(i,"dispatchAction",l)},scrollToTop:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;i&&T.Native.callUIFunction(i,"scrollToTop",l)},getFocusState:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;i&&T.Native.callUIFunction(i,"getFocusState",l)},getItemRect:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;i&&T.Native.callUIFunction(i,"getItemRect",l)},requestFocus:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;i&&T.Native.callUIFunction(i,"requestFocus",l)}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,protocolVersion:e.protocolVersion,pageSpec:e.pageSpec,tabsData:e.tabsData,actionPayload:e.actionPayload,onOnTabSelected:i[0]||(i[0]=g=>l.$emit("onTabSelected",g.nativeEvent)),onOnTabClick:i[1]||(i[1]=g=>l.$emit("onTabClick",g.nativeEvent)),onOnTabNeedsData:i[2]||(i[2]=g=>l.$emit("onTabNeedsData",g.nativeEvent)),onOnLoadMore:i[3]||(i[3]=g=>l.$emit("onLoadMore",g.nativeEvent)),onOnScroll:i[4]||(i[4]=g=>l.$emit("onScroll",g.nativeEvent)),onOnScrollStateChanged:i[5]||(i[5]=g=>l.$emit("onScrollStateChanged",g.nativeEvent)),onOnItemPresence:i[6]||(i[6]=g=>l.$emit("onItemPresence",g.nativeEvent)),onOnTabFocused:i[7]||(i[7]=g=>l.$emit("onTabFocused",g.nativeEvent)),onOnItemClick:i[8]||(i[8]=g=>l.$emit("onItemClick",g.nativeEvent)),onOnItemLongClick:i[9]||(i[9]=g=>l.$emit("onItemLongClick",g.nativeEvent)),onOnItemFocused:i[10]||(i[10]=g=>l.$emit("onItemFocused",g.nativeEvent)),onOnProtocolMismatch:i[11]||(i[11]=g=>l.$emit("onProtocolMismatch",g.nativeEvent))},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["protocolVersion","pageSpec","tabsData","actionPayload"]))}});let V;var ve;try{const e=require("@extscreen/es3-vue");V=e.registerElement||((ve=e.default)==null?void 0:ve.registerElement)}catch{}const Pe={install:e=>{if(!globalThis.__QtGridTabs_registered)if(V){const r=(f,d)=>{V(f,{component:{name:d?"QtGridTabs_Plugin":"QtGridTabs",processEventData(m,v){const u=m.handler||m,c=v||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-grid-tabs",!1),r("qt-grid-tabs-plugin",!0),r("QtGridTabs",!1),r("QtGridTabs_Plugin",!0),r("gt-tabs",!1),r("gt-tabs-plugin",!0),globalThis.__QtGridTabs_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtGridTabs")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("GridTabs",z),e.component("qt-grid-tabs",z),e.component("gt-tabs",z)}};function ze(e,r){const f=a.ref(""),d=r?JSON.parse(JSON.stringify(r)):{},m=a.shallowRef([]),v=a.shallowRef([]);let u=!1,c=!1;const p="__virtual_single_tab__";let l="",i=!1;const g=a.ref({}),C=o=>{const t=Array.isArray(o)?o:[o];if(c&&e.value){if(typeof e.value.dispatchAction=="function"){console.log("[useGridTabs] Calling Wrapper dispatchAction directly"),e.value.dispatchAction(t);return}let n=e.value;typeof e.value.getNativeNode=="function"?n=e.value.getNativeNode()||e.value:e.value.nativeRef&&(n=e.value.nativeRef),n?(console.log("[useGridTabs] Calling Native callUIFunction dispatchAction fallback"),T.Native.callUIFunction(n,"dispatchAction",[JSON.stringify(t)])):console.warn("[useGridTabs] Native target is null or undefined, cannot call dispatchAction")}},A=(o,t)=>{if(!o)return!1;let n=!0;return o.id||(console.error(`[useGridTabs] ❌ 数据格式错误 (${t}): 卡片缺失必填字段 'id'。每个卡片必须有唯一标识才能进行后续更新!`,o),n=!1),o.viewType||(console.error(`[useGridTabs] ❌ 数据格式错误 (${t}): 卡片缺失必填字段 'viewType' (id: ${o.id||"未知"})。必须指定 Native 注册的视图类型或 Portal 标识!`,o),n=!1),n},$=(o,t)=>{if(!o)return!1;let n=!0;return o.tabId||(console.error(`[useGridTabs] ❌ 数据格式错误 (${t}): Tab 缺失必填字段 'tabId'。每个 Tab 必须有唯一标识!`,o),n=!1),(o.title===void 0||o.title===null)&&console.warn(`[useGridTabs] ⚠️ 数据格式警告 (${t}): Tab 缺失 'title' 字段 (tabId: ${o.tabId||"未知"}),导航栏可能显示为空。`,o),n},M=(o,t)=>{if(!o||o.length===0)return;R.clear();const n=o[0].hasOwnProperty("tabId")||o[0].hasOwnProperty("items")&&Array.isArray(o[0].items);u=t==="1d",t==="1d"&&n?console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `items.value` (一维瀑布流) 赋值二维 Tabs 数据结构!请改用 `tabs.value = ...`"):t==="2d"&&!n&&console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `tabs.value` (二维导航) 赋值一维卡片列表数据结构!请改用 `items.value = ...`"),t==="1d"?o.forEach((s,b)=>A(s,`items.value[${b}]`)):o.forEach((s,b)=>{$(s,`tabs.value[${b}]`),s.items&&Array.isArray(s.items)&&s.items.forEach((h,y)=>A(h,`tabs.value[${b}].items[${y}]`))}),c=!0,k()},R=new Set,k=(o="unknown")=>{if(!c){console.warn("[useGridTabs] triggerRootUpdate skipped because isInitialized is false");return}let t={protocolVersion:"1.28.0",gridBasis:(d==null?void 0:d.gridBasis)??30,unitType:(d==null?void 0:d.unitType)??"px",contentConfig:(d==null?void 0:d.contentConfig)??(d==null?void 0:d.layoutConfig)??{box:{padding:[0,60,60,60]},navContentGapNormal:0,itemGap:24},navConfig:(d==null?void 0:d.navConfig)??{dock:"left",mode:"fixed",renderType:"smart-hybrid",box:{size:[200,0]},expandedBox:{size:[300,0]}},cacheConfig:(d==null?void 0:d.cacheConfig)??{offscreenPageLimit:1,prefetchOffset:2,preLoadEnabled:!1,strategy:"data_priority"},animationConfig:(d==null?void 0:d.animationConfig)??{duration:300,easing:"ease-out"},interactionStrategy:(d==null?void 0:d.interactionStrategy)??{defaultFocus:"nav",interceptBack:!0,backMode:"home-first",autoScrollToTop:!0,edgeScrollProtection:.5},focusConfig:(d==null?void 0:d.focusConfig)??{boundaryLock:{left:!1,right:!1,top:!1,bottom:!1}},themeConfig:d==null?void 0:d.themeConfig,referenceResolution:(d==null?void 0:d.referenceResolution)??{w:1920,h:1080}},n=[];u?(t.navConfig={...t.navConfig,renderType:"none"},n=[{tabId:p,title:"Virtual Tab",hidden:!0,items:v.value}]):n=m.value;const s=JSON.stringify({page_spec:t,tabs:n});if(f.value==="")console.log(`[useGridTabs] triggerRootUpdate: Initializing tabsDataStr (length=${s.length})`),f.value=s,l=s;else{if(l===s){console.log("[useGridTabs] triggerRootUpdate: Data unchanged, skipping RELOAD_TABS");return}console.log(`[useGridTabs] triggerRootUpdate: Sending RELOAD_TABS action directly to Native (length=${s.length})`),f.value=s,l=s,C({op:"RELOAD_TABS",payload:{pageSpec:t,page_spec:t,tabs:n}})}},P=o=>{if(!o||typeof o!="object"||o.__isGridTabsProxy)return o;o.content&&typeof o.content=="object"&&!o.content.__isGridTabsProxy&&(o.content=new Proxy(o.content,{set(n,s,b,h){const y=Reflect.set(n,s,b,h);return o.id&&c&&C({op:"UPDATE_ITEM",itemId:o.id,payload:o}),y}}),Object.defineProperty(o.content,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(o.content,"__v_skip",{value:!0,enumerable:!1})),o.subItems&&Array.isArray(o.subItems)&&!o.subItems.__isGridTabsProxy&&(o.subItems=S(o.subItems,o.id),Object.defineProperty(o.subItems,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(o.subItems,"__v_skip",{value:!0,enumerable:!1}));const t=new Proxy(o,{set(n,s,b,h){const y=Reflect.set(n,s,b,h);return n.id&&c&&!i&&C({op:"UPDATE_ITEM",itemId:n.id,payload:n}),y}});return Object.defineProperty(t,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(t,"__v_skip",{value:!0,enumerable:!1}),t},S=(o,t)=>{for(let n=0;n<o.length;n++)o[n]=P(o[n]);return new Proxy(o,{get(n,s,b){return s==="push"?(...h)=>{h.forEach((G,D)=>A(G,`push(${D})`)),c||console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 push()。请先对 items.value 或 tabs.value 进行全量赋值!");const y=h.map(G=>P(G)),N=Array.prototype.push.apply(n,y);return i||C({op:"APPEND_SUB_ITEMS",itemId:t,payload:{subItems:y}}),N}:s==="unshift"?(...h)=>{h.forEach((G,D)=>A(G,`unshift(${D})`)),c||console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 unshift()。请先对 items.value 或 tabs.value 进行全量赋值!");const y=h.map(G=>P(G)),N=Array.prototype.unshift.apply(n,y);return c&&y.length>0&&!i&&C({op:"PREPEND_SUB_ITEMS",itemId:t,payload:{subItems:y}}),N}:s==="splice"?(...h)=>{const y=h.length>=2&&h[0]===0&&h[1]===n.length,N=Array.prototype.splice.apply(n,h);return c&&y&&t!==p?i||C({op:"CLEAR_SUB_ITEMS",itemId:t}):c&&(i||k("items array spliced")),N}:Reflect.get(n,s,b)},set(n,s,b,h){if(s!=="length"&&!isNaN(Number(s))){c||console.error(`[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时直接修改了索引 [${String(s)}]。请先对 items.value 或 tabs.value 进行全量赋值!`),A(b,`索引赋值 [${String(s)}]`);const y=P(b),N=Reflect.set(n,s,y,h);return y&&y.id&&!i&&C({op:"UPDATE_ITEM",itemId:y.id,payload:y}),N}return Reflect.set(n,s,b,h)}})},E=o=>(o.items&&Array.isArray(o.items)&&!o.items.__isGridTabsProxy&&(o.items=S(o.items,o.tabId),Object.defineProperty(o.items,"__isGridTabsProxy",{value:!0,enumerable:!1})),new Proxy(o,{set(t,n,s,b){if(n==="items"){let y=s;return Array.isArray(s)&&!s.__isGridTabsProxy&&(y=S(s,t.tabId),Object.defineProperty(y,"__isGridTabsProxy",{value:!0,enumerable:!1})),Reflect.set(t,n,y,b)}else if(n==="loadState"){const y=Reflect.set(t,n,s,b);return c&&t.tabId&&!i&&C({op:"UPDATE_TAB_STATE",itemId:t.tabId,payload:{loadState:s}}),y}return Reflect.set(t,n,s,b)}})),w=o=>{const t=o.map(n=>E(n));return new Proxy(t,{set(n,s,b,h){if(s!=="length"&&!isNaN(Number(s))){let y=b;b.__isGridTabsProxy||(y=E(b),Object.defineProperty(y,"__isGridTabsProxy",{value:!0,enumerable:!1}));const N=Reflect.set(n,s,y,h);return k(),N}return Reflect.set(n,s,b,h)}})};a.watch(m,(o,t)=>{if(console.log("[useGridTabs] watch(tabs) triggered:",{newTabs:o,isInitialized:c}),!o||o.length===0){f.value="",l="",c=!1;return}if(o.__isGridTabsProxy)console.log("[useGridTabs] newTabs is ALREADY a proxy, triggering root update"),k();else{console.log("[useGridTabs] newTabs is NOT a proxy, performing full deduceModeAndInitialize & wrapping");const n=w(o);Object.defineProperty(n,"__isGridTabsProxy",{value:!0,enumerable:!1}),M(n,"2d"),m.value=n}},{flush:"sync",deep:!1}),a.watch(v,(o,t)=>{if(console.log("[useGridTabs] watch(items) triggered:",{newItems:o,isInitialized:c}),!o||o.length===0){f.value="",l="",c=!1;return}if(o.__isGridTabsProxy)console.log("[useGridTabs] newItems is ALREADY a proxy, triggering root update"),k();else{console.log("[useGridTabs] newItems is NOT a proxy, performing full deduceModeAndInitialize & wrapping");const n=S(o,p);Object.defineProperty(n,"__isGridTabsProxy",{value:!0,enumerable:!1}),M(n,"1d"),v.value=n}},{flush:"sync",deep:!1});const I={},B=()=>{console.log("[useGridTabs] resetInitialization called manually"),c=!1,R.clear();for(const o in I)delete I[o]},O=o=>{if(!o||o.length===0){f.value="",c=!1;return}o[0].hasOwnProperty("tabId")||o[0].hasOwnProperty("items")&&Array.isArray(o[0].items)?m.value=o:v.value=o},x=o=>{g.value=o},F=a.computed(()=>({tabsData:f.value,onTabNeedsData:async(...o)=>{let t=o[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),!g.value.onTabNeedsData)return;const{tabId:n,index:s,reason:b}=t;if(R.has(n)){console.log(`[useGridTabs] onTabNeedsData SKIP: tabId=${n} 已经发起过请求,防止死循环`);return}R.add(n);try{const h=await g.value.onTabNeedsData(n,s,b);if(h&&Array.isArray(h))if(I[n]=1,h.length>0){const y=m.value.find(N=>N.tabId===n);y&&(y.items?y.items.length>0&&y.items.splice(0,y.items.length):y.items=[],y.items.push(...h),y.loadState="ready",C({op:"UPDATE_TAB_STATE",itemId:n,payload:{loadState:"ready"}}))}else console.warn(`[useGridTabs] ⚠️ 警告: onTabNeedsData(tabId="${n}") 返回了空数组 []!`),console.warn("👉 如果你已经在此函数内手动调用了 push() 来追加数据,请在最后 return null 或 undefined。"),console.warn("👉 如果该 Tab 确实没有数据,返回 [] 可能会导致底层的 Header 等已有元素被清空,请注意检查。"),console.warn("👉 框架已为您拦截此次空数组覆盖,保留了当前的 DOM 结构。")}catch(h){console.error("[useGridTabs] onTabNeedsData 执行失败:",h),R.delete(n)}},onLoadMore:async(...o)=>{let t=o[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),!g.value.onLoadMore)return;const{tabId:n,itemId:s}=t,h=(I[n]||1)+1;console.log(`[useGridTabs] 拦截到底层 onLoadMore,强行接管页码: tabId=${n}, pageNo=${h}`);try{const y=await g.value.onLoadMore(n,h,s);if(y&&Array.isArray(y))if(y.length>0)if(I[n]=h,u)v.value.push(...y);else{const N=m.value.find(G=>G.tabId===n);N&&N.items&&N.items.push(...y)}else console.warn(`[useGridTabs] ⚠️ 警告: onLoadMore(tabId="${n}", pageNo="${h}") 返回了空数组 []!`),console.warn('👉 如果这是你的最后一页数据,推荐在卡片列表中追加一个 type="no_more" 的 footer 卡片,而不是仅仅返回空。'),console.warn("👉 框架已忽略本次空数据追加,且不会自增页码。")}catch(y){console.error("[useGridTabs] onLoadMore 业务层请求失败:",y)}},onItemPresence:(...o)=>{let t=o[0];if(console.log("[useGridTabs] ⚡️ bindings caught onItemPresence:",t),g.value.onItemPresence)try{let n=typeof t=="string"?t:(t==null?void 0:t.nativeEvent)||t;n&&typeof n.data=="string"&&(n=n.data);const s=typeof n=="string"?JSON.parse(n):n;s&&s.type==="VIEW_PRESENCE_BATCH"&&Array.isArray(s.payload)?s.payload.forEach(b=>{b.itemId&&typeof b.itemId=="string"&&b.itemId.startsWith("fallback_pos_")&&console.warn(`[useGridTabs] ⚠️ 警告:检测到列表项曝光 (index=${b.index}),但未配置 itemId。请检查传入的 items 数组,务必为每个数据项指定唯一的 itemId,否则底层无法准确进行去重与曝光上报。`),g.value.onItemPresence(b)}):g.value.onItemPresence(s)}catch(n){console.error("[useGridTabs] Failed to parse onItemPresence event payload:",n),g.value.onItemPresence(t)}},onTabSelected:(...o)=>{let t=o[0];t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onTabSelected&&g.value.onTabSelected(t)},onTabClick:(...o)=>{let t=o[0];t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onTabClick&&g.value.onTabClick(t)},onItemClick:(...o)=>{let t=o[0];if(console.log("[useGridTabs] RAW onItemClick intercepted from Native:",t),t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onItemClick)try{let n=typeof t=="string"?t:(t==null?void 0:t.data)||t;const s=typeof n=="string"?JSON.parse(n):n;if(s&&typeof s.clickPayload=="string")try{s.clickPayload=JSON.parse(s.clickPayload)}catch(b){console.warn("Failed to parse clickPayload:",b)}if(s&&typeof s.focusPayload=="string")try{s.focusPayload=JSON.parse(s.focusPayload)}catch(b){console.warn("Failed to parse focusPayload:",b)}g.value.onItemClick(s)}catch(n){console.error("[useGridTabs] Failed to parse onItemClick event payload:",n),g.value.onItemClick(t)}else console.warn("[useGridTabs] onItemClick triggered but NO callback registered in callbacksRef!")},onItemLongClick:(...o)=>{let t=o[0];if(console.log("[useGridTabs] RAW onItemLongClick intercepted from Native:",t),typeof t=="number"&&o.length>=3&&typeof o[1]=="string"&&(t=o[2]),t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onItemLongClick)try{let n=typeof t=="string"?t:(t==null?void 0:t.data)||t;const s=typeof n=="string"?JSON.parse(n):n;if(s&&typeof s.clickPayload=="string")try{s.clickPayload=JSON.parse(s.clickPayload)}catch{}if(s&&typeof s.focusPayload=="string")try{s.focusPayload=JSON.parse(s.focusPayload)}catch{}g.value.onItemLongClick(s)}catch(n){console.error("[useGridTabs] Failed to parse onItemLongClick event payload:",n),g.value.onItemLongClick(t)}},onItemFocused:(...o)=>{let t=o[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onItemFocused)try{let n=typeof t=="string"?t:(t==null?void 0:t.data)||t;const s=typeof n=="string"?JSON.parse(n):n;if(s&&typeof s.clickPayload=="string")try{s.clickPayload=JSON.parse(s.clickPayload)}catch{}if(s&&typeof s.focusPayload=="string")try{s.focusPayload=JSON.parse(s.focusPayload)}catch{}g.value.onItemFocused(s)}catch(n){console.error("[useGridTabs] Failed to parse onItemFocused event payload:",n),g.value.onItemFocused(t)}},onTabFocused:(...o)=>{let t=o[0];t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onTabFocused&&g.value.onTabFocused(t)},onScroll:(...o)=>{let t=o[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onScroll)try{const n=(t==null?void 0:t.data)||t;g.value.onScroll(n)}catch{g.value.onScroll(t)}},onScrollStateChanged:(...o)=>{let t=o[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onScrollStateChanged)try{const n=(t==null?void 0:t.data)||t;g.value.onScrollStateChanged(n)}catch{g.value.onScrollStateChanged(t)}}}));return{tabsDataStr:f,bindings:F,tabs:m,items:v,initData:O,setCallbacks:x,updateItem:(o,t)=>{if(!c){console.error("[useGridTabs] ❌ 时机错误: 尚未初始化数据,无法调用 updateItem");return}C({op:"UPDATE_ITEM",itemId:o,payload:t}),i=!0;try{if(u){const n=v.value.find(s=>s.id===o);n&&Object.assign(n,t)}else for(const n of m.value)if(n.items){const s=n.items.find(b=>b.id===o);if(s){Object.assign(s,t);break}}}finally{i=!1}},deleteItem:(o,t=!0)=>{if(c){C({op:"DELETE_ITEM",itemId:o,payload:{animated:t}}),i=!0;try{if(u){const n=v.value.findIndex(s=>s.id===o);n!==-1&&v.value.splice(n,1)}else for(const n of m.value)if(n.items){const s=n.items.findIndex(b=>b.id===o);if(s!==-1){n.items.splice(s,1);break}}}finally{i=!1}}},prependItems:(o,t)=>{if(c){C({op:"PREPEND_SUB_ITEMS",itemId:o,payload:{subItems:t}}),i=!0;try{if(u)v.value.unshift(...t);else{const n=m.value.find(s=>s.tabId===o);n&&n.items&&n.items.unshift(...t)}}finally{i=!1}}},clearItems:o=>{if(c){C({op:"CLEAR_SUB_ITEMS",itemId:o}),i=!0;try{if(u)v.value.splice(0,v.value.length);else{const t=m.value.find(n=>n.tabId===o);t&&t.items&&t.items.splice(0,t.items.length)}}finally{i=!1}}},moveItem:(o,t,n)=>{if(c){C({op:"MOVE_ITEM",itemId:o,payload:{targetPosition:t,anchorItemId:n}}),i=!0;try{const s=b=>{const h=b.findIndex(N=>N.id===o),y=b.findIndex(N=>N.id===n);if(h!==-1&&y!==-1){const N=b.splice(h,1)[0],G=b.findIndex(De=>De.id===n),D=t==="after"?G+1:G;b.splice(D,0,N)}};if(u)s(v.value);else for(const b of m.value)b.items&&s(b.items)}finally{i=!1}}},replaceItem:(o,t)=>{if(c){C({op:"REPLACE_ITEM",itemId:o,payload:t}),i=!0;try{if(u){const n=v.value.findIndex(s=>s.id===o);n!==-1&&(v.value[n]=t)}else for(const n of m.value)if(n.items){const s=n.items.findIndex(b=>b.id===o);if(s!==-1){n.items[s]=t;break}}}finally{i=!1}}},dispatchAction:C,resetInitialization:B,getFocusState:async()=>new Promise((o,t)=>{let n=e.value;typeof e.value.getNativeNode=="function"?n=e.value.getNativeNode()||e.value:e.value.nativeRef&&(n=e.value.nativeRef),console.log("[useGridTabs] getFocusState called, nativeTarget:",n);const s=b=>{if(console.log("[useGridTabs] getFocusState callback received:",b),b&&b.isSuccess!==void 0&&b.result!==void 0){o(b.result);return}try{const h=typeof b=="string"?JSON.parse(b):b;o(h)}catch(h){t(h)}};typeof T.Native.callUIFunction=="function"?(console.log('[useGridTabs] Executing Native.callUIFunction("getFocusState") with callback as 4th arg'),T.Native.callUIFunction(n,"getFocusState",[],s)):(console.error("[useGridTabs] Native.callUIFunction is not available"),t(new Error("Native.callUIFunction is not available")))}),getItemRect:async o=>new Promise((t,n)=>{let s=e.value;typeof e.value.getNativeNode=="function"?s=e.value.getNativeNode()||e.value:e.value.nativeRef&&(s=e.value.nativeRef),console.log(`[useGridTabs] getItemRect called for itemId=${o}, nativeTarget:`,s);const b=h=>{if(console.log(`[useGridTabs] getItemRect callback received for itemId=${o}:`,h),h&&h.isSuccess!==void 0&&h.result!==void 0){t(h.result);return}try{const y=typeof h=="string"?JSON.parse(h):h;t(y)}catch(y){n(y)}};typeof T.Native.callUIFunction=="function"?(console.log('[useGridTabs] Executing Native.callUIFunction("getItemRect") with itemId and callback as 4th arg'),T.Native.callUIFunction(s,"getItemRect",[o],b)):(console.error("[useGridTabs] Native.callUIFunction is not available"),n(new Error("Native.callUIFunction is not available")))}),requestFocus:o=>{let t=e.value;typeof e.value.getNativeNode=="function"?t=e.value.getNativeNode()||e.value:e.value.nativeRef&&(t=e.value.nativeRef),T.Native.callUIFunction(t,"requestFocus",[o])},updatePageSpec:o=>{if(!c)return;const t=Object.assign({},JSON.parse(f.value).page_spec,o);o.layout&&(t.navConfig=Object.assign({},t.navConfig,o.layout)),o.navConfig&&(t.navConfig=Object.assign({},t.navConfig,o.navConfig)),o.contentConfig&&(t.contentConfig=Object.assign({},t.contentConfig,o.contentConfig)),d&&Object.assign(d,t),C({op:"RELOAD_TABS",payload:{pageSpec:t,page_spec:t,tabs:m.value}});const n=JSON.parse(f.value);n.page_spec=t,f.value=JSON.stringify(n),l=f.value},reloadAll:(o,t)=>{d&&(Object.keys(d).forEach(n=>delete d[n]),Object.assign(d,o)),m.value=t,C({op:"RELOAD_TABS",payload:{pageSpec:o,page_spec:o,tabs:t}})},scrollToTop:()=>{let o=e.value;typeof e.value.getNativeNode=="function"?o=e.value.getNativeNode()||e.value:e.value.nativeRef&&(o=e.value.nativeRef),T.Native.callUIFunction(o,"scrollToTop",[])}}}const Le={inheritAttrs:!1},j=a.defineComponent({...Le,__name:"Keyboard",props:{backgroundColor:{},backgroundGradient:{},textColor:{},weakTextColor:{},focusBackgroundColor:{},focusTextColor:{},placeholder:{},textFullKeyboard:{},textT9Keyboard:{},keyboardType:{},textClear:{},textDelete:{},currentInput:{},autofocus:{type:Boolean},rememberKeyboardType:{type:Boolean}},emits:["onInputChanged","onKeyPressed"],setup(e,{expose:r}){const f=a.ref(),d=q(),m="QtKeyboard",v=m+"_Plugin",c=(d.isPluginActive?v:m).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value},requestFocus:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;i&&T.Native.callUIFunction(i,"requestFocus",l)}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,backgroundColor:e.backgroundColor,backgroundGradient:e.backgroundGradient,textColor:e.textColor,weakTextColor:e.weakTextColor,focusBackgroundColor:e.focusBackgroundColor,focusTextColor:e.focusTextColor,placeholder:e.placeholder,textFullKeyboard:e.textFullKeyboard,textT9Keyboard:e.textT9Keyboard,keyboardType:e.keyboardType,textClear:e.textClear,textDelete:e.textDelete,currentInput:e.currentInput,autofocus:e.autofocus,rememberKeyboardType:e.rememberKeyboardType,onOnInputChanged:i[0]||(i[0]=g=>l.$emit("onInputChanged",g.nativeEvent)),onOnKeyPressed:i[1]||(i[1]=g=>l.$emit("onKeyPressed",g.nativeEvent))},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["backgroundColor","backgroundGradient","textColor","weakTextColor","focusBackgroundColor","focusTextColor","placeholder","textFullKeyboard","textT9Keyboard","keyboardType","textClear","textDelete","currentInput","autofocus","rememberKeyboardType"]))}});let W;var me;try{const e=require("@extscreen/es3-vue");W=e.registerElement||((me=e.default)==null?void 0:me.registerElement)}catch{}const Te={install:e=>{if(!globalThis.__QtKeyboard_registered)if(W){const r=(f,d)=>{W(f,{component:{name:d?"QtKeyboard_Plugin":"QtKeyboard",processEventData(m,v){const u=m.handler||m,c=v||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-keyboard",!1),r("qt-keyboard-plugin",!0),r("QtKeyboard",!1),r("QtKeyboard_Plugin",!0),globalThis.__QtKeyboard_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtKeyboard")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("Keyboard",j),e.component("qt-keyboard",j)}},Ue={inheritAttrs:!1},K=a.defineComponent({...Ue,__name:"PortalPool",setup(e,{expose:r}){const f=a.ref(),d=q(),m="QtPortalPool",v=m+"_Plugin",c=(d.isPluginActive?v:m).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,style:{position:"absolute"},absolute:!0},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16))}});let H;var be;try{const e=require("@extscreen/es3-vue");H=e.registerElement||((be=e.default)==null?void 0:be.registerElement)}catch{}const Ie={install:e=>{if(!globalThis.__QtPortalPool_registered)if(H){const r=(f,d)=>{H(f,{component:{name:d?"QtPortalPool_Plugin":"QtPortalPool",processEventData(m,v){const u=m.handler||m,c=v||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-portal-pool",!1),r("qt-portal-pool-plugin",!0),r("QtPortalPool",!1),r("QtPortalPool_Plugin",!0),globalThis.__QtPortalPool_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtPortalPool")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("PortalPool",K),e.component("qt-portal-pool",K)}},Ve={inheritAttrs:!1},J=a.defineComponent({...Ve,__name:"PortalItem",props:{portalId:{}},setup(e,{expose:r}){const f=a.ref(),d=q(),m="QtPortalItem",v=m+"_Plugin",c=(d.isPluginActive?v:m).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,style:{position:"absolute"},absolute:!0,portalId:e.portalId},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["portalId"]))}});let Z;var ye;try{const e=require("@extscreen/es3-vue");Z=e.registerElement||((ye=e.default)==null?void 0:ye.registerElement)}catch{}const Se={install:e=>{if(!globalThis.__QtPortalItem_registered)if(Z){const r=(f,d)=>{Z(f,{component:{name:d?"QtPortalItem_Plugin":"QtPortalItem",processEventData(m,v){const u=m.handler||m,c=v||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-portal-item",!1),r("qt-portal-item-plugin",!0),r("QtPortalItem",!1),r("QtPortalItem_Plugin",!0),globalThis.__QtPortalItem_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtPortalItem")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("PortalItem",J),e.component("qt-portal-item",J)}},je={inheritAttrs:!1},X=a.defineComponent({...je,__name:"HsvBackground",props:{hue:{},hueDuration:{}},setup(e,{expose:r}){const f=a.ref(),d=q(),m="QtHsvBackground",v=m+"_Plugin",c=(d.isPluginActive?v:m).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,hue:e.hue,hueDuration:e.hueDuration},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["hue","hueDuration"]))}});let Y;var he;try{const e=require("@extscreen/es3-vue");Y=e.registerElement||((he=e.default)==null?void 0:he.registerElement)}catch{}const Ee={install:e=>{if(!globalThis.__QtHsvBackground_registered)if(Y){const r=(f,d)=>{Y(f,{component:{name:d?"QtHsvBackground_Plugin":"QtHsvBackground",processEventData(m,v){const u=m.handler||m,c=v||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-hsv-background",!1),r("qt-hsv-background-plugin",!0),r("QtHsvBackground",!1),r("QtHsvBackground_Plugin",!0),globalThis.__QtHsvBackground_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtHsvBackground")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("HsvBackground",X),e.component("qt-hsv-background",X)}},We={inheritAttrs:!1},ee=a.defineComponent({...We,__name:"SvgImage",props:{src:{},tintColor:{}},setup(e,{expose:r}){const f=a.ref(),d=q(),m="QtSvgImage",v=m+"_Plugin",c=(d.isPluginActive?v:m).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,src:e.src,tintColor:e.tintColor},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["src","tintColor"]))}});let te;var pe;try{const e=require("@extscreen/es3-vue");te=e.registerElement||((pe=e.default)==null?void 0:pe.registerElement)}catch{}const xe={install:e=>{if(!globalThis.__QtSvgImage_registered)if(te){const r=(f,d)=>{te(f,{component:{name:d?"QtSvgImage_Plugin":"QtSvgImage",processEventData(m,v){const u=m.handler||m,c=v||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-svg-image",!1),r("qt-svg-image-plugin",!0),r("QtSvgImage",!1),r("QtSvgImage_Plugin",!0),globalThis.__QtSvgImage_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtSvgImage")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("SvgImage",ee),e.component("qt-svg-image",ee)}},Ke={inheritAttrs:!1},He=a.defineComponent({...Ke,__name:"NaButtonBase",props:{text:{},icon:{},iconSize:{},iconSpace:{},layoutDirection:{},fontSize:{},maxLines:{},textColor:{},focusTextColor:{},backgroundColor:{},focusBackgroundColor:{},normalBorderWidth:{},normalBorderColor:{},focusBorderColor:{},cornerRadius:{},focusScale:{},enableFocusBorder:{type:Boolean}},emits:["onButtonCustomEvent"],setup(e,{expose:r}){const f=a.ref(),d=q(),m="QtNaButton",v=m+"_Plugin",c=(d.isPluginActive?v:m).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,text:e.text,icon:e.icon,iconSize:e.iconSize,iconSpace:e.iconSpace,layoutDirection:e.layoutDirection,fontSize:e.fontSize,maxLines:e.maxLines,textColor:e.textColor,focusTextColor:e.focusTextColor,backgroundColor:e.backgroundColor,focusBackgroundColor:e.focusBackgroundColor,normalBorderWidth:e.normalBorderWidth,normalBorderColor:e.normalBorderColor,focusBorderColor:e.focusBorderColor,cornerRadius:e.cornerRadius,focusScale:e.focusScale,enableFocusBorder:e.enableFocusBorder,onOnButtonCustomEvent:i[0]||(i[0]=g=>l.$emit("onButtonCustomEvent",g.nativeEvent))},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["text","icon","iconSize","iconSpace","layoutDirection","fontSize","maxLines","textColor","focusTextColor","backgroundColor","focusBackgroundColor","normalBorderWidth","normalBorderColor","focusBorderColor","cornerRadius","focusScale","enableFocusBorder"]))}}),Je={inheritAttrs:!1},oe=a.defineComponent({...Je,__name:"NaButton",props:{width:{},height:{}},setup(e){const r=e,f=a.computed(()=>({width:typeof r.width=="number"?`${r.width}px`:r.width,height:typeof r.height=="number"?`${r.height}px`:r.height}));return(d,m)=>(a.openBlock(),a.createBlock(He,a.mergeProps(d.$attrs,{style:f.value}),{default:a.withCtx(()=>[a.renderSlot(d.$slots,"default")]),_:3},16,["style"]))}});let ne;var Ce;try{const e=require("@extscreen/es3-vue");ne=e.registerElement||((Ce=e.default)==null?void 0:Ce.registerElement)}catch{}const Ae={install:e=>{if(!globalThis.__QtNaButton_registered)if(ne){const r=(f,d)=>{ne(f,{component:{name:d?"QtNaButton_Plugin":"QtNaButton",processEventData(m,v){const u=m.handler||m,c=v||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-na-button",!1),r("qt-na-button-plugin",!0),r("QtNaButton",!1),r("QtNaButton_Plugin",!0),globalThis.__QtNaButton_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtNaButton")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("NaButton",oe),e.component("qt-na-button",oe)}},Ze={inheritAttrs:!1},ae=a.defineComponent({...Ze,__name:"NaCheckbox",props:{text:{},checked:{type:Boolean},disabled:{type:Boolean},checkedIcon:{},uncheckedIcon:{},iconSize:{},iconSpace:{},layoutDirection:{},gravity:{},paddingX:{},showBackground:{type:Boolean},fontSize:{},textColor:{},focusTextColor:{},checkedTextColor:{},focusCheckedTextColor:{},disabledTextColor:{},iconColor:{},focusIconColor:{},checkedIconColor:{},focusCheckedIconColor:{},disabledIconColor:{},iconInnerColor:{},focusIconInnerColor:{},checkedIconInnerColor:{},focusCheckedIconInnerColor:{},disabledIconInnerColor:{},focusMode:{},bgColor:{},focusBgColor:{},checkedBgColor:{},focusCheckedBgColor:{},disabledBgColor:{},borderColor:{},focusBorderColor:{},checkedBorderColor:{},focusCheckedBorderColor:{},disabledBorderColor:{},cornerRadius:{},focusScale:{},type:{}},emits:["onCheckedChange"],setup(e,{expose:r}){const f=a.ref(),d=q(),m="QtNaCheckbox",v=m+"_Plugin",c=(d.isPluginActive?v:m).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,text:e.text,checked:e.checked,disabled:e.disabled,checkedIcon:e.checkedIcon,uncheckedIcon:e.uncheckedIcon,iconSize:e.iconSize,iconSpace:e.iconSpace,layoutDirection:e.layoutDirection,gravity:e.gravity,paddingX:e.paddingX,showBackground:e.showBackground,fontSize:e.fontSize,textColor:e.textColor,focusTextColor:e.focusTextColor,checkedTextColor:e.checkedTextColor,focusCheckedTextColor:e.focusCheckedTextColor,disabledTextColor:e.disabledTextColor,iconColor:e.iconColor,focusIconColor:e.focusIconColor,checkedIconColor:e.checkedIconColor,focusCheckedIconColor:e.focusCheckedIconColor,disabledIconColor:e.disabledIconColor,iconInnerColor:e.iconInnerColor,focusIconInnerColor:e.focusIconInnerColor,checkedIconInnerColor:e.checkedIconInnerColor,focusCheckedIconInnerColor:e.focusCheckedIconInnerColor,disabledIconInnerColor:e.disabledIconInnerColor,focusMode:e.focusMode,bgColor:e.bgColor,focusBgColor:e.focusBgColor,checkedBgColor:e.checkedBgColor,focusCheckedBgColor:e.focusCheckedBgColor,disabledBgColor:e.disabledBgColor,borderColor:e.borderColor,focusBorderColor:e.focusBorderColor,checkedBorderColor:e.checkedBorderColor,focusCheckedBorderColor:e.focusCheckedBorderColor,disabledBorderColor:e.disabledBorderColor,cornerRadius:e.cornerRadius,focusScale:e.focusScale,type:e.type,onOnCheckedChange:i[0]||(i[0]=g=>l.$emit("onCheckedChange",g.nativeEvent))},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["text","checked","disabled","checkedIcon","uncheckedIcon","iconSize","iconSpace","layoutDirection","gravity","paddingX","showBackground","fontSize","textColor","focusTextColor","checkedTextColor","focusCheckedTextColor","disabledTextColor","iconColor","focusIconColor","checkedIconColor","focusCheckedIconColor","disabledIconColor","iconInnerColor","focusIconInnerColor","checkedIconInnerColor","focusCheckedIconInnerColor","disabledIconInnerColor","focusMode","bgColor","focusBgColor","checkedBgColor","focusCheckedBgColor","disabledBgColor","borderColor","focusBorderColor","checkedBorderColor","focusCheckedBorderColor","disabledBorderColor","cornerRadius","focusScale","type"]))}});let re;var ke;try{const e=require("@extscreen/es3-vue");re=e.registerElement||((ke=e.default)==null?void 0:ke.registerElement)}catch{}const we={install:e=>{if(!globalThis.__QtNaCheckbox_registered)if(re){const r=(f,d)=>{re(f,{component:{name:d?"QtNaCheckbox_Plugin":"QtNaCheckbox",processEventData(m,v){const u=m.handler||m,c=v||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-na-checkbox",!1),r("qt-na-checkbox-plugin",!0),r("QtNaCheckbox",!1),r("QtNaCheckbox_Plugin",!0),globalThis.__QtNaCheckbox_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtNaCheckbox")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("NaCheckbox",ae),e.component("qt-na-checkbox",ae)}},Xe=a.defineComponent({name:"NaRadioGroup",props:{modelValue:{type:[String,Number,Boolean],default:""},options:{type:Array,default:()=>[]},direction:{type:String,default:"row"},itemWidth:{type:Number,default:void 0},itemHeight:{type:Number,default:void 0},itemGap:{type:Number,default:20},gravity:{type:String,default:"center"},showBackground:{type:Boolean,default:!0}},emits:["update:modelValue","change"],setup(e,{emit:r}){return{groupStyle:a.computed(()=>({display:"flex",flexDirection:e.direction,alignItems:"center"})),getItemStyle:(v,u)=>{var p;const c={...((p=v.props)==null?void 0:p.style)||{}};return e.itemWidth!==void 0&&(c.width=e.itemWidth),e.itemHeight!==void 0&&(c.height=e.itemHeight),u!==e.options.length-1&&(e.direction==="row"?c.marginRight=e.itemGap:c.marginBottom=e.itemGap),c},onItemClick:v=>{v.disabled||(r("update:modelValue",v.value),r("change",v.value))}}}});const fe=(e,r)=>{const f=e.__vccOpts||e;for(const[d,m]of r)f[d]=m;return f};function Ye(e,r,f,d,m,v){const u=a.resolveComponent("qt-na-checkbox");return a.openBlock(),a.createElementBlock("div",{class:"na-radio-group",style:a.normalizeStyle(e.groupStyle)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.options,(c,p)=>(a.openBlock(),a.createBlock(u,a.mergeProps({key:p,type:"radio",checked:e.modelValue===c.value,text:c.label,gravity:e.gravity,showBackground:e.showBackground,disabled:c.disabled},{ref_for:!0},c.props,{style:e.getItemStyle(c,p),onClick:l=>e.onItemClick(c)}),null,16,["checked","text","gravity","showBackground","disabled","style","onClick"]))),128))],4)}const le=fe(Xe,[["render",Ye],["__scopeId","data-v-448252ff"]]),Be={install:e=>{e.component("NaRadioGroup",le),e.component("qt-na-radio-group",le)}},et=a.defineComponent({name:"NaCheckboxGroup",props:{modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},direction:{type:String,default:"row"},itemWidth:{type:Number,default:void 0},itemHeight:{type:Number,default:void 0},itemGap:{type:Number,default:20},gravity:{type:String,default:"center"},showBackground:{type:Boolean,default:!0}},emits:["update:modelValue","change"],setup(e,{emit:r}){return{groupStyle:a.computed(()=>({display:"flex",flexDirection:e.direction,alignItems:"center"})),getItemStyle:(v,u)=>{var p;const c={...((p=v.props)==null?void 0:p.style)||{}};return e.itemWidth!==void 0&&(c.width=e.itemWidth),e.itemHeight!==void 0&&(c.height=e.itemHeight),u!==e.options.length-1&&(e.direction==="row"?c.marginRight=e.itemGap:c.marginBottom=e.itemGap),c},onItemClick:v=>{if(v.disabled)return;const u=[...e.modelValue],c=u.indexOf(v.value);c>-1?u.splice(c,1):u.push(v.value),r("update:modelValue",u),r("change",u)}}}});function tt(e,r,f,d,m,v){const u=a.resolveComponent("qt-na-checkbox");return a.openBlock(),a.createElementBlock("div",{class:"na-checkbox-group",style:a.normalizeStyle(e.groupStyle)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.options,(c,p)=>(a.openBlock(),a.createBlock(u,a.mergeProps({key:p,type:"checkbox",checked:e.modelValue.includes(c.value),text:c.label,gravity:e.gravity,showBackground:e.showBackground,disabled:c.disabled},{ref_for:!0},c.props,{style:e.getItemStyle(c,p),onClick:l=>e.onItemClick(c)}),null,16,["checked","text","gravity","showBackground","disabled","style","onClick"]))),128))],4)}const ie=fe(et,[["render",tt],["__scopeId","data-v-cf6a4eaa"]]),$e={install:e=>{e.component("NaCheckboxGroup",ie),e.component("qt-na-checkbox-group",ie)}},ot={inheritAttrs:!1},se=a.defineComponent({...ot,__name:"NaSwitcher",props:{checked:{type:Boolean},disabled:{type:Boolean},title:{},textOn:{},textOff:{},subtitle:{},subtitleColor:{},titleColor:{},focusTitleColor:{},titleTextSize:{},subtitleTextSize:{},stateTextSize:{}},emits:["onCheckedChange"],setup(e,{expose:r}){const f=a.ref(),d=q(),m="QtNaSwitcher",v=m+"_Plugin",c=(d.isPluginActive?v:m).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,checked:e.checked,disabled:e.disabled,title:e.title,textOn:e.textOn,textOff:e.textOff,subtitle:e.subtitle,subtitleColor:e.subtitleColor,titleColor:e.titleColor,focusTitleColor:e.focusTitleColor,titleTextSize:e.titleTextSize,subtitleTextSize:e.subtitleTextSize,stateTextSize:e.stateTextSize,onOnCheckedChange:i[0]||(i[0]=g=>l.$emit("onCheckedChange",g.nativeEvent))},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["checked","disabled","title","textOn","textOff","subtitle","subtitleColor","titleColor","focusTitleColor","titleTextSize","subtitleTextSize","stateTextSize"]))}});let ce;var Ne;try{const e=require("@extscreen/es3-vue");ce=e.registerElement||((Ne=e.default)==null?void 0:Ne.registerElement)}catch{}const Ge={install:e=>{if(!globalThis.__QtNaSwitcher_registered)if(ce){const r=(f,d)=>{ce(f,{component:{name:d?"QtNaSwitcher_Plugin":"QtNaSwitcher",processEventData(m,v){const u=m.handler||m,c=v||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-na-switcher",!1),r("qt-na-switcher-plugin",!0),r("QtNaSwitcher",!1),r("QtNaSwitcher_Plugin",!0),globalThis.__QtNaSwitcher_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtNaSwitcher")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("NaSwitcher",se),e.component("qt-na-switcher",se)}},nt=a.defineComponent({name:"NaSettingSwitch",props:{title:{type:String,default:""},subtitle:{type:String,default:""},modelValue:{type:Boolean,default:!1},textOn:{type:String,default:"打开"},textOff:{type:String,default:"关闭"},titleTextSize:{type:Number,default:28},subtitleTextSize:{type:Number,default:22},stateTextSize:{type:Number,default:24},disabled:{type:Boolean,default:!1},width:{type:[Number,String],default:800},height:{type:[Number,String],default:100}},emits:["update:modelValue","change"],setup(e,{emit:r,attrs:f}){const d=a.ref(e.modelValue);a.watch(()=>e.modelValue,c=>{d.value=c});const m=c=>{const p=c.checked;d.value=p,r("update:modelValue",p),r("change",p)},v=a.computed(()=>typeof e.width=="number"?`${e.width}px`:e.width),u=a.computed(()=>{const c=f.style||{},p=e.subtitle?(typeof e.height=="number"?e.height:parseInt(e.height))+30:e.height;return{width:v.value,height:typeof p=="number"?`${p}px`:p,...c}});return{checked:d,handleCheckedChange:m,mergedStyle:u}}});function at(e,r,f,d,m,v){const u=a.resolveComponent("qt-na-switcher");return a.openBlock(),a.createBlock(u,{class:"na-setting-switch",style:a.normalizeStyle(e.mergedStyle),title:e.title,subtitle:e.subtitle,checked:e.checked,textOn:e.textOn,textOff:e.textOff,titleTextSize:e.titleTextSize,subtitleTextSize:e.subtitleTextSize,stateTextSize:e.stateTextSize,disabled:e.disabled,onOnCheckedChange:e.handleCheckedChange},null,8,["style","title","subtitle","checked","textOn","textOff","titleTextSize","subtitleTextSize","stateTextSize","disabled","onOnCheckedChange"])}const ue=fe(nt,[["render",at]]),Oe={install(e){e.component("NaSettingSwitch",ue),e.component("qt-na-setting-switch",ue)}},_e={skipPluginCheck:!1},L=new Set;function _(e,r,f){return a.defineComponent({name:`${e}AsyncWrapper`,inheritAttrs:!1,props:{skipPluginCheck:{type:Boolean,default:!1}},setup(d,{slots:m,attrs:v,expose:u}){const c=a.ref("loading"),p=a.ref(""),l=a.ref(),i=globalThis.__VUE_INSTANCE__;u({getNativeNode:()=>{let k=l.value;return!k&&i&&i.vnode&&i.vnode.el&&(k=i.vnode.el,k.childNodes&&k.childNodes.length>0&&(k=k.childNodes[0])),k},nativeRef:l});let A=null,$=null;try{A=U.useES(),$=U.useESPlugin()}catch(k){console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",k)}const M=async()=>{if(!A||typeof A.isComponentRegistered!="function")return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"),!1;try{const k=await A.isComponentRegistered(e);if(console.log(`[withAsyncPlugin] isComponentRegistered('${e}') 返回:`,k),k===!0||k&&typeof k=="object"&&(k.registered===!0||k.isRegistered===!0))return!0;try{const P=await T.Native.callNativeWithPromise("ExtendModule","getCoreSDKInfo");if(P&&P.core_version){const S=P.core_version;console.log(`[withAsyncPlugin] 当前引擎核心版本: ${S}`);const E=S.split(".").map(w=>parseInt(w,10));if(E.length>=3&&!isNaN(E[0])&&!isNaN(E[1])&&!isNaN(E[2]))if(E[0]*1e6+E[1]*1e3+E[2]>=1011205){console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${e}`);const I=e.split("-").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join("");console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${e}, ${I}`);const[B,O]=await Promise.all([T.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",e).catch(()=>!1),T.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",I).catch(()=>!1)]);if(console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${B}, ${O}]`),B===!0||O===!0)return!0}else console.log(`[withAsyncPlugin] 引擎版本 ${S} < 1.11.205,跳过 ExtendModule 检查`);else console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${S}`)}}catch(P){console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",P)}return!1}catch(k){return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",k),!1}},R=async()=>{if(_e.skipPluginCheck||d.skipPluginCheck){console.log(`[withAsyncPlugin] 跳过 ${e} 插件检查 (skipPluginCheck = true)`),c.value="ready";return}if(!r){c.value="ready";return}const k=await M();if(console.log(`[withAsyncPlugin] 拦截检查 - ${e} 是否已注册:`,k),k||L.has(r)){c.value="ready",L.add(r),console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");return}if(!$){console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${e}`),c.value="ready";return}console.log(`[withAsyncPlugin] 开始动态安装插件: ${r}`);try{await new Promise((P,S)=>{let E;const w={onPluginInstallSuccess(I,B,O){I===r&&(clearTimeout(E),$.removeListener(w),console.log(`[withAsyncPlugin] 安装成功 pkg=${I} 状态码=${B}`),B==1003||B==1001?(f?(console.log(`[withAsyncPlugin] 触发反射初始化: ${f}`),T.Native.callNative("EsNativeModule","callReflect",{entry:{from:f,method:"setup"}})):console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),P()):S(new Error(`安装失败 pkg=${I} status=${B} msg=${O}`)))},onPluginInstallError(I,B,O){I===r&&(clearTimeout(E),$.removeListener(w),S(new Error(`安装失败 pkg=${I} status=${B} msg=${O}`)))}};$.addListener({pkg:r},w),E=setTimeout(()=>{$.removeListener(w),S(new Error(`插件安装超时: ${r}`))},8e3),typeof $.installPlugin=="function"?$.installPlugin({pkg:r}):typeof $.install=="function"?$.install(r):S(new Error("当前运行时不支持 install / installPlugin"))}),await a.nextTick(),L.add(r),c.value="ready"}catch(P){console.error("[withAsyncPlugin] 插件加载失败:",P),p.value=(P==null?void 0:P.message)||String(P),c.value="error"}};return a.onMounted(()=>{R()}),()=>{const k={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",...v.style||{}};v.width!==void 0&&!k.width&&(k.width=typeof v.width=="number"?`${v.width}px`:v.width),v.height!==void 0&&!k.height&&(k.height=typeof v.height=="number"?`${v.height}px`:v.height);const P=v.class?`qt-plugin-container ${v.class}`:"qt-plugin-container",S={class:P,style:k,clipChildren:!1,clipPadding:!1,clipToPadding:!1};if(c.value==="loading")return a.h("div",S,[a.h("div",{style:{color:"white",fontSize:"30px"}},"插件加载中...")]);if(c.value==="error")return a.h("div",S,[a.h("div",{style:{color:"white",fontSize:"30px",backgroundColor:"rgba(255,0,0,0.5)"}},`插件加载失败: ${p.value}`)]);const E={},w={};for(const[x,F]of Object.entries(v))if(x.startsWith("on")&&typeof F=="function"){let Q=x;x.startsWith("onOn")&&(Q="on"+x.slice(4)),w[Q]=F}else if(x.startsWith("on")&&Array.isArray(F)){let Q=x;x.startsWith("onOn")&&(Q="on"+x.slice(4)),w[Q]=F}else x.startsWith("onOn")||(E[x]=F);const I={...E,...w,class:P,style:k,ref:x=>{l.value=x}},B=I.tabsData||"",O=I.actionPayload||"";return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:",Object.keys(I),"tabsData.length=",B.length,"actionPayload.length=",O.length),a.h(e,I,m.default?m.default():[])}}})}const ge=Symbol("AddonEnvContext"),qe={isPluginActive:!1,nameSuffix:"",pluginPackageName:"com.quicktvui.plugin.glintui",builtInVersions:{}};async function rt(e="com.quicktvui.plugin.glintui",r="_Plugin"){const f=U.useES();let d={};try{const p=await T.Native.callNativeModule("AddonEnvModule","getBuiltInVersions",[]);p&&typeof p=="object"&&(d=p)}catch(p){console.warn("[AddonProvider] Failed to fetch built-in versions from AddonEnvModule",p)}const m=`QtGridTabs${r}`,v=f.isComponentRegistered(m),u=v instanceof Promise?await v:v,c={isPluginActive:u,nameSuffix:u?r:"",pluginPackageName:u?`${e}.ext`:e,builtInVersions:d};return console.info("[AddonProvider] Environment initialized:",c),c}let de=a.ref(qe);function lt(e){de.value=e,a.provide(ge,de)}function q(){var e;return((e=a.inject(ge,de))==null?void 0:e.value)||qe}async function Re(e){console.log("[AddonProvider] Sending GridTabs global config to Native:",e);try{const r=await T.Native.callNativeWithPromise("GridTabsConfigModule","setDefaultConfig",JSON.stringify(e));return console.log("[AddonProvider] Received response from Native:",r),!!(r&&r.success)}catch(r){return console.error("[AddonProvider] Failed to initialize GridTabs global config:",r),!1}}async function Fe(e){console.log("[AddonProvider] Sending ExtraUI global theme config to Native:",e);try{const r=await T.Native.callNativeWithPromise("ExtraUIConfigModule","setThemeConfig",JSON.stringify(e));return console.log("[AddonProvider] Received ExtraUI theme response from Native:",r),!!(r&&r.success)}catch(r){return console.error("[AddonProvider] Failed to initialize ExtraUI global theme config:",r),!1}}async function it(e){console.log("[AddonProvider] Initializing global theme across all modules:",e);const r=await Fe(e),f=await Re({themeConfig:{placeholderColor:e.placeholderColor,glowColor:e.glowColor||e.focusBackgroundColor,outerBorderColor:e.outerBorderColor||e.focusBorderColor,innerBorderColor:e.innerBorderColor,enableElevationShadow:e.enableElevationShadow,cornerRadius:e.cornerRadius,buttonCornerRadius:e.buttonCornerRadius,primaryTextColor:e.primaryTextColor,secondaryTextColor:e.secondaryTextColor,focusTextColor:e.focusTextColor,selectedTextColor:e.selectedTextColor,selectedBackgroundColor:e.selectedBackgroundColor,focusBackgroundColor:e.focusBackgroundColor,buttonNormalBackgroundColor:e.buttonNormalBackgroundColor}});return r&&f}const Qe={install:e=>{e.use(Pe),e.use(Te),e.use(Ie),e.use(Se),e.use(Ee),e.use(xe),e.use(Ae),e.use(we),e.use(Be),e.use($e),e.use(Ge),e.use(Oe)}};exports.ADDON_ENV_CONTEXT_KEY=ge;exports.GridTabs=z;exports.GridTabsPlugin=Pe;exports.HsvBackground=X;exports.HsvBackgroundPlugin=Ee;exports.Keyboard=j;exports.KeyboardPlugin=Te;exports.NaButton=oe;exports.NaButtonPlugin=Ae;exports.NaCheckbox=ae;exports.NaCheckboxGroup=ie;exports.NaCheckboxGroupPlugin=$e;exports.NaCheckboxPlugin=we;exports.NaRadioGroup=le;exports.NaRadioGroupPlugin=Be;exports.NaSettingSwitch=ue;exports.NaSettingSwitchPlugin=Oe;exports.NaSwitcher=se;exports.NaSwitcherPlugin=Ge;exports.PortalItem=J;exports.PortalItemPlugin=Se;exports.PortalPool=K;exports.PortalPoolPlugin=Ie;exports.QuickTVUINAddons=Qe;exports.QuickTVUINAddonsConfig=_e;exports.SvgImage=ee;exports.SvgImagePlugin=xe;exports.default=Qe;exports.initAddonEnv=rt;exports.initExtraUIGlobalTheme=Fe;exports.initGlobalTheme=it;exports.initGridTabsGlobalConfig=Re;exports.provideAddonEnv=lt;exports.useAddonEnv=q;exports.useGridTabs=ze;exports.withAsyncPlugin=_;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),T=require("@extscreen/es3-vue"),U=require("@extscreen/es3-core"),Me={inheritAttrs:!1},z=a.defineComponent({...Me,__name:"GridTabs",props:{protocolVersion:{},pageSpec:{},tabsData:{},actionPayload:{}},emits:["onTabSelected","onTabClick","onTabNeedsData","onLoadMore","onScroll","onScrollStateChanged","onItemPresence","onTabFocused","onItemClick","onItemLongClick","onItemFocused","onProtocolMismatch"],setup(e,{expose:r}){const f=a.ref(),d=q(),v="QtGridTabs",m=v+"_Plugin",c=(d.isPluginActive?m:v).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value},dispatchAction:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;if(i)if(l.length>0){let A=l[0];typeof A=="object"&&(A=JSON.stringify(A)),T.Native.callUIFunction(i,"dispatchAction",[A])}else T.Native.callUIFunction(i,"dispatchAction",l)},scrollToTop:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;i&&T.Native.callUIFunction(i,"scrollToTop",l)},getFocusState:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;i&&T.Native.callUIFunction(i,"getFocusState",l)},getItemRect:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;i&&T.Native.callUIFunction(i,"getItemRect",l)},requestFocus:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;i&&T.Native.callUIFunction(i,"requestFocus",l)}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,protocolVersion:e.protocolVersion||"",pageSpec:e.pageSpec||"",tabsData:e.tabsData||"",actionPayload:e.actionPayload||"",onOnTabSelected:i[0]||(i[0]=g=>l.$emit("onTabSelected",g.nativeEvent)),onOnTabClick:i[1]||(i[1]=g=>l.$emit("onTabClick",g.nativeEvent)),onOnTabNeedsData:i[2]||(i[2]=g=>l.$emit("onTabNeedsData",g.nativeEvent)),onOnLoadMore:i[3]||(i[3]=g=>l.$emit("onLoadMore",g.nativeEvent)),onOnScroll:i[4]||(i[4]=g=>l.$emit("onScroll",g.nativeEvent)),onOnScrollStateChanged:i[5]||(i[5]=g=>l.$emit("onScrollStateChanged",g.nativeEvent)),onOnItemPresence:i[6]||(i[6]=g=>l.$emit("onItemPresence",g.nativeEvent)),onOnTabFocused:i[7]||(i[7]=g=>l.$emit("onTabFocused",g.nativeEvent)),onOnItemClick:i[8]||(i[8]=g=>l.$emit("onItemClick",g.nativeEvent)),onOnItemLongClick:i[9]||(i[9]=g=>l.$emit("onItemLongClick",g.nativeEvent)),onOnItemFocused:i[10]||(i[10]=g=>l.$emit("onItemFocused",g.nativeEvent)),onOnProtocolMismatch:i[11]||(i[11]=g=>l.$emit("onProtocolMismatch",g.nativeEvent))},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["protocolVersion","pageSpec","tabsData","actionPayload"]))}});let V;var ve;try{const e=require("@extscreen/es3-vue");V=e.registerElement||((ve=e.default)==null?void 0:ve.registerElement)}catch{}const Pe={install:e=>{if(!globalThis.__QtGridTabs_registered)if(V){const r=(f,d)=>{V(f,{component:{name:d?"QtGridTabs_Plugin":"QtGridTabs",processEventData(v,m){const u=v.handler||v,c=m||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-grid-tabs",!1),r("qt-grid-tabs-plugin",!0),r("QtGridTabs",!1),r("QtGridTabs_Plugin",!0),r("gt-tabs",!1),r("gt-tabs-plugin",!0),globalThis.__QtGridTabs_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtGridTabs")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("GridTabs",z),e.component("qt-grid-tabs",z),e.component("gt-tabs",z)}};function ze(e,r){const f=a.ref(""),d=r?JSON.parse(JSON.stringify(r)):{},v=a.shallowRef([]),m=a.shallowRef([]);let u=!1,c=!1;const p="__virtual_single_tab__";let l="",i=!1;const g=a.ref({}),C=o=>{const t=Array.isArray(o)?o:[o];if(c&&e.value){if(typeof e.value.dispatchAction=="function"){console.log("[useGridTabs] Calling Wrapper dispatchAction directly"),e.value.dispatchAction(t);return}let n=e.value;typeof e.value.getNativeNode=="function"?n=e.value.getNativeNode()||e.value:e.value.nativeRef&&(n=e.value.nativeRef),n?(console.log("[useGridTabs] Calling Native callUIFunction dispatchAction fallback"),T.Native.callUIFunction(n,"dispatchAction",[JSON.stringify(t)])):console.warn("[useGridTabs] Native target is null or undefined, cannot call dispatchAction")}},A=(o,t)=>{if(!o)return!1;let n=!0;return o.id||(console.error(`[useGridTabs] ❌ 数据格式错误 (${t}): 卡片缺失必填字段 'id'。每个卡片必须有唯一标识才能进行后续更新!`,o),n=!1),o.viewType||(console.error(`[useGridTabs] ❌ 数据格式错误 (${t}): 卡片缺失必填字段 'viewType' (id: ${o.id||"未知"})。必须指定 Native 注册的视图类型或 Portal 标识!`,o),n=!1),n},$=(o,t)=>{if(!o)return!1;let n=!0;return o.tabId||(console.error(`[useGridTabs] ❌ 数据格式错误 (${t}): Tab 缺失必填字段 'tabId'。每个 Tab 必须有唯一标识!`,o),n=!1),(o.title===void 0||o.title===null)&&console.warn(`[useGridTabs] ⚠️ 数据格式警告 (${t}): Tab 缺失 'title' 字段 (tabId: ${o.tabId||"未知"}),导航栏可能显示为空。`,o),n},M=(o,t)=>{if(!o||o.length===0)return;R.clear();const n=o[0].hasOwnProperty("tabId")||o[0].hasOwnProperty("items")&&Array.isArray(o[0].items);u=t==="1d",t==="1d"&&n?console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `items.value` (一维瀑布流) 赋值二维 Tabs 数据结构!请改用 `tabs.value = ...`"):t==="2d"&&!n&&console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `tabs.value` (二维导航) 赋值一维卡片列表数据结构!请改用 `items.value = ...`"),t==="1d"?o.forEach((s,b)=>A(s,`items.value[${b}]`)):o.forEach((s,b)=>{$(s,`tabs.value[${b}]`),s.items&&Array.isArray(s.items)&&s.items.forEach((h,y)=>A(h,`tabs.value[${b}].items[${y}]`))}),c=!0,k()},R=new Set,k=(o="unknown")=>{if(!c){console.warn("[useGridTabs] triggerRootUpdate skipped because isInitialized is false");return}let t={protocolVersion:"1.28.0",gridBasis:(d==null?void 0:d.gridBasis)??30,unitType:(d==null?void 0:d.unitType)??"px",contentConfig:(d==null?void 0:d.contentConfig)??(d==null?void 0:d.layoutConfig)??{box:{padding:[0,60,60,60]},navContentGapNormal:0,itemGap:24},navConfig:(d==null?void 0:d.navConfig)??{dock:"left",mode:"fixed",renderType:"smart-hybrid",box:{size:[200,0]},expandedBox:{size:[300,0]}},cacheConfig:(d==null?void 0:d.cacheConfig)??{offscreenPageLimit:1,prefetchOffset:2,preLoadEnabled:!1,strategy:"data_priority"},animationConfig:(d==null?void 0:d.animationConfig)??{duration:300,easing:"ease-out"},interactionStrategy:(d==null?void 0:d.interactionStrategy)??{defaultFocus:"nav",interceptBack:!0,backMode:"home-first",autoScrollToTop:!0,edgeScrollProtection:.5},focusConfig:(d==null?void 0:d.focusConfig)??{boundaryLock:{left:!1,right:!1,top:!1,bottom:!1}},themeConfig:d==null?void 0:d.themeConfig,referenceResolution:(d==null?void 0:d.referenceResolution)??{w:1920,h:1080}},n=[];u?(t.navConfig={...t.navConfig,renderType:"none"},n=[{tabId:p,title:"Virtual Tab",hidden:!0,items:m.value}]):n=v.value;const s=JSON.stringify({page_spec:t,tabs:n});if(f.value==="")console.log(`[useGridTabs] triggerRootUpdate: Initializing tabsDataStr (length=${s.length})`),f.value=s,l=s;else{if(l===s){console.log("[useGridTabs] triggerRootUpdate: Data unchanged, skipping RELOAD_TABS");return}console.log(`[useGridTabs] triggerRootUpdate: Sending RELOAD_TABS action directly to Native (length=${s.length})`),f.value=s,l=s,C({op:"RELOAD_TABS",payload:{pageSpec:t,page_spec:t,tabs:n}})}},P=o=>{if(!o||typeof o!="object"||o.__isGridTabsProxy)return o;o.content&&typeof o.content=="object"&&!o.content.__isGridTabsProxy&&(o.content=new Proxy(o.content,{set(n,s,b,h){const y=Reflect.set(n,s,b,h);return o.id&&c&&C({op:"UPDATE_ITEM",itemId:o.id,payload:o}),y}}),Object.defineProperty(o.content,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(o.content,"__v_skip",{value:!0,enumerable:!1})),o.subItems&&Array.isArray(o.subItems)&&!o.subItems.__isGridTabsProxy&&(o.subItems=S(o.subItems,o.id),Object.defineProperty(o.subItems,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(o.subItems,"__v_skip",{value:!0,enumerable:!1}));const t=new Proxy(o,{set(n,s,b,h){const y=Reflect.set(n,s,b,h);return n.id&&c&&!i&&C({op:"UPDATE_ITEM",itemId:n.id,payload:n}),y}});return Object.defineProperty(t,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(t,"__v_skip",{value:!0,enumerable:!1}),t},S=(o,t)=>{for(let n=0;n<o.length;n++)o[n]=P(o[n]);return new Proxy(o,{get(n,s,b){return s==="push"?(...h)=>{h.forEach((G,D)=>A(G,`push(${D})`)),c||console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 push()。请先对 items.value 或 tabs.value 进行全量赋值!");const y=h.map(G=>P(G)),N=Array.prototype.push.apply(n,y);return i||C({op:"APPEND_SUB_ITEMS",itemId:t,payload:{subItems:y}}),N}:s==="unshift"?(...h)=>{h.forEach((G,D)=>A(G,`unshift(${D})`)),c||console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 unshift()。请先对 items.value 或 tabs.value 进行全量赋值!");const y=h.map(G=>P(G)),N=Array.prototype.unshift.apply(n,y);return c&&y.length>0&&!i&&C({op:"PREPEND_SUB_ITEMS",itemId:t,payload:{subItems:y}}),N}:s==="splice"?(...h)=>{const y=h.length>=2&&h[0]===0&&h[1]===n.length,N=Array.prototype.splice.apply(n,h);return c&&y&&t!==p?i||C({op:"CLEAR_SUB_ITEMS",itemId:t}):c&&(i||k("items array spliced")),N}:Reflect.get(n,s,b)},set(n,s,b,h){if(s!=="length"&&!isNaN(Number(s))){c||console.error(`[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时直接修改了索引 [${String(s)}]。请先对 items.value 或 tabs.value 进行全量赋值!`),A(b,`索引赋值 [${String(s)}]`);const y=P(b),N=Reflect.set(n,s,y,h);return y&&y.id&&!i&&C({op:"UPDATE_ITEM",itemId:y.id,payload:y}),N}return Reflect.set(n,s,b,h)}})},E=o=>(o.items&&Array.isArray(o.items)&&!o.items.__isGridTabsProxy&&(o.items=S(o.items,o.tabId),Object.defineProperty(o.items,"__isGridTabsProxy",{value:!0,enumerable:!1})),new Proxy(o,{set(t,n,s,b){if(n==="items"){let y=s;return Array.isArray(s)&&!s.__isGridTabsProxy&&(y=S(s,t.tabId),Object.defineProperty(y,"__isGridTabsProxy",{value:!0,enumerable:!1})),Reflect.set(t,n,y,b)}else if(n==="loadState"){const y=Reflect.set(t,n,s,b);return c&&t.tabId&&!i&&C({op:"UPDATE_TAB_STATE",itemId:t.tabId,payload:{loadState:s}}),y}return Reflect.set(t,n,s,b)}})),w=o=>{const t=o.map(n=>E(n));return new Proxy(t,{set(n,s,b,h){if(s!=="length"&&!isNaN(Number(s))){let y=b;b.__isGridTabsProxy||(y=E(b),Object.defineProperty(y,"__isGridTabsProxy",{value:!0,enumerable:!1}));const N=Reflect.set(n,s,y,h);return k(),N}return Reflect.set(n,s,b,h)}})};a.watch(v,(o,t)=>{if(console.log("[useGridTabs] watch(tabs) triggered:",{newTabs:o,isInitialized:c}),!o||o.length===0){f.value="",l="",c=!1;return}if(o.__isGridTabsProxy)console.log("[useGridTabs] newTabs is ALREADY a proxy, triggering root update"),k();else{console.log("[useGridTabs] newTabs is NOT a proxy, performing full deduceModeAndInitialize & wrapping");const n=w(o);Object.defineProperty(n,"__isGridTabsProxy",{value:!0,enumerable:!1}),M(n,"2d"),v.value=n}},{flush:"sync",deep:!1}),a.watch(m,(o,t)=>{if(console.log("[useGridTabs] watch(items) triggered:",{newItems:o,isInitialized:c}),!o||o.length===0){f.value="",l="",c=!1;return}if(o.__isGridTabsProxy)console.log("[useGridTabs] newItems is ALREADY a proxy, triggering root update"),k();else{console.log("[useGridTabs] newItems is NOT a proxy, performing full deduceModeAndInitialize & wrapping");const n=S(o,p);Object.defineProperty(n,"__isGridTabsProxy",{value:!0,enumerable:!1}),M(n,"1d"),m.value=n}},{flush:"sync",deep:!1});const I={},B=()=>{console.log("[useGridTabs] resetInitialization called manually"),c=!1,R.clear();for(const o in I)delete I[o]},O=o=>{if(!o||o.length===0){f.value="",c=!1;return}o[0].hasOwnProperty("tabId")||o[0].hasOwnProperty("items")&&Array.isArray(o[0].items)?v.value=o:m.value=o},x=o=>{g.value=o},F=a.computed(()=>({tabsData:f.value,onTabNeedsData:async(...o)=>{let t=o[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),!g.value.onTabNeedsData)return;const{tabId:n,index:s,reason:b}=t;if(R.has(n)){console.log(`[useGridTabs] onTabNeedsData SKIP: tabId=${n} 已经发起过请求,防止死循环`);return}R.add(n);try{const h=await g.value.onTabNeedsData(n,s,b);if(h&&Array.isArray(h))if(I[n]=1,h.length>0){const y=v.value.find(N=>N.tabId===n);y&&(y.items?y.items.length>0&&y.items.splice(0,y.items.length):y.items=[],y.items.push(...h),y.loadState="ready",C({op:"UPDATE_TAB_STATE",itemId:n,payload:{loadState:"ready"}}))}else console.warn(`[useGridTabs] ⚠️ 警告: onTabNeedsData(tabId="${n}") 返回了空数组 []!`),console.warn("👉 如果你已经在此函数内手动调用了 push() 来追加数据,请在最后 return null 或 undefined。"),console.warn("👉 如果该 Tab 确实没有数据,返回 [] 可能会导致底层的 Header 等已有元素被清空,请注意检查。"),console.warn("👉 框架已为您拦截此次空数组覆盖,保留了当前的 DOM 结构。")}catch(h){console.error("[useGridTabs] onTabNeedsData 执行失败:",h),R.delete(n)}},onLoadMore:async(...o)=>{let t=o[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),!g.value.onLoadMore)return;const{tabId:n,itemId:s}=t,h=(I[n]||1)+1;console.log(`[useGridTabs] 拦截到底层 onLoadMore,强行接管页码: tabId=${n}, pageNo=${h}`);try{const y=await g.value.onLoadMore(n,h,s);if(y&&Array.isArray(y))if(y.length>0)if(I[n]=h,u)m.value.push(...y);else{const N=v.value.find(G=>G.tabId===n);N&&N.items&&N.items.push(...y)}else console.warn(`[useGridTabs] ⚠️ 警告: onLoadMore(tabId="${n}", pageNo="${h}") 返回了空数组 []!`),console.warn('👉 如果这是你的最后一页数据,推荐在卡片列表中追加一个 type="no_more" 的 footer 卡片,而不是仅仅返回空。'),console.warn("👉 框架已忽略本次空数据追加,且不会自增页码。")}catch(y){console.error("[useGridTabs] onLoadMore 业务层请求失败:",y)}},onItemPresence:(...o)=>{let t=o[0];if(console.log("[useGridTabs] ⚡️ bindings caught onItemPresence:",t),g.value.onItemPresence)try{let n=typeof t=="string"?t:(t==null?void 0:t.nativeEvent)||t;n&&typeof n.data=="string"&&(n=n.data);const s=typeof n=="string"?JSON.parse(n):n;s&&s.type==="VIEW_PRESENCE_BATCH"&&Array.isArray(s.payload)?s.payload.forEach(b=>{b.itemId&&typeof b.itemId=="string"&&b.itemId.startsWith("fallback_pos_")&&console.warn(`[useGridTabs] ⚠️ 警告:检测到列表项曝光 (index=${b.index}),但未配置 itemId。请检查传入的 items 数组,务必为每个数据项指定唯一的 itemId,否则底层无法准确进行去重与曝光上报。`),g.value.onItemPresence(b)}):g.value.onItemPresence(s)}catch(n){console.error("[useGridTabs] Failed to parse onItemPresence event payload:",n),g.value.onItemPresence(t)}},onTabSelected:(...o)=>{let t=o[0];t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onTabSelected&&g.value.onTabSelected(t)},onTabClick:(...o)=>{let t=o[0];t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onTabClick&&g.value.onTabClick(t)},onItemClick:(...o)=>{let t=o[0];if(console.log("[useGridTabs] RAW onItemClick intercepted from Native:",t),t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onItemClick)try{let n=typeof t=="string"?t:(t==null?void 0:t.data)||t;const s=typeof n=="string"?JSON.parse(n):n;if(s&&typeof s.clickPayload=="string")try{s.clickPayload=JSON.parse(s.clickPayload)}catch(b){console.warn("Failed to parse clickPayload:",b)}if(s&&typeof s.focusPayload=="string")try{s.focusPayload=JSON.parse(s.focusPayload)}catch(b){console.warn("Failed to parse focusPayload:",b)}g.value.onItemClick(s)}catch(n){console.error("[useGridTabs] Failed to parse onItemClick event payload:",n),g.value.onItemClick(t)}else console.warn("[useGridTabs] onItemClick triggered but NO callback registered in callbacksRef!")},onItemLongClick:(...o)=>{let t=o[0];if(console.log("[useGridTabs] RAW onItemLongClick intercepted from Native:",t),typeof t=="number"&&o.length>=3&&typeof o[1]=="string"&&(t=o[2]),t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onItemLongClick)try{let n=typeof t=="string"?t:(t==null?void 0:t.data)||t;const s=typeof n=="string"?JSON.parse(n):n;if(s&&typeof s.clickPayload=="string")try{s.clickPayload=JSON.parse(s.clickPayload)}catch{}if(s&&typeof s.focusPayload=="string")try{s.focusPayload=JSON.parse(s.focusPayload)}catch{}g.value.onItemLongClick(s)}catch(n){console.error("[useGridTabs] Failed to parse onItemLongClick event payload:",n),g.value.onItemLongClick(t)}},onItemFocused:(...o)=>{let t=o[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onItemFocused)try{let n=typeof t=="string"?t:(t==null?void 0:t.data)||t;const s=typeof n=="string"?JSON.parse(n):n;if(s&&typeof s.clickPayload=="string")try{s.clickPayload=JSON.parse(s.clickPayload)}catch{}if(s&&typeof s.focusPayload=="string")try{s.focusPayload=JSON.parse(s.focusPayload)}catch{}g.value.onItemFocused(s)}catch(n){console.error("[useGridTabs] Failed to parse onItemFocused event payload:",n),g.value.onItemFocused(t)}},onTabFocused:(...o)=>{let t=o[0];t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onTabFocused&&g.value.onTabFocused(t)},onScroll:(...o)=>{let t=o[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onScroll)try{const n=(t==null?void 0:t.data)||t;g.value.onScroll(n)}catch{g.value.onScroll(t)}},onScrollStateChanged:(...o)=>{let t=o[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),g.value.onScrollStateChanged)try{const n=(t==null?void 0:t.data)||t;g.value.onScrollStateChanged(n)}catch{g.value.onScrollStateChanged(t)}}}));return{tabsDataStr:f,bindings:F,tabs:v,items:m,initData:O,setCallbacks:x,updateItem:(o,t)=>{if(!c){console.error("[useGridTabs] ❌ 时机错误: 尚未初始化数据,无法调用 updateItem");return}C({op:"UPDATE_ITEM",itemId:o,payload:t}),i=!0;try{if(u){const n=m.value.find(s=>s.id===o);n&&Object.assign(n,t)}else for(const n of v.value)if(n.items){const s=n.items.find(b=>b.id===o);if(s){Object.assign(s,t);break}}}finally{i=!1}},deleteItem:(o,t=!0)=>{if(c){C({op:"DELETE_ITEM",itemId:o,payload:{animated:t}}),i=!0;try{if(u){const n=m.value.findIndex(s=>s.id===o);n!==-1&&m.value.splice(n,1)}else for(const n of v.value)if(n.items){const s=n.items.findIndex(b=>b.id===o);if(s!==-1){n.items.splice(s,1);break}}}finally{i=!1}}},prependItems:(o,t)=>{if(c){C({op:"PREPEND_SUB_ITEMS",itemId:o,payload:{subItems:t}}),i=!0;try{if(u)m.value.unshift(...t);else{const n=v.value.find(s=>s.tabId===o);n&&n.items&&n.items.unshift(...t)}}finally{i=!1}}},clearItems:o=>{if(c){C({op:"CLEAR_SUB_ITEMS",itemId:o}),i=!0;try{if(u)m.value.splice(0,m.value.length);else{const t=v.value.find(n=>n.tabId===o);t&&t.items&&t.items.splice(0,t.items.length)}}finally{i=!1}}},moveItem:(o,t,n)=>{if(c){C({op:"MOVE_ITEM",itemId:o,payload:{targetPosition:t,anchorItemId:n}}),i=!0;try{const s=b=>{const h=b.findIndex(N=>N.id===o),y=b.findIndex(N=>N.id===n);if(h!==-1&&y!==-1){const N=b.splice(h,1)[0],G=b.findIndex(De=>De.id===n),D=t==="after"?G+1:G;b.splice(D,0,N)}};if(u)s(m.value);else for(const b of v.value)b.items&&s(b.items)}finally{i=!1}}},replaceItem:(o,t)=>{if(c){C({op:"REPLACE_ITEM",itemId:o,payload:t}),i=!0;try{if(u){const n=m.value.findIndex(s=>s.id===o);n!==-1&&(m.value[n]=t)}else for(const n of v.value)if(n.items){const s=n.items.findIndex(b=>b.id===o);if(s!==-1){n.items[s]=t;break}}}finally{i=!1}}},dispatchAction:C,resetInitialization:B,getFocusState:async()=>new Promise((o,t)=>{let n=e.value;typeof e.value.getNativeNode=="function"?n=e.value.getNativeNode()||e.value:e.value.nativeRef&&(n=e.value.nativeRef),console.log("[useGridTabs] getFocusState called, nativeTarget:",n);const s=b=>{if(console.log("[useGridTabs] getFocusState callback received:",b),b&&b.isSuccess!==void 0&&b.result!==void 0){o(b.result);return}try{const h=typeof b=="string"?JSON.parse(b):b;o(h)}catch(h){t(h)}};typeof T.Native.callUIFunction=="function"?(console.log('[useGridTabs] Executing Native.callUIFunction("getFocusState") with callback as 4th arg'),T.Native.callUIFunction(n,"getFocusState",[],s)):(console.error("[useGridTabs] Native.callUIFunction is not available"),t(new Error("Native.callUIFunction is not available")))}),getItemRect:async o=>new Promise((t,n)=>{let s=e.value;typeof e.value.getNativeNode=="function"?s=e.value.getNativeNode()||e.value:e.value.nativeRef&&(s=e.value.nativeRef),console.log(`[useGridTabs] getItemRect called for itemId=${o}, nativeTarget:`,s);const b=h=>{if(console.log(`[useGridTabs] getItemRect callback received for itemId=${o}:`,h),h&&h.isSuccess!==void 0&&h.result!==void 0){t(h.result);return}try{const y=typeof h=="string"?JSON.parse(h):h;t(y)}catch(y){n(y)}};typeof T.Native.callUIFunction=="function"?(console.log('[useGridTabs] Executing Native.callUIFunction("getItemRect") with itemId and callback as 4th arg'),T.Native.callUIFunction(s,"getItemRect",[o],b)):(console.error("[useGridTabs] Native.callUIFunction is not available"),n(new Error("Native.callUIFunction is not available")))}),requestFocus:o=>{let t=e.value;typeof e.value.getNativeNode=="function"?t=e.value.getNativeNode()||e.value:e.value.nativeRef&&(t=e.value.nativeRef),T.Native.callUIFunction(t,"requestFocus",[o])},updatePageSpec:o=>{if(!c)return;const t=Object.assign({},JSON.parse(f.value).page_spec,o);o.layout&&(t.navConfig=Object.assign({},t.navConfig,o.layout)),o.navConfig&&(t.navConfig=Object.assign({},t.navConfig,o.navConfig)),o.contentConfig&&(t.contentConfig=Object.assign({},t.contentConfig,o.contentConfig)),d&&Object.assign(d,t),C({op:"RELOAD_TABS",payload:{pageSpec:t,page_spec:t,tabs:v.value}});const n=JSON.parse(f.value);n.page_spec=t,f.value=JSON.stringify(n),l=f.value},reloadAll:(o,t)=>{d&&(Object.keys(d).forEach(n=>delete d[n]),Object.assign(d,o)),v.value=t,C({op:"RELOAD_TABS",payload:{pageSpec:o,page_spec:o,tabs:t}})},scrollToTop:()=>{let o=e.value;typeof e.value.getNativeNode=="function"?o=e.value.getNativeNode()||e.value:e.value.nativeRef&&(o=e.value.nativeRef),T.Native.callUIFunction(o,"scrollToTop",[])}}}const Le={inheritAttrs:!1},j=a.defineComponent({...Le,__name:"Keyboard",props:{backgroundColor:{},backgroundGradient:{},textColor:{},weakTextColor:{},focusBackgroundColor:{},focusTextColor:{},placeholder:{},textFullKeyboard:{},textT9Keyboard:{},keyboardType:{},textClear:{},textDelete:{},currentInput:{},autofocus:{type:Boolean},rememberKeyboardType:{type:Boolean}},emits:["onInputChanged","onKeyPressed"],setup(e,{expose:r}){const f=a.ref(),d=q(),v="QtKeyboard",m=v+"_Plugin",c=(d.isPluginActive?m:v).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value},requestFocus:(...l)=>{var g,C;const i=((C=(g=f.value)==null?void 0:g.getNativeNode)==null?void 0:C.call(g))||f.value;i&&T.Native.callUIFunction(i,"requestFocus",l)}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,backgroundColor:e.backgroundColor||"",backgroundGradient:e.backgroundGradient||"",textColor:e.textColor||"",weakTextColor:e.weakTextColor||"",focusBackgroundColor:e.focusBackgroundColor||"",focusTextColor:e.focusTextColor||"",placeholder:e.placeholder||"",textFullKeyboard:e.textFullKeyboard||"",textT9Keyboard:e.textT9Keyboard||"",keyboardType:e.keyboardType,textClear:e.textClear||"",textDelete:e.textDelete||"",currentInput:e.currentInput||"",autofocus:e.autofocus,rememberKeyboardType:e.rememberKeyboardType,onOnInputChanged:i[0]||(i[0]=g=>l.$emit("onInputChanged",g.nativeEvent)),onOnKeyPressed:i[1]||(i[1]=g=>l.$emit("onKeyPressed",g.nativeEvent))},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["backgroundColor","backgroundGradient","textColor","weakTextColor","focusBackgroundColor","focusTextColor","placeholder","textFullKeyboard","textT9Keyboard","keyboardType","textClear","textDelete","currentInput","autofocus","rememberKeyboardType"]))}});let W;var me;try{const e=require("@extscreen/es3-vue");W=e.registerElement||((me=e.default)==null?void 0:me.registerElement)}catch{}const Te={install:e=>{if(!globalThis.__QtKeyboard_registered)if(W){const r=(f,d)=>{W(f,{component:{name:d?"QtKeyboard_Plugin":"QtKeyboard",processEventData(v,m){const u=v.handler||v,c=m||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-keyboard",!1),r("qt-keyboard-plugin",!0),r("QtKeyboard",!1),r("QtKeyboard_Plugin",!0),globalThis.__QtKeyboard_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtKeyboard")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("Keyboard",j),e.component("qt-keyboard",j)}},Ue={inheritAttrs:!1},K=a.defineComponent({...Ue,__name:"PortalPool",setup(e,{expose:r}){const f=a.ref(),d=q(),v="QtPortalPool",m=v+"_Plugin",c=(d.isPluginActive?m:v).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,style:{position:"absolute"},absolute:!0},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16))}});let H;var be;try{const e=require("@extscreen/es3-vue");H=e.registerElement||((be=e.default)==null?void 0:be.registerElement)}catch{}const Ie={install:e=>{if(!globalThis.__QtPortalPool_registered)if(H){const r=(f,d)=>{H(f,{component:{name:d?"QtPortalPool_Plugin":"QtPortalPool",processEventData(v,m){const u=v.handler||v,c=m||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-portal-pool",!1),r("qt-portal-pool-plugin",!0),r("QtPortalPool",!1),r("QtPortalPool_Plugin",!0),globalThis.__QtPortalPool_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtPortalPool")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("PortalPool",K),e.component("qt-portal-pool",K)}},Ve={inheritAttrs:!1},J=a.defineComponent({...Ve,__name:"PortalItem",props:{portalId:{}},setup(e,{expose:r}){const f=a.ref(),d=q(),v="QtPortalItem",m=v+"_Plugin",c=(d.isPluginActive?m:v).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,style:{position:"absolute"},absolute:!0,portalId:e.portalId||""},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["portalId"]))}});let Z;var ye;try{const e=require("@extscreen/es3-vue");Z=e.registerElement||((ye=e.default)==null?void 0:ye.registerElement)}catch{}const Se={install:e=>{if(!globalThis.__QtPortalItem_registered)if(Z){const r=(f,d)=>{Z(f,{component:{name:d?"QtPortalItem_Plugin":"QtPortalItem",processEventData(v,m){const u=v.handler||v,c=m||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-portal-item",!1),r("qt-portal-item-plugin",!0),r("QtPortalItem",!1),r("QtPortalItem_Plugin",!0),globalThis.__QtPortalItem_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtPortalItem")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("PortalItem",J),e.component("qt-portal-item",J)}},je={inheritAttrs:!1},X=a.defineComponent({...je,__name:"HsvBackground",props:{hue:{},hueDuration:{}},setup(e,{expose:r}){const f=a.ref(),d=q(),v="QtHsvBackground",m=v+"_Plugin",c=(d.isPluginActive?m:v).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,hue:e.hue,hueDuration:e.hueDuration},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["hue","hueDuration"]))}});let Y;var he;try{const e=require("@extscreen/es3-vue");Y=e.registerElement||((he=e.default)==null?void 0:he.registerElement)}catch{}const Ee={install:e=>{if(!globalThis.__QtHsvBackground_registered)if(Y){const r=(f,d)=>{Y(f,{component:{name:d?"QtHsvBackground_Plugin":"QtHsvBackground",processEventData(v,m){const u=v.handler||v,c=m||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-hsv-background",!1),r("qt-hsv-background-plugin",!0),r("QtHsvBackground",!1),r("QtHsvBackground_Plugin",!0),globalThis.__QtHsvBackground_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtHsvBackground")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("HsvBackground",X),e.component("qt-hsv-background",X)}},We={inheritAttrs:!1},ee=a.defineComponent({...We,__name:"SvgImage",props:{src:{},tintColor:{}},setup(e,{expose:r}){const f=a.ref(),d=q(),v="QtSvgImage",m=v+"_Plugin",c=(d.isPluginActive?m:v).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,src:e.src||"",tintColor:e.tintColor||""},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["src","tintColor"]))}});let te;var pe;try{const e=require("@extscreen/es3-vue");te=e.registerElement||((pe=e.default)==null?void 0:pe.registerElement)}catch{}const xe={install:e=>{if(!globalThis.__QtSvgImage_registered)if(te){const r=(f,d)=>{te(f,{component:{name:d?"QtSvgImage_Plugin":"QtSvgImage",processEventData(v,m){const u=v.handler||v,c=m||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-svg-image",!1),r("qt-svg-image-plugin",!0),r("QtSvgImage",!1),r("QtSvgImage_Plugin",!0),globalThis.__QtSvgImage_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtSvgImage")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("SvgImage",ee),e.component("qt-svg-image",ee)}},Ke={inheritAttrs:!1},He=a.defineComponent({...Ke,__name:"NaButtonBase",props:{text:{},icon:{},iconSize:{},iconSpace:{},layoutDirection:{},fontSize:{},maxLines:{},textColor:{},focusTextColor:{},backgroundColor:{},focusBackgroundColor:{},normalBorderWidth:{},normalBorderColor:{},focusBorderColor:{},cornerRadius:{},focusScale:{},enableFocusBorder:{type:Boolean}},emits:["onButtonCustomEvent"],setup(e,{expose:r}){const f=a.ref(),d=q(),v="QtNaButton",m=v+"_Plugin",c=(d.isPluginActive?m:v).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,text:e.text||"",icon:e.icon||"",iconSize:e.iconSize,iconSpace:e.iconSpace,layoutDirection:e.layoutDirection||"",fontSize:e.fontSize,maxLines:e.maxLines,textColor:e.textColor||"",focusTextColor:e.focusTextColor||"",backgroundColor:e.backgroundColor||"",focusBackgroundColor:e.focusBackgroundColor||"",normalBorderWidth:e.normalBorderWidth,normalBorderColor:e.normalBorderColor||"",focusBorderColor:e.focusBorderColor||"",cornerRadius:e.cornerRadius,focusScale:e.focusScale,enableFocusBorder:e.enableFocusBorder,onOnButtonCustomEvent:i[0]||(i[0]=g=>l.$emit("onButtonCustomEvent",g.nativeEvent))},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["text","icon","iconSize","iconSpace","layoutDirection","fontSize","maxLines","textColor","focusTextColor","backgroundColor","focusBackgroundColor","normalBorderWidth","normalBorderColor","focusBorderColor","cornerRadius","focusScale","enableFocusBorder"]))}}),Je={inheritAttrs:!1},oe=a.defineComponent({...Je,__name:"NaButton",props:{width:{},height:{}},setup(e){const r=e,f=a.useAttrs(),d=a.computed(()=>{const v={};r.width!==void 0&&(v.width=typeof r.width=="number"?`${r.width}px`:r.width),r.height!==void 0&&(v.height=typeof r.height=="number"?`${r.height}px`:r.height);const m=f.style||{};return{...v,...typeof m=="object"?m:{}}});return(v,m)=>(a.openBlock(),a.createBlock(He,a.mergeProps(v.$attrs,{style:d.value}),{default:a.withCtx(()=>[a.renderSlot(v.$slots,"default")]),_:3},16,["style"]))}});let ne;var Ce;try{const e=require("@extscreen/es3-vue");ne=e.registerElement||((Ce=e.default)==null?void 0:Ce.registerElement)}catch{}const Ae={install:e=>{if(!globalThis.__QtNaButton_registered)if(ne){const r=(f,d)=>{ne(f,{component:{name:d?"QtNaButton_Plugin":"QtNaButton",processEventData(v,m){const u=v.handler||v,c=m||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-na-button",!1),r("qt-na-button-plugin",!0),r("QtNaButton",!1),r("QtNaButton_Plugin",!0),globalThis.__QtNaButton_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtNaButton")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("NaButton",oe),e.component("qt-na-button",oe)}},Ze={inheritAttrs:!1},ae=a.defineComponent({...Ze,__name:"NaCheckbox",props:{text:{},checked:{type:Boolean},disabled:{type:Boolean},checkedIcon:{},uncheckedIcon:{},iconSize:{},iconSpace:{},layoutDirection:{},gravity:{},paddingX:{},showBackground:{type:Boolean},fontSize:{},textColor:{},focusTextColor:{},checkedTextColor:{},focusCheckedTextColor:{},disabledTextColor:{},iconColor:{},focusIconColor:{},checkedIconColor:{},focusCheckedIconColor:{},disabledIconColor:{},iconInnerColor:{},focusIconInnerColor:{},checkedIconInnerColor:{},focusCheckedIconInnerColor:{},disabledIconInnerColor:{},focusMode:{},bgColor:{},focusBgColor:{},checkedBgColor:{},focusCheckedBgColor:{},disabledBgColor:{},borderColor:{},focusBorderColor:{},checkedBorderColor:{},focusCheckedBorderColor:{},disabledBorderColor:{},cornerRadius:{},focusScale:{},type:{}},emits:["onCheckedChange"],setup(e,{expose:r}){const f=a.ref(),d=q(),v="QtNaCheckbox",m=v+"_Plugin",c=(d.isPluginActive?m:v).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,text:e.text||"",checked:e.checked,disabled:e.disabled,checkedIcon:e.checkedIcon||"",uncheckedIcon:e.uncheckedIcon||"",iconSize:e.iconSize,iconSpace:e.iconSpace,layoutDirection:e.layoutDirection||"",gravity:e.gravity||"",paddingX:e.paddingX,showBackground:e.showBackground,fontSize:e.fontSize,textColor:e.textColor,focusTextColor:e.focusTextColor,checkedTextColor:e.checkedTextColor,focusCheckedTextColor:e.focusCheckedTextColor,disabledTextColor:e.disabledTextColor,iconColor:e.iconColor,focusIconColor:e.focusIconColor,checkedIconColor:e.checkedIconColor,focusCheckedIconColor:e.focusCheckedIconColor,disabledIconColor:e.disabledIconColor,iconInnerColor:e.iconInnerColor,focusIconInnerColor:e.focusIconInnerColor,checkedIconInnerColor:e.checkedIconInnerColor,focusCheckedIconInnerColor:e.focusCheckedIconInnerColor,disabledIconInnerColor:e.disabledIconInnerColor,focusMode:e.focusMode||"",bgColor:e.bgColor,focusBgColor:e.focusBgColor,checkedBgColor:e.checkedBgColor,focusCheckedBgColor:e.focusCheckedBgColor,disabledBgColor:e.disabledBgColor,borderColor:e.borderColor,focusBorderColor:e.focusBorderColor,checkedBorderColor:e.checkedBorderColor,focusCheckedBorderColor:e.focusCheckedBorderColor,disabledBorderColor:e.disabledBorderColor,cornerRadius:e.cornerRadius,focusScale:e.focusScale,type:e.type||"",onOnCheckedChange:i[0]||(i[0]=g=>l.$emit("onCheckedChange",g.nativeEvent))},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["text","checked","disabled","checkedIcon","uncheckedIcon","iconSize","iconSpace","layoutDirection","gravity","paddingX","showBackground","fontSize","textColor","focusTextColor","checkedTextColor","focusCheckedTextColor","disabledTextColor","iconColor","focusIconColor","checkedIconColor","focusCheckedIconColor","disabledIconColor","iconInnerColor","focusIconInnerColor","checkedIconInnerColor","focusCheckedIconInnerColor","disabledIconInnerColor","focusMode","bgColor","focusBgColor","checkedBgColor","focusCheckedBgColor","disabledBgColor","borderColor","focusBorderColor","checkedBorderColor","focusCheckedBorderColor","disabledBorderColor","cornerRadius","focusScale","type"]))}});let re;var ke;try{const e=require("@extscreen/es3-vue");re=e.registerElement||((ke=e.default)==null?void 0:ke.registerElement)}catch{}const we={install:e=>{if(!globalThis.__QtNaCheckbox_registered)if(re){const r=(f,d)=>{re(f,{component:{name:d?"QtNaCheckbox_Plugin":"QtNaCheckbox",processEventData(v,m){const u=v.handler||v,c=m||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-na-checkbox",!1),r("qt-na-checkbox-plugin",!0),r("QtNaCheckbox",!1),r("QtNaCheckbox_Plugin",!0),globalThis.__QtNaCheckbox_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtNaCheckbox")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("NaCheckbox",ae),e.component("qt-na-checkbox",ae)}},Xe=a.defineComponent({name:"NaRadioGroup",props:{modelValue:{type:[String,Number,Boolean],default:""},options:{type:Array,default:()=>[]},direction:{type:String,default:"row"},itemWidth:{type:Number,default:void 0},itemHeight:{type:Number,default:void 0},itemGap:{type:Number,default:20},gravity:{type:String,default:"center"},showBackground:{type:Boolean,default:!0}},emits:["update:modelValue","change"],setup(e,{emit:r}){return{groupStyle:a.computed(()=>({display:"flex",flexDirection:e.direction,alignItems:"center"})),getItemStyle:(m,u)=>{var p;const c={...((p=m.props)==null?void 0:p.style)||{}};return e.itemWidth!==void 0&&(c.width=e.itemWidth),e.itemHeight!==void 0&&(c.height=e.itemHeight),u!==e.options.length-1&&(e.direction==="row"?c.marginRight=e.itemGap:c.marginBottom=e.itemGap),c},onItemClick:m=>{m.disabled||(r("update:modelValue",m.value),r("change",m.value))}}}});const fe=(e,r)=>{const f=e.__vccOpts||e;for(const[d,v]of r)f[d]=v;return f};function Ye(e,r,f,d,v,m){const u=a.resolveComponent("qt-na-checkbox");return a.openBlock(),a.createElementBlock("div",{class:"na-radio-group",style:a.normalizeStyle(e.groupStyle)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.options,(c,p)=>(a.openBlock(),a.createBlock(u,a.mergeProps({key:p,type:"radio",checked:e.modelValue===c.value,text:c.label,gravity:e.gravity,showBackground:e.showBackground,disabled:c.disabled},{ref_for:!0},c.props,{style:e.getItemStyle(c,p),onClick:l=>e.onItemClick(c)}),null,16,["checked","text","gravity","showBackground","disabled","style","onClick"]))),128))],4)}const le=fe(Xe,[["render",Ye],["__scopeId","data-v-448252ff"]]),Be={install:e=>{e.component("NaRadioGroup",le),e.component("qt-na-radio-group",le)}},et=a.defineComponent({name:"NaCheckboxGroup",props:{modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},direction:{type:String,default:"row"},itemWidth:{type:Number,default:void 0},itemHeight:{type:Number,default:void 0},itemGap:{type:Number,default:20},gravity:{type:String,default:"center"},showBackground:{type:Boolean,default:!0}},emits:["update:modelValue","change"],setup(e,{emit:r}){return{groupStyle:a.computed(()=>({display:"flex",flexDirection:e.direction,alignItems:"center"})),getItemStyle:(m,u)=>{var p;const c={...((p=m.props)==null?void 0:p.style)||{}};return e.itemWidth!==void 0&&(c.width=e.itemWidth),e.itemHeight!==void 0&&(c.height=e.itemHeight),u!==e.options.length-1&&(e.direction==="row"?c.marginRight=e.itemGap:c.marginBottom=e.itemGap),c},onItemClick:m=>{if(m.disabled)return;const u=[...e.modelValue],c=u.indexOf(m.value);c>-1?u.splice(c,1):u.push(m.value),r("update:modelValue",u),r("change",u)}}}});function tt(e,r,f,d,v,m){const u=a.resolveComponent("qt-na-checkbox");return a.openBlock(),a.createElementBlock("div",{class:"na-checkbox-group",style:a.normalizeStyle(e.groupStyle)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.options,(c,p)=>(a.openBlock(),a.createBlock(u,a.mergeProps({key:p,type:"checkbox",checked:e.modelValue.includes(c.value),text:c.label,gravity:e.gravity,showBackground:e.showBackground,disabled:c.disabled},{ref_for:!0},c.props,{style:e.getItemStyle(c,p),onClick:l=>e.onItemClick(c)}),null,16,["checked","text","gravity","showBackground","disabled","style","onClick"]))),128))],4)}const ie=fe(et,[["render",tt],["__scopeId","data-v-cf6a4eaa"]]),$e={install:e=>{e.component("NaCheckboxGroup",ie),e.component("qt-na-checkbox-group",ie)}},ot={inheritAttrs:!1},se=a.defineComponent({...ot,__name:"NaSwitcher",props:{checked:{type:Boolean},disabled:{type:Boolean},title:{},textOn:{},textOff:{},subtitle:{},subtitleColor:{},titleColor:{},focusTitleColor:{},titleTextSize:{},subtitleTextSize:{},stateTextSize:{}},emits:["onCheckedChange"],setup(e,{expose:r}){const f=a.ref(),d=q(),v="QtNaSwitcher",m=v+"_Plugin",c=(d.isPluginActive?m:v).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),p=_(c,d.pluginPackageName||"");return r({getNativeNode:()=>{var l,i;return((i=(l=f.value)==null?void 0:l.getNativeNode)==null?void 0:i.call(l))||f.value}}),(l,i)=>(a.openBlock(),a.createBlock(a.unref(p),a.mergeProps({ref_key:"nativeRef",ref:f,checked:e.checked,disabled:e.disabled,title:e.title||"",textOn:e.textOn||"",textOff:e.textOff||"",subtitle:e.subtitle||"",subtitleColor:e.subtitleColor||"",titleColor:e.titleColor||"",focusTitleColor:e.focusTitleColor||"",titleTextSize:e.titleTextSize,subtitleTextSize:e.subtitleTextSize,stateTextSize:e.stateTextSize,onOnCheckedChange:i[0]||(i[0]=g=>l.$emit("onCheckedChange",g.nativeEvent))},l.$attrs),{default:a.withCtx(()=>[a.renderSlot(l.$slots,"default")]),_:3},16,["checked","disabled","title","textOn","textOff","subtitle","subtitleColor","titleColor","focusTitleColor","titleTextSize","subtitleTextSize","stateTextSize"]))}});let ce;var Ne;try{const e=require("@extscreen/es3-vue");ce=e.registerElement||((Ne=e.default)==null?void 0:Ne.registerElement)}catch{}const Ge={install:e=>{if(!globalThis.__QtNaSwitcher_registered)if(ce){const r=(f,d)=>{ce(f,{component:{name:d?"QtNaSwitcher_Plugin":"QtNaSwitcher",processEventData(v,m){const u=v.handler||v,c=m||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=c),u}}})};r("qt-na-switcher",!1),r("qt-na-switcher-plugin",!0),r("QtNaSwitcher",!1),r("QtNaSwitcher_Plugin",!0),globalThis.__QtNaSwitcher_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtNaSwitcher")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");e.component("NaSwitcher",se),e.component("qt-na-switcher",se)}},nt=a.defineComponent({name:"NaSettingSwitch",props:{title:{type:String,default:""},subtitle:{type:String,default:""},modelValue:{type:Boolean,default:!1},textOn:{type:String,default:"打开"},textOff:{type:String,default:"关闭"},titleTextSize:{type:Number,default:28},subtitleTextSize:{type:Number,default:22},stateTextSize:{type:Number,default:24},disabled:{type:Boolean,default:!1},width:{type:[Number,String],default:800},height:{type:[Number,String],default:100}},emits:["update:modelValue","change"],setup(e,{emit:r,attrs:f}){const d=a.ref(e.modelValue);a.watch(()=>e.modelValue,c=>{d.value=c});const v=c=>{const p=c.checked;d.value=p,r("update:modelValue",p),r("change",p)},m=a.computed(()=>typeof e.width=="number"?`${e.width}px`:e.width),u=a.computed(()=>{const c=f.style||{},p=e.subtitle?(typeof e.height=="number"?e.height:parseInt(e.height))+30:e.height;return{width:m.value,height:typeof p=="number"?`${p}px`:p,...c}});return{checked:d,handleCheckedChange:v,mergedStyle:u}}});function at(e,r,f,d,v,m){const u=a.resolveComponent("qt-na-switcher");return a.openBlock(),a.createBlock(u,{class:"na-setting-switch",style:a.normalizeStyle(e.mergedStyle),title:e.title,subtitle:e.subtitle,checked:e.checked,textOn:e.textOn,textOff:e.textOff,titleTextSize:e.titleTextSize,subtitleTextSize:e.subtitleTextSize,stateTextSize:e.stateTextSize,disabled:e.disabled,onOnCheckedChange:e.handleCheckedChange},null,8,["style","title","subtitle","checked","textOn","textOff","titleTextSize","subtitleTextSize","stateTextSize","disabled","onOnCheckedChange"])}const ue=fe(nt,[["render",at]]),Oe={install(e){e.component("NaSettingSwitch",ue),e.component("qt-na-setting-switch",ue)}},_e={skipPluginCheck:!1},L=new Set;function _(e,r,f){return a.defineComponent({name:`${e}AsyncWrapper`,inheritAttrs:!1,props:{skipPluginCheck:{type:Boolean,default:!1}},setup(d,{slots:v,attrs:m,expose:u}){const c=a.ref("loading"),p=a.ref(""),l=a.ref(),i=globalThis.__VUE_INSTANCE__;u({getNativeNode:()=>{let k=l.value;return!k&&i&&i.vnode&&i.vnode.el&&(k=i.vnode.el,k.childNodes&&k.childNodes.length>0&&(k=k.childNodes[0])),k},nativeRef:l});let A=null,$=null;try{A=U.useES(),$=U.useESPlugin()}catch(k){console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",k)}const M=async()=>{if(!A||typeof A.isComponentRegistered!="function")return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"),!1;try{const k=await A.isComponentRegistered(e);if(console.log(`[withAsyncPlugin] isComponentRegistered('${e}') 返回:`,k),k===!0||k&&typeof k=="object"&&(k.registered===!0||k.isRegistered===!0))return!0;try{const P=await T.Native.callNativeWithPromise("ExtendModule","getCoreSDKInfo");if(P&&P.core_version){const S=P.core_version;console.log(`[withAsyncPlugin] 当前引擎核心版本: ${S}`);const E=S.split(".").map(w=>parseInt(w,10));if(E.length>=3&&!isNaN(E[0])&&!isNaN(E[1])&&!isNaN(E[2]))if(E[0]*1e6+E[1]*1e3+E[2]>=1011205){console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${e}`);const I=e.split("-").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join("");console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${e}, ${I}`);const[B,O]=await Promise.all([T.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",e).catch(()=>!1),T.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",I).catch(()=>!1)]);if(console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${B}, ${O}]`),B===!0||O===!0)return!0}else console.log(`[withAsyncPlugin] 引擎版本 ${S} < 1.11.205,跳过 ExtendModule 检查`);else console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${S}`)}}catch(P){console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",P)}return!1}catch(k){return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",k),!1}},R=async()=>{if(_e.skipPluginCheck||d.skipPluginCheck){console.log(`[withAsyncPlugin] 跳过 ${e} 插件检查 (skipPluginCheck = true)`),c.value="ready";return}if(!r){c.value="ready";return}const k=await M();if(console.log(`[withAsyncPlugin] 拦截检查 - ${e} 是否已注册:`,k),k||L.has(r)){c.value="ready",L.add(r),console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");return}if(!$){console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${e}`),c.value="ready";return}console.log(`[withAsyncPlugin] 开始动态安装插件: ${r}`);try{await new Promise((P,S)=>{let E;const w={onPluginInstallSuccess(I,B,O){I===r&&(clearTimeout(E),$.removeListener(w),console.log(`[withAsyncPlugin] 安装成功 pkg=${I} 状态码=${B}`),B==1003||B==1001?(f?(console.log(`[withAsyncPlugin] 触发反射初始化: ${f}`),T.Native.callNative("EsNativeModule","callReflect",{entry:{from:f,method:"setup"}})):console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),P()):S(new Error(`安装失败 pkg=${I} status=${B} msg=${O}`)))},onPluginInstallError(I,B,O){I===r&&(clearTimeout(E),$.removeListener(w),S(new Error(`安装失败 pkg=${I} status=${B} msg=${O}`)))}};$.addListener({pkg:r},w),E=setTimeout(()=>{$.removeListener(w),S(new Error(`插件安装超时: ${r}`))},8e3),typeof $.installPlugin=="function"?$.installPlugin({pkg:r}):typeof $.install=="function"?$.install(r):S(new Error("当前运行时不支持 install / installPlugin"))}),await a.nextTick(),L.add(r),c.value="ready"}catch(P){console.error("[withAsyncPlugin] 插件加载失败:",P),p.value=(P==null?void 0:P.message)||String(P),c.value="error"}};return a.onMounted(()=>{R()}),()=>{const k={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",...m.style||{}};m.width!==void 0&&!k.width&&(k.width=typeof m.width=="number"?`${m.width}px`:m.width),m.height!==void 0&&!k.height&&(k.height=typeof m.height=="number"?`${m.height}px`:m.height);const P=m.class?`qt-plugin-container ${m.class}`:"qt-plugin-container",S={class:P,style:k,clipChildren:!1,clipPadding:!1,clipToPadding:!1};if(c.value==="loading")return a.h("div",S,[a.h("div",{style:{color:"white",fontSize:"30px"}},"插件加载中...")]);if(c.value==="error")return a.h("div",S,[a.h("div",{style:{color:"white",fontSize:"30px",backgroundColor:"rgba(255,0,0,0.5)"}},`插件加载失败: ${p.value}`)]);const E={},w={};for(const[x,F]of Object.entries(m))if(x.startsWith("on")&&typeof F=="function"){let Q=x;x.startsWith("onOn")&&(Q="on"+x.slice(4)),w[Q]=F}else if(x.startsWith("on")&&Array.isArray(F)){let Q=x;x.startsWith("onOn")&&(Q="on"+x.slice(4)),w[Q]=F}else x.startsWith("onOn")||(E[x]=F);const I={...E,...w,class:P,style:k,ref:x=>{l.value=x}},B=I.tabsData||"",O=I.actionPayload||"";return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:",Object.keys(I),"tabsData.length=",B.length,"actionPayload.length=",O.length),a.h(e,I,v.default?v.default():[])}}})}const ge=Symbol("AddonEnvContext"),qe={isPluginActive:!1,nameSuffix:"",pluginPackageName:"com.quicktvui.plugin.glintui",builtInVersions:{}};async function rt(e="com.quicktvui.plugin.glintui",r="_Plugin"){const f=U.useES();let d={};try{const p=await T.Native.callNativeModule("AddonEnvModule","getBuiltInVersions",[]);p&&typeof p=="object"&&(d=p)}catch(p){console.warn("[AddonProvider] Failed to fetch built-in versions from AddonEnvModule",p)}const v=`QtGridTabs${r}`,m=f.isComponentRegistered(v),u=m instanceof Promise?await m:m,c={isPluginActive:u,nameSuffix:u?r:"",pluginPackageName:u?`${e}.ext`:e,builtInVersions:d};return console.info("[AddonProvider] Environment initialized:",c),c}let de=a.ref(qe);function lt(e){de.value=e,a.provide(ge,de)}function q(){var e;return((e=a.inject(ge,de))==null?void 0:e.value)||qe}async function Re(e){console.log("[AddonProvider] Sending GridTabs global config to Native:",e);try{const r=await T.Native.callNativeWithPromise("GridTabsConfigModule","setDefaultConfig",JSON.stringify(e));return console.log("[AddonProvider] Received response from Native:",r),!!(r&&r.success)}catch(r){return console.error("[AddonProvider] Failed to initialize GridTabs global config:",r),!1}}async function Fe(e){console.log("[AddonProvider] Sending ExtraUI global theme config to Native:",e);try{const r=await T.Native.callNativeWithPromise("ExtraUIConfigModule","setThemeConfig",JSON.stringify(e));return console.log("[AddonProvider] Received ExtraUI theme response from Native:",r),!!(r&&r.success)}catch(r){return console.error("[AddonProvider] Failed to initialize ExtraUI global theme config:",r),!1}}async function it(e){console.log("[AddonProvider] Initializing global theme across all modules:",e);const r=await Fe(e),f=await Re({themeConfig:{placeholderColor:e.placeholderColor,glowColor:e.glowColor||e.focusBackgroundColor,outerBorderColor:e.outerBorderColor||e.focusBorderColor,innerBorderColor:e.innerBorderColor,enableElevationShadow:e.enableElevationShadow,cornerRadius:e.cornerRadius,buttonCornerRadius:e.buttonCornerRadius,primaryTextColor:e.primaryTextColor,secondaryTextColor:e.secondaryTextColor,focusTextColor:e.focusTextColor,selectedTextColor:e.selectedTextColor,selectedBackgroundColor:e.selectedBackgroundColor,focusBackgroundColor:e.focusBackgroundColor,buttonNormalBackgroundColor:e.buttonNormalBackgroundColor}});return r&&f}const Qe={install:e=>{e.use(Pe),e.use(Te),e.use(Ie),e.use(Se),e.use(Ee),e.use(xe),e.use(Ae),e.use(we),e.use(Be),e.use($e),e.use(Ge),e.use(Oe)}};exports.ADDON_ENV_CONTEXT_KEY=ge;exports.GridTabs=z;exports.GridTabsPlugin=Pe;exports.HsvBackground=X;exports.HsvBackgroundPlugin=Ee;exports.Keyboard=j;exports.KeyboardPlugin=Te;exports.NaButton=oe;exports.NaButtonPlugin=Ae;exports.NaCheckbox=ae;exports.NaCheckboxGroup=ie;exports.NaCheckboxGroupPlugin=$e;exports.NaCheckboxPlugin=we;exports.NaRadioGroup=le;exports.NaRadioGroupPlugin=Be;exports.NaSettingSwitch=ue;exports.NaSettingSwitchPlugin=Oe;exports.NaSwitcher=se;exports.NaSwitcherPlugin=Ge;exports.PortalItem=J;exports.PortalItemPlugin=Se;exports.PortalPool=K;exports.PortalPoolPlugin=Ie;exports.QuickTVUINAddons=Qe;exports.QuickTVUINAddonsConfig=_e;exports.SvgImage=ee;exports.SvgImagePlugin=xe;exports.default=Qe;exports.initAddonEnv=rt;exports.initExtraUIGlobalTheme=Fe;exports.initGlobalTheme=it;exports.initGridTabsGlobalConfig=Re;exports.provideAddonEnv=lt;exports.useAddonEnv=q;exports.useGridTabs=ze;exports.withAsyncPlugin=_;