@balancy/bridge 1.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,143 @@
1
+ # Balancy WebView Bridge - TypeScript Package
2
+
3
+ This package contains the TypeScript implementation of the Balancy WebView Bridge, which has been migrated from a single JavaScript file to a modular TypeScript codebase.
4
+
5
+ ## Phase 1 Complete ✅
6
+
7
+ The initial setup and migration have been completed. Both the bridge file and styles file have been merged into a single TypeScript package:
8
+
9
+ - **Original files**: 40KB (bridge) + 24KB (styles) = **64KB total**
10
+ - **New build**: **31.91KB minified** (**50% size reduction**)
11
+ - **Single injection**: Instead of injecting 2 files, now you only inject 1
12
+ - **Auto-copy**: Build automatically copies to core package for SDK inclusion
13
+
14
+ ## Project Structure
15
+
16
+ ```
17
+ packages/bridge/
18
+ ├── dist/ # Build output
19
+ │ └── balancy-webview-bridge.js # Minified bundle
20
+ ├── src/
21
+ │ ├── index.ts # Main entry point
22
+ │ ├── types.ts # Type definitions
23
+ │ ├── constants.ts # Enums and constants
24
+ │ ├── messaging/ # Request/response handling
25
+ │ │ ├── BatchManager.ts
26
+ │ │ ├── messageHandler.ts
27
+ │ │ └── requestHandler.ts
28
+ │ ├── cache/ # Caching systems
29
+ │ │ ├── ImageCache.ts
30
+ │ │ └── LocalizationCache.ts
31
+ │ ├── api/ # API method groups
32
+ │ │ ├── profile.ts
33
+ │ │ ├── offers.ts
34
+ │ │ ├── tasks.ts
35
+ │ │ ├── inventory.ts
36
+ │ │ ├── battlepass.ts
37
+ │ │ └── events.ts
38
+ │ ├── ui/ # UI preparation methods
39
+ │ │ ├── localization.ts
40
+ │ │ ├── images.ts
41
+ │ │ ├── fonts.ts
42
+ │ │ ├── buttons.ts
43
+ │ │ └── dynamicText.ts
44
+ │ ├── styles/ # CSS & performance optimizations
45
+ │ │ └── gameUI.ts # Game UI styles & behaviors
46
+ │ ├── utils/ # Utility functions
47
+ │ │ ├── formatting.ts
48
+ │ │ ├── templates.ts
49
+ │ │ └── dom.ts
50
+ │ ├── components/ # Component system (Phase 2+)
51
+ │ ├── serialization/ # Serialization system (Phase 3+)
52
+ │ ├── managers/ # Managers (Phase 4+)
53
+ │ └── initialization.ts # Initialization flow
54
+ ├── scripts/
55
+ │ └── build.js # esbuild configuration
56
+ ├── package.json
57
+ ├── tsconfig.json
58
+ └── README.md
59
+ ```
60
+
61
+ ## Build Scripts
62
+
63
+ ### Install Dependencies
64
+ ```bash
65
+ cd packages/bridge
66
+ npm install
67
+ ```
68
+
69
+ ### Production Build
70
+ ```bash
71
+ npm run build
72
+ ```
73
+ Outputs minified bundle to `dist/balancy-webview-bridge.js`
74
+
75
+ ### Development Build
76
+ ```bash
77
+ npm run build:dev
78
+ ```
79
+ Outputs bundle with inline source maps for debugging
80
+
81
+ ### Watch Mode
82
+ ```bash
83
+ npm run watch
84
+ ```
85
+ Automatically rebuilds on file changes
86
+
87
+ ## Key Improvements
88
+
89
+ 1. **Modular Architecture**: Code is organized into logical modules by domain
90
+ 2. **Type Safety**: Full TypeScript typing with strict mode enabled
91
+ 3. **Better Minification**: 50% size reduction (64KB → 32KB)
92
+ - JavaScript minification via esbuild
93
+ - CSS minification in post-processing
94
+ 4. **Single File Bundle**: Combined bridge + styles into one file (no more dual injection)
95
+ 5. **Auto-copy to SDK**: Build automatically updates the core package file
96
+ 6. **Maintainability**: Easier to navigate and modify specific functionality
97
+ 7. **Build Pipeline**: Fast, modern build system with esbuild
98
+
99
+ ## Current Status
100
+
101
+ ✅ **Phase 1 Complete**: TypeScript setup and migration
102
+ - All existing functionality preserved (bridge + styles)
103
+ - Build pipeline operational with CSS minification
104
+ - Code organized into modules
105
+ - Single unified bundle (31.91KB - 50% reduction)
106
+ - Auto-copy to core package on build
107
+ - Ready for Phase 2 implementation
108
+
109
+ ## Next Steps
110
+
111
+ Phase 2 will implement the Unity-like component system:
112
+ - ElementBehaviour base class
113
+ - ElementObject wrapper
114
+ - Script registry
115
+ - GUID management
116
+ - And more...
117
+
118
+ ## Testing
119
+
120
+ Before proceeding to Phase 2, test the current build:
121
+
122
+ 1. The bundle is automatically built to:
123
+ - **Build output**: `packages/bridge/dist/balancy-webview-bridge.js`
124
+ - **Auto-copied to**: `packages/core/src/webview/resources/balancy-webview-bridge.js`
125
+ 2. Original files (now replaced):
126
+ - ~~`packages/core/src/webview/resources/balancy-webview-bridge.js`~~ (40KB)
127
+ - ~~`packages/core/src/webview/resources/balancy-webview-styles.js`~~ (24KB)
128
+ 3. The new bundle (31.91KB) automatically replaces the old bridge file on build
129
+ 4. You can now remove the styles file injection - everything is in one file
130
+ 5. Compare functionality to ensure identical behavior
131
+
132
+ ## Technical Notes
133
+
134
+ - **Target**: ES2020
135
+ - **Module Format**: IIFE (for browser global access)
136
+ - **Global**: `window.balancy`
137
+ - **Minifier**: esbuild (JavaScript) + custom CSS minifier
138
+ - **TypeScript**: Strict mode enabled
139
+ - **Build Features**:
140
+ - Automatic CSS minification in post-processing
141
+ - Auto-copy to core package on production builds
142
+ - Watch mode skips auto-copy (for development)
143
+ - Development builds skip CSS minification
@@ -0,0 +1,12 @@
1
+ // Balancy WebView Bridge
2
+ // Generated by esbuild
3
+
4
+ "use strict";var balancy=(()=>{var u={None:0,GetProfile:1,SetProfile:2,GetDocument:3,GetLocalization:10,GetImageUrl:11,GetInfo:12,CanBuyGroupOffer:13,GetFileLocation:14,GetPrefabContent:15,GetBattlePassProgress:20,GetCustomEventInfo:21,SetCustomEventInfo:22,GetTasksInfoForTheEvent:23,ActivateTasksForTheEvent:24,DeactivateTasksForTheEvent:25,ClaimTaskReward:26,GetCustomDocumentInfo:27,SetCustomDocumentInfo:28,StopEventManually:29,GetInventoryItemsCount:30,AddInventoryItems:31,RemoveInventoryItems:32,WatchRewardedAd:40,RestoreFailedTask:41,BuyOffer:101,BuyGroupOffer:102,BuyShopSlot:103,BattlePassClaim:104,CloseWindow:200,BalancyIsReady:201,BatchRequest:399,CustomMessage:1e3},x={Currency:1,Item:2,Event:4},pe={Hard:0,Soft:1,Ads:2},fe={None:0,InProgress:1,Completed:2,Claimed:3,Failed:4},T={None:0,OfferPrice:1,OfferGroupPrice:2,TimeLeft:3,OwnerLocalizedKey:4,OwnerCustom:5,CustomPrice:9,Custom:10},O={OnNewEventActivated:100,OnEventDeactivated:101,OnNewOfferActivated:102,OnOfferDeactivated:103,OnNewOfferGroupActivated:104,OnOfferGroupDeactivated:105,OnShopSlotWasPurchased:120,OnOfferWasPurchased:121,OnOfferGroupWasPurchased:122},ge={Available:0,Unavailable:1,Cooldown:2,Locked:3},ye={Default:0,ChainDeals:1,OnePurchase:2,OnceForEach:3},v={Plain:0,PlainSpaced:1,WithPrefix:2,WithPrefixSpaced:3,Shortened:4,ShortenedWithPrefix:5},C={Localized:0,Colon:1,LocalizedCompact:2},y={Auto:0,DaysHours:1,HoursMinutes:2,HoursMinutesSeconds:3,MinutesSeconds:4,Full:5};var D=class{constructor(){this.pendingBatch=new Map;this.batchTimeout=null;this.BATCH_DELAY=16}addToBatch(e,t,a,r,o,i,c,s){let l=e.toString(),d={type:"request",sender:t,id:l,action:a,params:r};return this.pendingBatch.set(l,{requestData:d,resolve:o,reject:i}),this.scheduleBatch(c,s),l}scheduleBatch(e,t){this.batchTimeout||(this.batchTimeout=setTimeout(()=>{this.sendBatch(e,t)},this.BATCH_DELAY))}sendBatch(e,t){if(this.pendingBatch.size===0){this.batchTimeout=null;return}let a=[];this.pendingBatch.forEach((o,i)=>{a.push(o.requestData),e[i]={resolve:o.resolve,reject:o.reject,timestamp:Date.now(),message:o.requestData}}),console.log(`[BatchManager] Sending batch with ${this.pendingBatch.size} requests`),t(JSON.stringify({type:"batch",requests:a})),this.pendingBatch.clear(),this.batchTimeout=null}getStats(){return{pendingCount:this.pendingBatch.size,isScheduled:this.batchTimeout!==null}}};function be(){return function(e){if(window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.BalancyWebView)return typeof e!="string"&&(e=JSON.stringify(e)),window.webkit.messageHandlers.BalancyWebView.postMessage(e),!0;if(typeof window.SendMessage=="function"){typeof e!="string"&&(e=JSON.stringify(e));try{return window.SendMessage("BalancyView","OnWebGLMessageReceived",e),!0}catch(t){return console.error("[postMessage] \u274C Error calling SendMessage:",t),!1}}return window.BalancyWebView&&window.BalancyWebView.sendMessageToUnity?(typeof e!="string"&&(e=JSON.stringify(e)),window.BalancyWebView.sendMessageToUnity(e),!0):window.parent&&window.parent!==window&&window.parent.postMessage?(window.parent.postMessage(e,"*"),!0):(console.warn("BalancyWebView: No message handler available for platform"),window.BalancyWebView&&window.BalancyWebView.log&&window.BalancyWebView.log("warn","No message handler available for platform"),!1)}}function he(n){return function(t){window.BalancyWebView&&window.BalancyWebView.log?window.BalancyWebView.log("info","Received message from Unity: "+t.substring(0,100)+"..."):console.log("BalancyWebView: Received message from Unity:",t.substring(0,100)+"..."),n(t)}}function we(n,e,t){return function(r){try{let o=JSON.parse(r);if(o.type==="response"){let i=n[o.id];i&&(o.error?i.reject(new Error(o.error+" : "+JSON.stringify(i.message))):i.resolve(o.result),delete n[o.id])}else if(o.type==="batch-response")o.responses&&Array.isArray(o.responses)&&o.responses.forEach(i=>{let c=n[i.id];c&&(i.error?c.reject(new Error(i.error+" : "+JSON.stringify(c.message))):c.resolve(i.result),delete n[i.id])});else if(o.type==="notification"){let i=o.data?JSON.parse(o.data):null;e(i)}else o.type==="custom-message"&&t(o.data)}catch(o){console.error("Error handling response:",o)}}}function ve(n,e,t,a){return function(o,i,c={}){return new Promise((s,l)=>{let d=n().toString();e();let m={type:"request",sender:o,id:d,action:i,params:c};t[d]={resolve:s,reject:l,timestamp:Date.now(),message:m},a(JSON.stringify(m))})}}function Ee(n,e,t,a,r,o){return function(c,s,l={}){return[u.BuyOffer,u.BuyGroupOffer,u.BuyShopSlot,u.BattlePassClaim,u.CloseWindow,u.CustomMessage,u.BalancyIsReady,u.StopEventManually,u.WatchRewardedAd].includes(s)?e(c,s,l):new Promise((m,p)=>{let g=n.addToBatch(t(),c,s,l,m,p,r,o);a()})}}var $=class{constructor(){this.cache={};this.pendingRequests={}}async get(e,t,a){if(this.cache[e]!==void 0)return this.cache[e];if(this.pendingRequests[e])return this.pendingRequests[e];let r=t(null,a,{id:e}).then(o=>(this.cache[e]=o,delete this.pendingRequests[e],o)).catch(o=>{throw delete this.pendingRequests[e],o});return this.pendingRequests[e]=r,r}};var N=class{constructor(){this.cache={};this.pendingRequests={}}async get(e,t,a){if(this.cache[e]!==void 0)return this.cache[e];if(this.pendingRequests[e])return this.pendingRequests[e];let r=t(null,a,{key:e}).then(o=>(this.cache[e]=o,delete this.pendingRequests[e],o)).catch(o=>{throw delete this.pendingRequests[e],o});return this.pendingRequests[e]=r,r}getCached(e){return this.cache[e]??null}};var G=class{constructor(){this.cache={};this.pendingRequests={}}async get(e,t,a){if(this.cache[e]!==void 0)return this.cache[e];if(this.pendingRequests[e])return this.pendingRequests[e];let r=t(null,a,{id:e}).then(o=>(this.cache[e]=o,delete this.pendingRequests[e],o)).catch(o=>{throw delete this.pendingRequests[e],o});return this.pendingRequests[e]=r,r}};var F=class{constructor(){this.cache={};this.pendingRequests={}}async get(e,t,a){if(this.cache[e]!==void 0)return this.cache[e];if(this.pendingRequests[e])return this.pendingRequests[e];let r=t(null,a,{id:e}).then(o=>(this.cache[e]=o,delete this.pendingRequests[e],o)).catch(o=>{throw delete this.pendingRequests[e],o});return this.pendingRequests[e]=r,r}};function Pe(n){return{getProfileValue(e,t){return n(null,u.GetProfile,{profile:e,path:t})},getSystemProfileValue(e){return n(null,u.GetProfile,{profile:"UnnyProfile",path:e})},getDocumentValue(e,t){return n(null,u.GetDocument,{id:e,depth:t}).then(a=>JSON.parse(a))}}}function Te(n,e,t){return{async getActiveOffers(a=3){let r=await e("SmartInfo.GameOffers");if(!Array.isArray(r)||r.length===0)return r||[];let o=[];for(let l of r)o.includes(l.unnyIdGameOffer)||o.push(l.unnyIdGameOffer);let i=o.map(l=>t(l,a)),c=await Promise.all(i),s={};for(let l=0;l<o.length;l++)s[o[l]]=c[l];for(let l of r){let d=l?.unnyIdGameOffer;d!=null&&s.hasOwnProperty(d)&&(l.gameOffer=s[d])}return r},async getActiveGroupOffers(a=3){let r=await e("SmartInfo.GameOfferGroups");if(!Array.isArray(r)||r.length===0)return r||[];let o=[];for(let l of r)o.includes(l.unnyIdGameOfferGroup)||o.push(l.unnyIdGameOfferGroup);let i=o.map(l=>t(l,a)),c=await Promise.all(i),s={};for(let l=0;l<o.length;l++)s[o[l]]=c[l];for(let l of r){let d=l?.unnyIdGameOfferGroup;d!=null&&s.hasOwnProperty(d)&&(l.gameOfferGroup=s[d])}return r},canBuyGroupOffer(a){return n(null,u.CanBuyGroupOffer,{instanceId:window.balancyViewOwner.instanceId,index:a})},buyGroupOffer(a,r={}){return!window.balancyViewOwner||!window.balancyViewOwner.instanceId?Promise.resolve(null):(r||(r={}),r.instanceId=window.balancyViewOwner.instanceId,r.index=a,n("buyGroupOfferButton",u.BuyGroupOffer,r))},buyOffer(a={}){return!window.balancyViewOwner||!window.balancyViewOwner.instanceId?Promise.resolve(null):(a||(a={}),a.instanceId=window.balancyViewOwner.instanceId,n("buyOfferButton",u.BuyOffer,a))},buyShopSlot(a,r={}){return r||(r={}),a?.unnyIdSlot&&(r.slotId=a.unnyIdSlot),n("buyShopSlotButton",u.BuyShopSlot,r)}}}function Me(n){return{getTasks(){return n(null,u.GetTasksInfoForTheEvent,{id:window.balancyViewOwner.unnyIdGameEvent}).then(e=>JSON.parse(e))},activateTasks(e){return n(null,u.ActivateTasksForTheEvent,{id:window.balancyViewOwner.unnyIdGameEvent,tasks:e}).then(t=>JSON.parse(t))},deactivateTasks(e){return n(null,u.DeactivateTasksForTheEvent,{id:window.balancyViewOwner.unnyIdGameEvent,tasks:e})},restoreFailedTask(e){return n(null,u.RestoreFailedTask,{id:e?e.unnyIdTask:""})},claimTaskReward(e){return n(null,u.ClaimTaskReward,{id:e}).then(t=>t&&t==="ok")}}}function Se(n){return{getInventoryItemsCount(e){return n(null,u.GetInventoryItemsCount,{id:e})},addInventoryItems(e,t){return n(null,u.AddInventoryItems,{id:e,count:t})},removeInventoryItems(e,t){return n(null,u.RemoveInventoryItems,{id:e,count:t})}}}function Ie(n,e){return{getBattlePassConfig(){return e(window.balancyViewOwner.unnyIdGameEvent,3).then(t=>t.config)},getBattlePassProgress(){return n(null,u.GetBattlePassProgress,{id:window.balancyViewOwner.unnyIdGameEvent}).then(t=>JSON.parse(t))},claimBattlePassReward(t,a){return n(null,u.BattlePassClaim,{id:window.balancyViewOwner.unnyIdGameEvent,lineId:t,index:a}).then(r=>r&&r==="ok")}}}function Ae(n){return{getCustomEventInfo(){return n(null,u.GetCustomEventInfo,{id:window.balancyViewOwner.instanceId}).then(e=>e?JSON.parse(e):{})},setCustomEventInfo(e){let t=JSON.stringify(e);return n(null,u.SetCustomEventInfo,{id:window.balancyViewOwner.instanceId,data:t})},stopEventManually(e=-1){return n(null,u.StopEventManually,{id:window.balancyViewOwner.unnyIdGameEvent,cooldown:e}).then(t=>t)},watchRewardedAd(e){return n(null,u.WatchRewardedAd,{}).then(t=>{e(!!t.success)})},getProductInfo(e){return n("offerGroupPrice",u.GetInfo,{type:T.CustomPrice,productId:e})},closeView(e){return n(null,u.CloseWindow,{id:e})},sendCustomMessage(e,t){return n(e,u.CustomMessage,t)}}}function Le(n){return{async setLocalizedText(e,t){if(t){let a=await n(t);e.textContent=a}e.classList.add("balancy-text-prepared")},async localizeAllElements(e=document){let t=e.querySelectorAll('[data-text-type="localized"]'),a=Array.from(t).map(async r=>{if(r.classList.contains("balancy-text-prepared"))return;let o=r.getAttribute("data-localization-key");await this.setLocalizedText(r,o)});await Promise.all(a),e===document&&document.dispatchEvent(new CustomEvent("balancy-localization-complete"))}}}function Oe(n){async function e(t,a){t.classList.add("balancy-image-prepared");let r=await n(a);r&&(t.tagName==="IMG"?t.src=r:t.hasAttribute("data-use-nineslice")&&t.getAttribute("data-use-nineslice")==="false"?t.style.backgroundImage=`url('${r}')`:t.style.borderImageSource=`url('${r}')`)}return{setImage(t,a){a?.id&&(t.setAttribute("data-image-id",a.id),e(t,a.id))},async prepareAllSprites(t=document){let a=t.querySelectorAll("[data-image-id]"),r=Array.from(a).map(async o=>{if(o.classList.contains("balancy-image-prepared"))return;let i=o.getAttribute("data-image-id");i&&await e(o,i)});await Promise.all(r),t===document&&document.dispatchEvent(new CustomEvent("balancy-images-complete"))}}}function Ce(n,e){return{async prepareAllFonts(t=document){let a=t.querySelectorAll("[data-font-id]"),r=Array.from(a).map(async o=>{if(o.classList.contains("balancy-font-prepared"))return;let i=o.getAttribute("data-font-name"),c=o.getAttribute("data-font-id");if(i&&c){let s=await n(c);e(i,s)}});await Promise.all(r),t===document&&document.dispatchEvent(new CustomEvent("balancy-fonts-complete"))}}}function Be(n,e,t){function a(i){let c=i.getAttribute("data-button-action");if(!c)return;switch(parseInt(c,10)){case u.BuyGroupOffer:let l=parseInt(i.getAttribute("data-index")||"0",10)||0;e(l).then(d=>{i.disabled=!d});break}}async function r(i){let c=i.getAttribute("data-button-audio-id");if(!c)return;let s=await t(c);if(!s)return;let l=document.createElement("audio");l.autoplay=!0,l.src=s,l.addEventListener("ended",()=>{l.remove()}),l.addEventListener("error",()=>{l.remove()}),document.body.appendChild(l)}function o(i,c){let s=c?.action??i.getAttribute("data-button-action");if(!s){console.warn("Button missing data-button-action attribute",i);return}let l=parseInt(s,10);if(isNaN(l)||l===u.None){console.warn("Invalid action ID:",s,i);return}let d=i.id||"unknown-button",m=i.getAttribute("data-button-params"),p={};if(m&&m.trim()!=="")try{p=JSON.parse(m)}catch(b){console.error("Error parsing button params JSON:",b,"Raw params:",m),i.dispatchEvent(new CustomEvent("balancyButtonError",{detail:{actionId:l,error:"Invalid JSON in data-button-params",paramsAttr:m}})),p={}}switch(l){case u.BuyOffer:p.instanceId=c?.instanceId??window.balancyViewOwner.instanceId;break;case u.BuyGroupOffer:p.instanceId=window.balancyViewOwner.instanceId,p.index=parseInt(i.getAttribute("data-index")||"0",10)||0;break;case u.BuyShopSlot:p.slotId=i.getAttribute("data-index")||0;break}let g=i.disabled;i.disabled=!0,i.classList.add("balancy-button-processing"),n(d,l,p).then(b=>{console.log(`Button action ${l} executed successfully`,b),i.dispatchEvent(new CustomEvent("balancyButtonResponse",{detail:{actionId:l,result:b,success:!0,senderId:d}}))}).catch(b=>{console.error(`Error executing button action ${l}:`,b),i.dispatchEvent(new CustomEvent("balancyButtonResponse",{detail:{actionId:l,error:b.message,success:!1,senderId:d}}))}).finally(()=>{i.disabled=g,i.classList.remove("balancy-button-processing")})}return{balancyButtonClicked:o,prepareAllButtons(i=document){let c=i.querySelectorAll("[data-button-action]"),s=i.querySelectorAll("[data-button-audio-id]"),l=[...Array.from(c),...Array.from(s)],d=0;l.forEach(m=>{m.classList.contains("balancy-button-prepared")||(m._balancyClickHandler&&m.removeEventListener("click",m._balancyClickHandler),m._balancyClickHandler=function(p){p.preventDefault(),p.stopPropagation(),m.hasAttribute("data-button-action")&&o(m),m.hasAttribute("data-button-audio-id")&&r(m)},a(m),m.addEventListener("click",m._balancyClickHandler),m.classList.add("balancy-button-prepared"),d++)}),i===document&&document.dispatchEvent(new CustomEvent("balancy-buttons-complete",{detail:{preparedCount:d,totalFound:l.length}}))}}}function xe(n,e,t,a,r){return{prepareAllTexts(o=document){let i=o.querySelectorAll('[data-text-type="dynamic"]'),c=[];i.forEach(s=>{if(s.classList.contains("balancy-text-prepared"))return;s.classList.add("balancy-text-prepared");let l=s.id||"unknown-text",d=parseInt(s.getAttribute("data-info-type")||"0",10)||0,m=parseInt(s.getAttribute("data-index")||"0",10)||0,p=s.getAttribute("data-custom")||"",g=s.getAttribute("data-product-id")||"",b="";if(d===T.OfferPrice?(g=window.balancyViewOwner.productId,d=T.CustomPrice):d===T.OfferGroupPrice&&(b=window.balancyViewOwner.instanceId),d===T.TimeLeft){let w=function(){P.textContent=t(a())};var L=w;let P=s;setInterval(w,1e3),w();return}if(d===T.OwnerCustom){let P=s.getAttribute("data-text-format");P&&e(P,window.balancyViewOwner).then(w=>{s.textContent=w});return}if(d===T.OwnerLocalizedKey){let P=s.getAttribute("data-text-format");P&&e(P,window.balancyViewOwner).then(w=>r(s,w));return}let H=n(l,u.GetInfo,{type:d,productId:g,index:m,instanceId:b,custom:p}).then(P=>{try{let w=s.getAttribute("data-text-format");w&&e(w,P).then(me=>{s.textContent=me})}catch(w){console.error("Error formatting text:",w,"Result:",P)}});c.push(H)}),Promise.all(c).then(()=>{o===document&&document.dispatchEvent(new CustomEvent("balancy-text-complete"))})}}}function W(n){return n>=1e9?`${parseFloat((n/1e9).toFixed(1))}B`:n>=1e6?`${parseFloat((n/1e6).toFixed(1))}M`:n>=1e3?`${parseFloat((n/1e3).toFixed(1))}k`:n.toString()}function j(n){if(n&&!n.hasOwnProperty("unnyIdComponents"))return console.error("Item has no components, probably you need to increase depth when fetching item data: ",n),!1;let e=n?.components;if(!e)return!1;for(let t of e)if(t.$type==="SmartObjects.ItemComponent.Decay")return!0;return!1}function De(n){let e=n?.components;if(!e)return null;for(let t of e)if(t.$type==="SmartObjects.ItemComponent.Bundle")return t.reward;return null}function $e(n,e=!1){let t=j(n.item),a=n.item.type===x.Currency,r;if(t){let o=n.count,i=Math.floor(o/3600),c=Math.floor(o%3600/60);r=`${i>0?`${i}h `:""}${c>0?`${c}m`:""}`}else{let o=e?W(n.count):n.count.toString();r=a?`${n.count}`:`x${o}`}return{text:r,isDuration:t,isCurrency:a}}function Y(n){if(n>3600*24*365)return"oo";if(window.customFormatTime)return window.customFormatTime(n);let e=Math.floor(n/86400),t=Math.floor(n%86400/3600),a=Math.floor(n%3600/60),r=n%60;return e>0?t>0?`${e}d ${t}h`:`${e}d`:`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function Ne(n,...e){return n.replace(/{(\d+)}/g,(t,a)=>e[a]!==void 0?e[a]:t)}function _(){let e=Math.floor(Date.now()/1e3)-window.balancySettings.launchTime;return window.balancySettings.secondsLeft-e}var Ge=["BALANCY/TIME_DAY","BALANCY/TIME_HOUR","BALANCY/TIME_MINUTE","BALANCY/TIME_SECOND","BALANCY/NUMBER_THOUSAND","BALANCY/NUMBER_MILLION","BALANCY/NUMBER_BILLION"],f={};function Fe(n){f={day:n("BALANCY/TIME_DAY")||"d",hour:n("BALANCY/TIME_HOUR")||"h",minute:n("BALANCY/TIME_MINUTE")||"m",second:n("BALANCY/TIME_SECOND")||"s",thousand:n("BALANCY/NUMBER_THOUSAND")||"k",million:n("BALANCY/NUMBER_MILLION")||"M",billion:n("BALANCY/NUMBER_BILLION")||"B"}}function ke(n){return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g," ")}function Re(n){return n>=1e9?`${parseFloat((n/1e9).toFixed(1))}${f.billion||"B"}`:n>=1e6?`${parseFloat((n/1e6).toFixed(1))}${f.million||"M"}`:n>=1e3?`${parseFloat((n/1e3).toFixed(1))}${f.thousand||"k"}`:n.toString()}function pt(n,e){switch(e){case v.Plain:return n.toString();case v.PlainSpaced:return ke(n);case v.WithPrefix:return`x${n}`;case v.WithPrefixSpaced:return`x${ke(n)}`;case v.Shortened:return Re(n);case v.ShortenedWithPrefix:return`x${Re(n)}`;default:return n.toString()}}function ft(n,e){let t=Math.floor(n/86400),a=Math.floor(n%86400/3600),r=Math.floor(n%3600/60),o=n%60;switch(e){case y.DaysHours:return t>0?`${t}:${a.toString().padStart(2,"0")}`:`${a}:00`;case y.HoursMinutes:return`${a}:${r.toString().padStart(2,"0")}`;case y.HoursMinutesSeconds:return`${a}:${r.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`;case y.MinutesSeconds:return`${r}:${o.toString().padStart(2,"0")}`;case y.Full:return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`;case y.Auto:default:return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`}}function He(n,e,t){let a=Math.floor(n/86400),r=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),i=n%60,c=[],s=(l,d)=>{t?l>0&&c.push(`${l}${d}`):c.push(`${l}${d}`)};switch(e){case y.DaysHours:s(a,f.day||"d"),s(r,f.hour||"h");break;case y.HoursMinutes:s(r,f.hour||"h"),s(o,f.minute||"m");break;case y.HoursMinutesSeconds:s(r,f.hour||"h"),s(o,f.minute||"m"),s(i,f.second||"s");break;case y.MinutesSeconds:s(o,f.minute||"m"),s(i,f.second||"s");break;case y.Full:s(a,f.day||"d"),s(r,f.hour||"h"),s(o,f.minute||"m"),s(i,f.second||"s");break;case y.Auto:default:a>0?(s(a,f.day||"d"),s(r,f.hour||"h")):r>0?(s(r,f.hour||"h"),s(o,f.minute||"m")):(s(o,f.minute||"m"),(!t||i>0)&&s(i,f.second||"s"));break}return c.join(" ")}function je(n,e={}){let t=e.currencyFormat??v.Plain,a=e.regularItemFormat??v.WithPrefix,r=e.timeFormat??C.LocalizedCompact,o=e.timePrecision??y.Auto,i=j(n.item),c=n.item.type===x.Currency,s;if(i){let l=n.count;r===C.Colon?s=ft(l,o):r===C.Localized?s=He(l,o,!1):s=He(l,o,!0)}else{let l=c?t:a;s=pt(n.count,l)}return{text:s,isDuration:i,isCurrency:c}}function ze(n){function e(a){return a.charAt(0).toUpperCase()+a.slice(1)}async function t(a,r){let o=r.split("."),i=a;for(let c=0;c<o.length;c++){let s=o[c].trim();if(i&&i[s]!==void 0&&i[s]!==null)i=i[s];else{let l="unnyId"+e(s);if(i&&i[l]!==void 0)try{let d=await n(i[l],0);if(c+1<o.length){let m=o.slice(c+1).join(".");return await t(d,m)}else return d}catch(d){console.error(`Failed to get document for ID ${i[l]}:`,d);return}return}}return i}return async function(r,o){if(!r.includes("{")||!r.includes("}"))return r;let i=[],c=/\{([^}]+)\}/g,s;for(;(s=c.exec(r))!==null;)i.push({fullMatch:s[0],path:s[1].trim(),index:s.index});if(i.length===0)return r;let l=i.map(async p=>{let g=await t(o,p.path);return{placeholder:p.fullMatch,value:g!==void 0?String(g):p.fullMatch}}),d=await Promise.all(l),m=r;for(let p of d)m=m.replace(p.placeholder,p.value);return m}}function J(n,e){let t=document.createElement("style");t.type="text/css",t.textContent=`
5
+ @font-face {
6
+ font-family: '${n}';
7
+ src: url('${e}') format('truetype');
8
+ }
9
+ `,document.head.appendChild(t)}function Ue(n,e){let t=(e??document).querySelector(`[data-id=${n}]`);return t instanceof HTMLElement?t:null}function qe(n){return function(t){if(!(!t||typeof t!="object")){switch(console.log(">>>notificationReceived ",t),t.type){case O.OnOfferDeactivated:case O.OnOfferGroupDeactivated:break;case O.OnOfferGroupWasPurchased:n();break}window.dispatchEvent(new CustomEvent("balancy-notification",{detail:t}))}}}function Ve(){let n=[];return{subscribeToCustomMessages(e){return typeof e!="function"?(console.error("subscribeToCustomMessages: callback must be a function"),()=>{}):(n.push(e),function(){let a=n.indexOf(e);a>-1&&n.splice(a,1)})},dispatchCustomMessage(e){n.forEach(t=>{try{t(e)}catch(a){console.error("Error in custom message subscriber:",a)}}),window.dispatchEvent(new CustomEvent("balancy-custom-message",{detail:e}))}}}function We(n,e,t,a,r){window.addEventListener("message",function(o){if(o.source!==window.parent||o.source===window)return;let i=o.data;i&&typeof i=="object"&&i.payload&&n(i.payload)}),function(){let i=new Set(["balancy-buttons-complete","balancy-localization-complete","balancy-text-complete","balancy-images-complete","balancy-fonts-complete","balancy-components-complete","balancy-audio-complete"]),c=new Set;function s(l){c.add(l.type),[...i].every(d=>c.has(d))&&(console.log("ALL IS READY"),window.dispatchEvent(new CustomEvent("balancy-ready")),a||t())}i.forEach(l=>{document.addEventListener(l,s,{once:!0})})}(),(async()=>(r&&await r(),await e()))()}function gt(n){if(!n||n===document.body||n===document.documentElement)return!1;let e=window.getComputedStyle(n),t=e.overflow||e.overflowY||e.overflowX;return t==="auto"||t==="scroll"||n.classList.contains("scrollable")||n.classList.contains("scroll-container")||n.classList.contains("overflow-auto")||n.classList.contains("overflow-scroll")||n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth}function Ye(n){let e=n;for(;e&&e!==document.body&&e!==document.documentElement;){if(gt(e))return e;e=e.parentElement}return null}function yt(){if(document.getElementById("balancy-game-ui-styles"))return;let n=document.createElement("style");n.id="balancy-game-ui-styles",n.textContent=`*{-webkit-user-select:none !important;-moz-user-select:none !important;-ms-user-select:none !important;user-select:none !important;-webkit-touch-callout:none !important;-webkit-context-menu:none !important;outline:none !important;-webkit-user-drag:none !important;user-drag:none !important}body,div,span,p,h1,h2,h3,h4,h5,h6,a,button{cursor:default !important}img{-webkit-user-drag:none !important;user-drag:none !important;pointer-events:none !important;-webkit-touch-callout:none !important}input,textarea{-webkit-autocorrect:off !important;-webkit-autocapitalize:off !important;autocomplete:off !important;spellcheck:false !important;font-size:16px !important;-webkit-appearance:none !important;-moz-appearance:none !important;appearance:none !important}body{-webkit-tap-highlight-color:transparent !important;overscroll-behavior:none !important;overscroll-behavior-x:none !important;overscroll-behavior-y:none !important;-webkit-text-size-adjust:100% !important;-ms-text-size-adjust:100% !important;text-size-adjust:100% !important;touch-action:manipulation !important;-webkit-overflow-scrolling:auto !important;-webkit-user-drag:none !important;-ms-content-zooming:none !important;-ms-touch-action:manipulation !important;position:fixed !important;top:0 !important;left:0 !important;width:100% !important;height:100% !important;overflow:hidden !important}html{position:fixed !important;top:0 !important;left:0 !important;width:100% !important;height:100% !important;overflow:hidden !important;-ms-touch-action:manipulation !important;touch-action:manipulation !important;scrollbar-width:none !important;-ms-overflow-style:none !important}::-webkit-scrollbar{width:0px !important;height:0px !important;display:none !important;background:transparent !important}::-webkit-scrollbar-track{display:none !important}::-webkit-scrollbar-thumb{display:none !important}[style*="overflow:auto"],[style*="overflow:scroll"],[style*="overflow-y:auto"],[style*="overflow-y:scroll"],[style*="overflow-x:auto"],[style*="overflow-x:scroll"],.scrollable,.scroll-container,.overflow-auto,.overflow-scroll{-webkit-overflow-scrolling:touch !important;touch-action:pan-y !important;overscroll-behavior:contain !important}@supports (-webkit-touch-callout:none){body{-webkit-overflow-scrolling:auto !important;-webkit-touch-callout:none !important;-webkit-user-select:none !important}input,textarea,select{font-size:16px !important;transform:translateZ(0) !important}html{-webkit-text-size-adjust:100% !important}[style*="overflow:auto"],[style*="overflow:scroll"],[style*="overflow-y:auto"],[style*="overflow-y:scroll"],.scrollable,.scroll-container,.overflow-auto,.overflow-scroll{-webkit-overflow-scrolling:touch !important;touch-action:pan-y !important;overscroll-behavior:contain !important}}@media screen and (-webkit-device-pixel-ratio:1),screen and (-webkit-device-pixel-ratio:1.5),screen and (-webkit-device-pixel-ratio:2),screen and (-webkit-device-pixel-ratio:3){body{overscroll-behavior-y:none !important;-webkit-overflow-scrolling:auto !important}input,textarea{font-size:16px !important;-webkit-appearance:none !important}}@media (hover:hover) and (pointer:fine){body{overflow-x:hidden !important;-ms-overflow-style:none !important}*{-webkit-context-menu:none !important;context-menu:none !important}}.unity-webgl-canvas{body{margin:0 !important;padding:0 !important;overflow:hidden !important}}button,input[type="button"],input[type="submit"],input[type="reset"],.btn,[role="button"]{-webkit-transition-duration:0.1s !important;transition-duration:0.1s !important;-webkit-transition-property:transform,-webkit-transform !important;transition-property:transform,-webkit-transform !important;-webkit-transition-timing-function:ease-out !important;transition-timing-function:ease-out !important;transform:scale(1) !important;-webkit-transform:scale(1) !important;transform-origin:center center !important;-webkit-transform-origin:center center !important;will-change:transform !important}button:active,input[type="button"]:active,input[type="submit"]:active,input[type="reset"]:active,.btn:active,[role="button"]:active{transform:scale(0.95) !important;-webkit-transform:scale(0.95) !important;-webkit-transition-duration:0.05s !important;transition-duration:0.05s !important}button:not(:active),input[type="button"]:not(:active),input[type="submit"]:not(:active),input[type="reset"]:not(:active),.btn:not(:active),[role="button"]:not(:active){transform:scale(1) !important;-webkit-transform:scale(1) !important;-webkit-transition-duration:0.1s !important;transition-duration:0.1s !important}a[role="button"],div[role="button"],span[role="button"],.button,.ui-button,.clickable{-webkit-transition-duration:0.1s !important;transition-duration:0.1s !important;-webkit-transition-property:transform,-webkit-transform !important;transition-property:transform,-webkit-transform !important;-webkit-transition-timing-function:ease-out !important;transition-timing-function:ease-out !important;transform:scale(1) !important;-webkit-transform:scale(1) !important;transform-origin:center center !important;-webkit-transform-origin:center center !important;will-change:transform !important}a[role="button"]:active,div[role="button"]:active,span[role="button"]:active,.button:active,.ui-button:active,.clickable:active{transform:scale(0.95) !important;-webkit-transform:scale(0.95) !important;-webkit-transition-duration:0.05s !important;transition-duration:0.05s !important}button:disabled,input[type="button"]:disabled,input[type="submit"]:disabled,input[type="reset"]:disabled,.btn:disabled,.btn.disabled,[role="button"][disabled],[role="button"].disabled,[role="button"][aria-disabled="true"],a[role="button"].disabled,a[aria-disabled="true"],div[role="button"].disabled,div[aria-disabled="true"],span[role="button"].disabled,span[aria-disabled="true"],.button:disabled,.button.disabled,.ui-button:disabled,.ui-button.disabled,.clickable:disabled,.clickable.disabled,.balancy-button-processing{opacity:0.5 !important;filter:grayscale(0.7) !important;cursor:not-allowed !important;pointer-events:none !important;transform:scale(1) !important;-webkit-transform:scale(1) !important;-webkit-transition:none !important;transition:none !important;box-shadow:none !important;-webkit-box-shadow:none !important}button:disabled:active,input[type="button"]:disabled:active,input[type="submit"]:disabled:active,input[type="reset"]:disabled:active,.btn:disabled:active,.btn.disabled:active,[role="button"][disabled]:active,[role="button"].disabled:active,[role="button"][aria-disabled="true"]:active,a[role="button"].disabled:active,a[aria-disabled="true"]:active,div[role="button"].disabled:active,div[aria-disabled="true"]:active,span[role="button"].disabled:active,span[aria-disabled="true"]:active,.button:disabled:active,.button.disabled:active,.ui-button:disabled:active,.ui-button.disabled:active,.clickable:disabled:active,.clickable.disabled:active,.balancy-button-processing:active{transform:scale(1) !important;-webkit-transform:scale(1) !important;-webkit-transition:none !important;transition:none !important;opacity:0.5 !important;pointer-events:none !important}.balancy-button-processing{position:relative !important}.balancy-button-processing::after{content:'' !important;position:absolute !important;top:50% !important;left:50% !important;width:16px !important;height:16px !important;margin:-8px 0 0 -8px !important;border:2px solid transparent !important;border-top:2px solid currentColor !important;border-radius:50% !important;animation:balancy-spin 1s linear infinite !important;-webkit-animation:balancy-spin 1s linear infinite !important}@keyframes balancy-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@-webkit-keyframes balancy-spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}*:focus{outline:none !important;-webkit-tap-highlight-color:transparent !important}::selection{background:transparent !important}::-moz-selection{background:transparent !important}html{-ms-touch-action:manipulation !important;touch-action:manipulation !important}input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 1000px transparent inset !important;-webkit-text-fill-color:inherit !important}`,(document.head||document.documentElement).appendChild(n),console.log("[BalancyWebView] Game UI styles injected successfully")}function bt(){if(document.addEventListener("contextmenu",function(n){return n.preventDefault(),n.stopPropagation(),!1},{passive:!1,capture:!0}),document.addEventListener("selectstart",function(n){return n.preventDefault(),n.stopPropagation(),!1},{passive:!1,capture:!0}),document.addEventListener("dragstart",function(n){return n.preventDefault(),n.stopPropagation(),!1},{passive:!1,capture:!0}),/iPad|iPhone|iPod/.test(navigator.userAgent)){console.log("[BalancyWebView] Applying iOS-specific optimizations"),document.addEventListener("touchmove",function(e){["INPUT","TEXTAREA"].includes(e.target.tagName)||Ye(e.target)||e.preventDefault()},{passive:!1});let n=0;document.addEventListener("touchend",function(e){let t=Date.now();t-n<=300&&e.preventDefault(),n=t},{passive:!1}),document.addEventListener("touchstart",function(e){e.target.style.webkitTouchCallout="none"},{passive:!0})}if(/Android/.test(navigator.userAgent)){console.log("[BalancyWebView] Applying Android-specific optimizations"),document.addEventListener("touchstart",function(e){(e.touches[0].clientX<20||e.touches[0].clientX>window.innerWidth-20||e.touches[0].clientY<20||e.touches[0].clientY>window.innerHeight-20)&&e.preventDefault()},{passive:!1});let n=0;document.addEventListener("touchstart",function(e){n=e.touches[0].pageY},{passive:!0}),document.addEventListener("touchmove",function(e){!Ye(e.target)&&e.touches[0].pageY>n&&window.pageYOffset===0&&e.preventDefault()},{passive:!1})}/Mobi|Android/i.test(navigator.userAgent)||(console.log("[BalancyWebView] Applying Desktop-specific optimizations"),document.addEventListener("keydown",function(n){if((n.ctrlKey||n.metaKey)&&["a","c","v","x","s","p","f","h","r","n","w","t"].includes(n.key.toLowerCase())||[112,113,114,115,116,117,118,119,120,121,122,123,116,123].includes(n.keyCode))return n.preventDefault(),n.stopPropagation(),!1},{passive:!1,capture:!0}),document.addEventListener("mousedown",function(n){if(n.button===1)return n.preventDefault(),!1},{passive:!1})),console.log("[BalancyWebView] Game UI behavior applied successfully")}function K(){if(!window.balancyPerformanceInjected){if(window.balancyPerformanceInjected=!0,console.log("[BalancyWebView] Injecting universal performance optimizations for game-like WebView"),yt(),bt(),!document.querySelector('meta[name="viewport"]')){let n=document.createElement("meta");n.name="viewport",n.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover",document.head.appendChild(n),console.log("[BalancyWebView] Viewport meta tag added")}console.log("[BalancyWebView] Game UI initialization completed"),document.dispatchEvent(new CustomEvent("balancyGameUIReady",{detail:{platform:/iPad|iPhone|iPod/.test(navigator.userAgent)?"iOS":/Android/.test(navigator.userAgent)?"Android":"Desktop",timestamp:Date.now()}}))}}function _e(n){async function e(t=document){let a=t.querySelectorAll("audio[data-button-audio-id]"),r=0;for(let o of a){if(o.classList.contains("balancy-audio-prepared"))return;let i=o.getAttribute("data-button-audio-id");if(!i)return;let c=await n(i);if(!c)return;o.src=c,o.classList.add("balancy-audio-prepared"),r++}t===document&&document.dispatchEvent(new CustomEvent("balancy-audio-complete",{detail:{preparedCount:r,totalFound:a.length}}))}return{prepareAllAudio:e}}var z=class{constructor(){this._enabled=!0;this._activeInHierarchy=!0}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this.updateActiveState())}get activeInHierarchy(){return this._activeInHierarchy}awake(){}onEnable(){}start(){}update(e){}onDisable(){}onDestroy(){}getComponent(e){if(!this.elementObject)return null;for(let t of this.elementObject.components)if(t.scriptInstance instanceof e)return t.scriptInstance;return null}getComponents(e){if(!this.elementObject)return[];let t=[];for(let a of this.elementObject.components)a.scriptInstance instanceof e&&t.push(a.scriptInstance);return t}getComponentInChildren(e){if(!this.elementObject)return null;let t=this.elementObject.element.querySelectorAll("[data-guid]");for(let a=0;a<t.length;a++){let r=t[a];r===this.elementObject.element||r.getAttribute("data-guid")}return null}updateActiveState(){let e=this._enabled&&this.isParentActive();if(this._activeInHierarchy!==e){this._activeInHierarchy=e;try{e?this.onEnable():this.onDisable()}catch(t){console.error("[ElementBehaviour] Error in lifecycle hook:",t)}}}isParentActive(){if(!this.elementObject||!this.elementObject.element)return!0;let e=this.elementObject.element.parentElement;for(;e&&e!==document.body;){if(window.getComputedStyle(e).display==="none")return!1;e=e.parentElement}return!0}};var X=class{constructor(){this.scripts=new Map}register(e,t){this.scripts.has(e)&&console.warn(`[ScriptRegistry] Script ID "${e}" is already registered. Overwriting.`),this.scripts.set(e,t)}get(e){let t=this.scripts.get(e);return t||(console.error(`[ScriptRegistry] Script class not found for ID: "${e}". Did you forget to register it?`),null)}has(e){return this.scripts.has(e)}getAllScriptIds(){return Array.from(this.scripts.keys())}clear(){this.scripts.clear()}},Z=new X;function Je(){if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID().replace(/-/g,"");let n="abcdef0123456789",e="";for(let t=0;t<32;t++)e+=n.charAt(Math.floor(Math.random()*n.length));return e}function Ke(n){let e=new Map;function t(a){let r=a.getAttribute("data-guid");if(r){let i=Je();a.setAttribute("data-guid",i),e.set(r,i)}let o=a.children;for(let i=0;i<o.length;i++){let c=o[i];c instanceof HTMLElement&&t(c)}}return t(n),e}function Q(n){let e=n.getAttribute("data-guid");return e||(e=Je(),n.setAttribute("data-guid",e)),e}function B(n,e){return(e||document.body).querySelector(`[data-guid="${n}"]`)}function U(n){let e=n.getAttribute("data-script-params");if(!e)return null;try{let t=e.replace(/'/g,'"');return JSON.parse(t)}catch(t){return console.error("[ParameterSerializer] Failed to parse data-script-params:",t),console.error(" Script element:",n),console.error(" Raw params:",e),null}}function Xe(n,e,t,a,r){for(let[o,i]of Object.entries(e))try{if(!(o in n))continue;switch(i.type){case"number":n[o]=Number(i.value);break;case"string":n[o]=String(i.value);break;case"boolean":n[o]=i.value===!0||i.value==="true";break;case"element":let c=String(i.value);if(c===""||c==="null")n[o]=null;else{let s=t(c,o);if(n[o]=s,!s){let l=a||n.constructor.name||"Unknown",d=r?.getAttribute("data-script-id"),m=r?.id||r?.getAttribute("data-guid")||"Unknown",p=r?.tagName.toLowerCase()||"unknown",g=document.querySelector(`[data-guid="${c}"]`),b=g?.hasAttribute("data-prefab-id");console.error("[ParameterSerializer] \u274C Element reference not found:"),console.error(` \u2192 Parameter: "${o}"`),console.error(` \u2192 Script: "${l}"${d?` (id: ${d})`:""}`),console.error(` \u2192 Owner Element: <${p} id="${m}">`),console.error(` \u2192 Missing GUID: "${c}"`),console.error(` \u2192 Element in DOM: ${g?"YES":"NO"}${g?` <${g.tagName.toLowerCase()} id="${g.id}">`:""}`),console.error(` \u2192 Is prefab placeholder: ${b?"YES (data-prefab-id="+g?.getAttribute("data-prefab-id")+")":"NO"}`)}}break;default:console.warn(`[ParameterSerializer] Unknown parameter type: ${i.type}`)}}catch(c){console.error(`[ParameterSerializer] Error applying parameter "${o}":`,c)}}function Ze(n){return JSON.stringify(n).replace(/"/g,"'")}function Qe(n,e){return(t,a)=>ht(t,n,e,a)}function ht(n,e,t,a){if(!n||n===""||n==="null")return null;let r=t?B(n,t):null;if(!r&&t&&(r=B(n)),!r&&!t&&(r=B(n)),!r)return a||console.error(`[ElementResolver] Element not found for GUID: "${n}"`),null;let o=e.getElementByGuid(n);return o||(o=e.createElementObjectFromElement(r,n)),o||(console.error(`[ElementResolver] Failed to create ElementObject for GUID: "${n}"`),null)}function et(n,e){let t=n.querySelectorAll("[data-script-params]"),a=[];n.hasAttribute("data-script-params")&&a.push(n),a.push(...Array.from(t));for(let r of a)try{wt(r,e)}catch(o){console.error("[ParameterCloner] Error updating parameters:",o),console.error(" Script element:",r)}}function wt(n,e){let t=U(n);if(!t)return;let a=!1;for(let[r,o]of Object.entries(t))if(o.type==="element"){let i=String(o.value);if(e.has(i)){let c=e.get(i);o.value=c,a=!0}}if(a){let r=Ze(t);n.setAttribute("data-script-params",r)}}var ee=class{constructor(){this.elementObjects=new Map;this.updateLoopRunning=!1;this.isPaused=!1;this.lastFrameTime=0;this.animationFrameId=null;this.initialized=!1;this.displayValues=new WeakMap;this.updateLoop=e=>{let t=(e-this.lastFrameTime)/1e3;if(this.lastFrameTime=e,!this.isPaused){for(let a of this.elementObjects.values())if(a.isActive){for(let r of a.components)if(!(!r.enabled||!r.scriptInstance.activeInHierarchy)){r.hasStarted||this.invokeStart(r);try{r.scriptInstance.update(t)}catch(o){console.error(`[ElementsManager] Error in update() for ${r.scriptId}:`,o)}}}}this.updateLoopRunning&&(this.animationFrameId=requestAnimationFrame(this.updateLoop))}}registerScript(e,t){Z.register(e,t)}initialize(){if(this.initialized){console.warn("[ElementsManager] Already initialized");return}console.log("[ElementsManager] Initializing component system..."),this.scanAllElements(),this.invokeInitialLifecycleMethods(),this.startUpdateLoop(),this.initialized=!0,console.log(`[ElementsManager] Initialization complete. ${this.elementObjects.size} ElementObjects created.`)}scanAllElements(){this.scanElement(document.body)}scanElement(e,t){let a=[];for(let r=0;r<e.children.length;r++){let o=e.children[r];o instanceof HTMLElement&&o.hasAttribute("data-script-id")&&a.push(o)}a.length>0&&this.processScriptDivs(e,a,t);for(let r=0;r<e.children.length;r++){let o=e.children[r];o instanceof HTMLElement&&this.scanElement(o,t)}}processScriptDivs(e,t,a){let r=Q(e),o=this.elementObjects.get(r);o||(o=new M(e,r),this.elementObjects.set(r,o));for(let i of t)this.createComponent(o,i,a)}createComponent(e,t,a){let r=t.getAttribute("data-script-id");if(!r)return console.error("[ElementsManager] Script div missing data-script-id",t),null;let o=Z.get(r);if(!o)return null;Q(t);try{let i=new o,c={elementObject:e,scriptElement:t,scriptInstance:i,scriptId:r,enabled:!0,hasStarted:!1};i.elementObject=e,i.scriptElement=t,e.addComponent(c);let s=U(t);if(s){let l=Qe(this,a),d=o.name||r;Xe(i,s,l,d,t)}return c}catch(i){return console.error(`[ElementsManager] Error creating component "${r}":`,i),null}}invokeInitialLifecycleMethods(){for(let e of this.elementObjects.values())for(let t of e.components)this.callLifecycleMethod(t,"awake"),e.isActive&&t.enabled&&this.callLifecycleMethod(t,"onEnable")}callLifecycleMethod(e,t){try{let a=e.scriptInstance[t];typeof a=="function"&&a.call(e.scriptInstance)}catch(a){console.error(`[ElementsManager] Error in ${t}() for ${e.scriptId}:`,a)}}invokeStart(e){e.hasStarted||(this.callLifecycleMethod(e,"start"),e.hasStarted=!0)}startUpdateLoop(){this.updateLoopRunning||(this.updateLoopRunning=!0,this.lastFrameTime=performance.now(),this.updateLoop(this.lastFrameTime))}pause(){this.isPaused=!0}resume(){this.isPaused=!1}stopUpdateLoop(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.updateLoopRunning=!1}getElementByGuid(e){return this.elementObjects.get(e)||null}createElementObjectFromElement(e,t){if(this.elementObjects.has(t))return this.elementObjects.get(t);let a=new M(e,t);return this.elementObjects.set(t,a),a}getOrCreateElementObject(e){if(this.elementObjects.has(e))return this.elementObjects.get(e);let t=B(e);if(!t)return null;let a=new M(t,e);this.elementObjects.set(e,a);let r=[];for(let o=0;o<t.children.length;o++){let i=t.children[o];i instanceof HTMLElement&&i.hasAttribute("data-script-id")&&r.push(i)}if(r.length>0)for(let o of r)this.createComponent(a,o,t);return a}setActive(e,t){let a=e.getAttribute("data-guid");if(!a){console.error("[ElementsManager] Element has no GUID:",e);return}let r=this.elementObjects.get(a);if(!r){console.warn("[ElementsManager] Element not managed:",e);return}if(r.isActive===t)return;if(t){let i=this.displayValues.get(e)||"";e.style.display=i}else this.displayValues.set(e,e.style.display),e.style.display="none";r.isActive=t;let o=this.getComponentsInElementAndChildren(e);for(let i of o)i.scriptInstance.updateActiveState()}getComponentsInElementAndChildren(e){let t=[],a=e.getAttribute("data-guid");if(a){let o=this.elementObjects.get(a);o&&t.push(...o.components)}let r=e.querySelectorAll("[data-guid]");for(let o of r){let i=o.getAttribute("data-guid");if(i){let c=this.elementObjects.get(i);c&&t.push(...c.components)}}return t}destroy(e){let t=e.getAttribute("data-guid");if(!t){e.remove();return}if(!this.elementObjects.get(t)){e.remove();return}let r=this.getComponentsInElementAndChildren(e);for(let i of r)i.scriptInstance.activeInHierarchy&&this.callLifecycleMethod(i,"onDisable"),this.callLifecycleMethod(i,"onDestroy");this.elementObjects.delete(t);let o=e.querySelectorAll("[data-guid]");for(let i of o){let c=i.getAttribute("data-guid");c&&this.elementObjects.delete(c)}e.remove()}instantiate(e){let t=e.cloneNode(!0),a=Ke(t);et(t,a),this.scanElement(t,t);let r=this.getComponentsInElementAndChildren(t);for(let o of r)this.callLifecycleMethod(o,"awake"),o.enabled&&o.scriptInstance.activeInHierarchy&&this.callLifecycleMethod(o,"onEnable"),this.invokeStart(o);return t}cleanup(){this.stopUpdateLoop(),this.elementObjects.clear(),this.initialized=!1}},E=new ee;var M=class{constructor(e,t){this.components=[];this.isActive=!0;this.element=e,this.guid=t}addComponent(e){this.components.includes(e)||(this.components.push(e),e.elementObject=this)}removeComponent(e){let t=this.components.indexOf(e);t!==-1&&this.components.splice(t,1)}getComponent(e){for(let t of this.components)if(t.scriptInstance instanceof e)return t.scriptInstance;return null}getComponents(e){let t=[];for(let a of this.components)a.scriptInstance instanceof e&&t.push(a.scriptInstance);return t}getEnabledComponents(){return this.components.filter(e=>e.enabled&&e.scriptInstance.activeInHierarchy)}instantiate(){let t=E.instantiate(this.element).getAttribute("data-guid");if(!t)throw new Error("[ElementObject] Cloned element has no GUID");let a=E.getElementByGuid(t);if(!a)throw new Error("[ElementObject] Cloned element not found in ElementsManager");return a}};var te=class{constructor(){this.prefabCache=new Map;this.pendingLoads=new Map;this.loaderFunction=null;this.uiProcessor=null}setLoader(e){this.loaderFunction=e}setUIProcessor(e){this.uiProcessor=e}async load(e){if(this.prefabCache.has(e)){let a=this.prefabCache.get(e);return console.log(`[PrefabsManager] Using cached prefab: ${e}`),a.cloneNode(!0)}if(this.pendingLoads.has(e))return console.log(`[PrefabsManager] Waiting for pending load: ${e}`),await this.pendingLoads.get(e),this.prefabCache.has(e)?this.prefabCache.get(e).cloneNode(!0):(console.error(`[PrefabsManager] Prefab not in cache after pending load: ${e}`),null);if(!this.loaderFunction)return console.error("[PrefabsManager] No loader function set. Call setLoader() first."),null;console.log(`[PrefabsManager] Loading prefab: ${e}`);let t=(async()=>{try{let a=await this.loaderFunction(e);return a?(this.prefabCache.set(e,a),console.log(`[PrefabsManager] Prefab cached: ${e}`),a.cloneNode(!0)):(console.error(`[PrefabsManager] Failed to load prefab: ${e}`),null)}catch(a){return console.error(`[PrefabsManager] Error loading prefab "${e}":`,a),null}finally{this.pendingLoads.delete(e)}})();return this.pendingLoads.set(e,t),t}async processPrefabPlaceholdersInScope(e=document){let t=e===document?"whole page":`<${e.tagName?.toLowerCase()||"element"} id="${e.id||"unknown"}">`;console.log(`[PrefabsManager] Processing prefab placeholders in: ${t}`);let a=e.querySelectorAll("[data-prefab-id]");console.log(`[PrefabsManager] Found ${a.length} placeholders in scope`);for(let r of a)r.hasAttribute("data-prefab-id")&&await this.processPlaceholder(r);console.log(`[PrefabsManager] All prefab placeholders processed in: ${t}`)}async processPrefabPlaceholders(){await this.processPrefabPlaceholdersInScope(document)}async processPlaceholder(e){let t=e.getAttribute("data-prefab-id");if(!t){console.warn("[PrefabsManager] Skipping placeholder - data-prefab-id attribute missing or already processed",e);return}try{let a=await this.load(t);if(!a){console.error(`[PrefabsManager] Failed to load prefab for placeholder: ${t}`);return}let r=e.getAttribute("data-guid");console.log(`[PrefabsManager] Processing placeholder for ${t}:`),console.log(` - Placeholder: <${e.tagName.toLowerCase()} id="${e.id}">`),console.log(` - Placeholder GUID: ${r}`),console.log(` - Prefab root: <${a.tagName.toLowerCase()} id="${a.id}">`),console.log(` - Children to move: ${a.children.length}`),this.validatePrefabReferences(a,t);let o=0;for(;a.firstChild;)e.appendChild(a.firstChild),o++;console.log(` - Moved ${o} children to placeholder`),console.log(` - Placeholder now has ${e.children.length} children`),e.removeAttribute("data-prefab-id"),!e.className&&a.className&&(e.className=a.className),this.uiProcessor&&(console.log(" - Processing UI elements in placeholder..."),await this.uiProcessor(e),console.log(" - UI elements processed for placeholder"))}catch(a){console.error(`[PrefabsManager] Error processing placeholder for "${t}":`,a)}}clearCache(){this.prefabCache.clear()}async preload(e){console.log(`[PrefabsManager] Preloading ${e.length} prefabs...`);let t=e.map(a=>this.load(a));await Promise.all(t),console.log("[PrefabsManager] Preload complete")}getCacheStats(){return{size:this.prefabCache.size,prefabIds:Array.from(this.prefabCache.keys())}}validatePrefabReferences(e,t){let a=e.querySelectorAll("[data-guid]"),r=new Set,o=e.getAttribute("data-guid");o&&r.add(o),a.forEach(s=>{let l=s.getAttribute("data-guid");l&&r.add(l)});let i=e.querySelectorAll("[data-script-params]"),c=[];i.forEach(s=>{let l=s.getAttribute("data-script-params"),d=s.getAttribute("data-script-id")||"unknown",m=s.id||s.getAttribute("data-guid")||"unknown";if(l)try{let p=l.replace(/'/g,'"'),g=JSON.parse(p);for(let[b,H]of Object.entries(g))if(H.type==="element"){let L=String(H.value);L&&L!==""&&L!=="null"&&!r.has(L)&&c.push({scriptId:d,elementId:m,param:b,guid:L})}}catch{}}),c.length>0&&(console.warn(`[PrefabsManager] \u26A0\uFE0F Prefab ${t} has ${c.length} broken element reference(s):`),c.forEach(s=>{console.warn(` \u2192 Script ${s.scriptId} (element: ${s.elementId})`),console.warn(` Parameter: "${s.param}" \u2192 Missing GUID: "${s.guid}"`)}),console.warn(" \u{1F4A1} Tip: Re-save the prefab in the editor to fix stale references"))}},S=new te;E.instantiatePrefab=async function(n){let e=await S.load(n);return e?(console.info("INSTY +> ",e),this.instantiate(e)):null};E.instantiatePrefabById=async function(n){let e=await this.instantiatePrefab(n);if(!e)return null;let t=e.getAttribute("data-guid");if(!t)return console.error("[ElementsManager] Instantiated prefab has no GUID"),null;let a=this.getElementByGuid(t);return a||(console.error("[ElementsManager] ElementObject not found after instantiation"),null)};var V={},se={},ot=0,at=new D,vt=new $,it=new N,Et=new G,Pt=new F,st=()=>ot,lt=()=>{ot++},le=be(),oe=Ve(),ce=()=>{},ae=we(se,n=>ce(n),oe.dispatchCustomMessage),ct=ve(st,lt,se,le),h=Ee(at,ct,st,lt,se,le),Tt=he(ae),A=Pe(h),{getActiveOffers:Mt,getActiveGroupOffers:St,canBuyGroupOffer:ue,buyGroupOffer:It,buyOffer:At,buyShopSlot:Lt}=Te(h,A.getSystemProfileValue,A.getDocumentValue),k=Me(h),ne=Se(h),re=Ie(h,A.getDocumentValue),I=Ae(h),ie=n=>it.get(n,h,u.GetLocalization),R=n=>vt.get(n,h,u.GetImageUrl),Ot=n=>Et.get(n,h,u.GetFileLocation),tt=n=>Pt.get(n,h,u.GetPrefabContent),ut=ze(A.getDocumentValue),de=Le(ie),dt=Oe(R),Ct=Ce(R,J),mt=Be(h,ue,R),Bt=xe(h,ut,Y,_,de.setLocalizedText),xt=_e(R),q=async(n=document)=>{let e=n===document?"whole page":`<${n.tagName?.toLowerCase()||"element"} id="${n.id||"unknown"}">`;console.info(`[Balancy] Preparing all UI elements for: ${e}`),n!==document&&await S.processPrefabPlaceholdersInScope(n),await de.localizeAllElements(n),await Ct.prepareAllFonts(n),await dt.prepareAllSprites(n),await mt.prepareAllButtons(n),await Bt.prepareAllTexts(n),await xt.prepareAllAudio(n),console.info(`[Balancy] All UI elements prepared for: ${e}`)},kt=()=>{document.querySelectorAll(`[data-button-action="${u.BuyGroupOffer}"]`).forEach(e=>{let t=parseInt(e.getAttribute("data-index")||"0",10)||0;ue(t).then(a=>{e.disabled=!a})})};ce=qe(kt);var nt=!1,rt=()=>ct(null,u.BalancyIsReady,{id:"none"});Object.assign(V,{NotificationType:O,PriceType:pe,ItemType:x,TaskStatus:fe,RequestAction:u,BuyButtonState:ge,OfferGroupType:ye,NumberDisplayFormat:v,TimeDisplayFormat:C,TimePrecision:y,postMessage:le,_receiveMessageFromUnity:Tt,handleResponse:ae,sendRequest:h,batchManager:at,getProfileValue:A.getProfileValue,getSystemProfileValue:A.getSystemProfileValue,getDocumentValue:A.getDocumentValue,getActiveOffers:Mt,getActiveGroupOffers:St,canBuyGroupOffer:ue,buyGroupOffer:It,buyOffer:At,buyShopSlot:Lt,getTasks:k.getTasks,activateTasks:k.activateTasks,deactivateTasks:k.deactivateTasks,restoreFailedTask:k.restoreFailedTask,claimTaskReward:k.claimTaskReward,getInventoryItemsCount:ne.getInventoryItemsCount,addInventoryItems:ne.addInventoryItems,removeInventoryItems:ne.removeInventoryItems,getBattlePassConfig:re.getBattlePassConfig,getBattlePassProgress:re.getBattlePassProgress,claimBattlePassReward:re.claimBattlePassReward,getCustomEventInfo:I.getCustomEventInfo,setCustomEventInfo:I.setCustomEventInfo,stopEventManually:I.stopEventManually,watchRewardedAd:I.watchRewardedAd,getProductInfo:I.getProductInfo,closeView:I.closeView,sendCustomMessage:I.sendCustomMessage,getLocalizedText:ie,getImageUrl:R,getFileLocation:Ot,getPrefabContent:tt,setLocalizedText:de.setLocalizedText,setImage:dt.setImage,formatTime:Y,formatString:Ne,formatItemsCount:$e,formatItemCount:je,shortenCount:W,itemHasDecayEffect:j,itemGetBundleReward:De,getTimeLeft:_,formatDataTemplate:ut,injectFontFace:J,findDomElement:Ue,balancyButtonClicked:mt.balancyButtonClicked,notificationReceived:ce,subscribeToCustomMessages:oe.subscribeToCustomMessages,dispatchCustomMessage:oe.dispatchCustomMessage,sendIsReady:rt,delayIsReady:()=>{nt=!0},ElementBehaviour:z,ElementObject:M,ElementsManager:E,PrefabsManager:S,instantiatePrefabById:n=>E.instantiatePrefabById(n),prepareAllUIElements:q,initResponseHandler:()=>{if(V._responseHandlerInitialized)return;V._responseHandlerInitialized=!0;let n=new Map;We(ae,()=>q(),rt,nt,async()=>{try{console.info("[Balancy] Preloading mandatory localization keys..."),await Promise.all(Ge.map(r=>ie(r))),Fe(r=>it.getCached(r)),console.info("[Balancy] Mandatory localization keys preloaded"),S.setUIProcessor(async r=>{await q(r)}),S.setLoader(async r=>{try{if(n.has(r))return console.info(`[Balancy] Using cached prefab: ${r}`),n.get(r);console.info(`[Balancy] Loading prefab for the first time: ${r}`);let o=await tt(r);if(console.info(`[Balancy] Received HTML content (length: ${o?.length||0})`),!o)return console.error(`[Balancy] No HTML content returned for prefab: ${r}`),null;let c=new DOMParser().parseFromString(o,"text/html"),s=c.body.firstElementChild;if(!s)return console.error(`[Balancy] No root element found in prefab body for: ${r}`),null;let l=c.head.querySelectorAll("style");return l.length>0&&l.forEach(d=>{let p=(d.textContent||"").replace(/\*\s*\{[^}]*\}/g,"").replace(/body\s*\{[^}]*\}/g,"").replace(/html\s*\{[^}]*\}/g,"");if(p=p.trim(),p){let g=document.createElement("style");g.textContent=p,g.setAttribute("data-prefab-id",r),document.head.appendChild(g),console.info(`[Balancy] Injected prefab styles into document.head for ${r}:
10
+ ${p}`)}else console.warn(`[Balancy] No styles left after filtering for prefab: ${r}`)}),console.info(`[Balancy] Processing UI elements for prefab ${r}...`),await q(s),console.info(`[Balancy] UI elements processed for prefab ${r}`),n.set(r,s),console.info("[Balancy] Prefab loaded and cached successfully:"),console.info(` - Root element: <${s.tagName.toLowerCase()} id="${s.id}">`),console.info(` - Children count: ${s.children.length}`),console.info(" - Full element:",s),s}catch(o){return console.error(`[Balancy] Error in prefab loader for "${r}":`,o),null}}),await S.processPrefabPlaceholders(),console.group("[Balancy] Final HTML Structure");let t=document.head.querySelectorAll("style[data-prefab-id]");console.log("=== STYLES IN <HEAD> ==="),t.forEach(r=>{let o=r.getAttribute("data-prefab-id");console.log(`
11
+ <!-- Prefab ${o} styles -->`),console.log(`<style data-prefab-id="${o}">`),console.log(r.textContent),console.log("</style>")}),console.log(`
12
+ === BODY STRUCTURE ===`);let a=document.body.cloneNode(!0);a.querySelectorAll("script").forEach(r=>{r.textContent="/* script content removed */"}),console.log(a.outerHTML),console.groupEnd(),E.initialize();try{let r=document.body.querySelector("[data-guid]");if(r){let o=r.getAttribute("data-guid");console.info(`[Balancy] Found root element with GUID: ${o}`);let i=E.getElementByGuid(o);if(i){let c=i.components;if(c.length>0){console.info(`[Balancy] Root element has ${c.length} component(s)`);let s=c[0].scriptInstance;if(typeof s.init=="function"){console.info("[Balancy] Calling init() on root script with balancyViewOwner");let l=window.balancyViewOwner;l?s.init(l):(console.warn("[Balancy] window.balancyViewOwner is not defined, calling init() without arguments"),s.init())}else console.info("[Balancy] Root script does not have an init() method")}else console.info("[Balancy] Root element has no script components")}}else console.info("[Balancy] No root element found with data-guid attribute")}catch(r){console.error("[Balancy] Error auto-initializing root script:",r)}document.dispatchEvent(new CustomEvent("balancy-components-complete"))}catch(t){console.error("[Balancy] Error initializing component system:",t),document.dispatchEvent(new CustomEvent("balancy-components-complete"))}})}});typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",K):K());typeof window<"u"&&(window.balancy=V);console.log("\u{1F389} [BRIDGE] Balancy WebView Bridge loaded successfully!");return balancy;})();
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@balancy/bridge",
3
+ "version": "1.1.47",
4
+ "description": "Balancy WebView Bridge - Unity-like component system for HTML/JavaScript",
5
+ "author": {
6
+ "name": "Balancy Team"
7
+ },
8
+ "license": "MIT",
9
+ "scripts": {
10
+ "build": "node scripts/build.js",
11
+ "build:dev": "node scripts/build.js --dev",
12
+ "watch": "node scripts/build.js --watch"
13
+ },
14
+ "main": "./dist/balancy-webview-bridge.js",
15
+ "types": "./dist/index.d.ts",
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "devDependencies": {
20
+ "esbuild": "^0.20.0",
21
+ "typescript": "^5.3.3"
22
+ }
23
+ }