lecodes-cli 2.4.9 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/index.js +2681 -1196
  2. package/package.json +10 -10
  3. package/runtime/materials/decal-relief.mat +21 -46
  4. package/runtime/materials/decal.mat +41 -61
  5. package/runtime/materials/foliage-cards.mat +28 -140
  6. package/runtime/materials/foliage-impostor.mat +485 -0
  7. package/runtime/materials/foliage.mat +232 -0
  8. package/runtime/materials/grass.mat +244 -0
  9. package/runtime/materials/particles-quad.mat +5 -3
  10. package/runtime/materials/particles.mat +5 -3
  11. package/runtime/sdk-types.json +1 -1
  12. package/runtime/web/VERSION.json +3 -3
  13. package/runtime/web/assets/materials-Cs_z1zLi.bin +0 -0
  14. package/runtime/web/assets/materials-world-BtoAfznA.bin +0 -0
  15. package/runtime/web/player.js +3 -3
  16. package/runtime/web-lite/assets/{canvas-WxiusXCB.js → canvas-wFjS40IX.js} +1 -1
  17. package/runtime/web-lite/assets/creator2d-1pSkYRCn.js +1 -0
  18. package/runtime/web-lite/assets/creator2d-Ci5-pZGr.wasm +0 -0
  19. package/runtime/web-lite/assets/{pager-DpGa2uaE.js → pager-BZAO9gMC.js} +1 -1
  20. package/runtime/web-lite/assets/{plugins-CuEPHbHL.js → plugins-B7TuO_p4.js} +1 -1
  21. package/runtime/web-lite/assets/scene2d-F6T1Io7I.js +1 -0
  22. package/runtime/web-lite/assets/{tween-BnWYhJ7P.js → tween-DbrQTld4.js} +1 -1
  23. package/runtime/web-lite/assets/{video-BLj61nDx.js → video-bzR_t2i6.js} +1 -1
  24. package/runtime/web-lite/assets/{vlist-CwSYpLz-.js → vlist-Ap-F4H5J.js} +1 -1
  25. package/runtime/web-lite/features.json +18 -6
  26. package/runtime/web-lite/lite.js +6 -6
  27. package/src/commands/compile.ts +2 -1
  28. package/src/commands/hub/create.ts +100 -0
  29. package/src/commands/hub/credential.ts +32 -0
  30. package/src/commands/hub/index.ts +21 -0
  31. package/src/commands/hub/login.ts +89 -0
  32. package/src/commands/hub/status.ts +109 -0
  33. package/src/commands/index.ts +5 -1
  34. package/src/commands/level.ts +123 -0
  35. package/src/commands/lightmap.ts +41 -76
  36. package/src/commands/navmesh.ts +84 -67
  37. package/src/commands/secrets.ts +147 -0
  38. package/src/commands/update/index.ts +154 -64
  39. package/src/compile/designCompile.ts +2 -0
  40. package/src/compile/headlessBundle.ts +2 -0
  41. package/src/compile/projectCompile.ts +12 -1
  42. package/src/compile/sceneCompile.ts +2 -1
  43. package/src/dev/backendWorker.ts +6 -1
  44. package/src/dev/devServer.ts +2 -1
  45. package/src/dev/localBackend.ts +21 -14
  46. package/src/dev/projectBackend.ts +7 -3
  47. package/src/dev/watchProject.ts +2 -0
  48. package/src/hosts/desktopRenderer.ts +10 -2
  49. package/src/hosts/peerInstall.ts +26 -6
  50. package/src/hub/api.ts +220 -0
  51. package/src/hub/config.ts +53 -0
  52. package/src/hub/git.ts +148 -0
  53. package/src/platform/api.ts +21 -0
  54. package/src/project/env.ts +29 -0
  55. package/src/web/build.ts +149 -88
  56. package/runtime/web/assets/materials-CJzxzdUK.bin +0 -0
  57. package/runtime/web/assets/materials-world-BNQb0Z1l.bin +0 -0
@@ -1 +1 @@
1
- import{G as V,H as T}from"../lite.js";const u=i=>i instanceof Error?i.message:String(i),E=(i,v,r)=>{try{Promise.resolve(i()).then(a=>{a===void 0?v():v(a)},a=>r(u(a)))}catch(a){r(u(a))}},N=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}},A={name:"plugins",install(i){const v=i.root.ownerDocument,r=i.plugins,a=new Map,f=new Map;let g=1,c=null,p=!0;const h=(e,t,n)=>{const s=a.get(e);if(s)return s;const o=r==null?void 0:r.views.get(t);if(!o)return null;let l;try{l=o.factory(N(n),{emit:(d,S)=>{p&&a.has(e)&&i.emit(0,T,e,d,S)}},v)}catch(d){return i.warn(`NativeView("${t}") did not start: ${u(d)}`),null}l.el.classList.add("lc-view");const w={id:e,instance:l,node:null,full:!1};return a.set(e,w),w},m=e=>{var s;const t=e.full?c:((s=e.node)==null?void 0:s.el)??null,n=e.instance.el;n.parentElement!==t&&(t?t.appendChild(n):n.remove())},$=e=>{const t=e.strings.get("viewName"),n=Number(e.strings.get("viewId"));if(!t||!Number.isFinite(n)||n<=0)return;const s=h(n,t,e.strings.get("viewParams"));s&&(s.node=e,m(s))};return{globals:{_creatorService:{supported:e=>(r==null?void 0:r.services.has(e))??!1,version:e=>{var t;return((t=r==null?void 0:r.services.get(e))==null?void 0:t.version)??0},open(e,t,n){const s=r==null?void 0:r.services.get(e);if(!s)return-1;const o=g++;try{f.set(o,s.factory(N(t),{emit:(l,w)=>{!p||!f.has(o)||(w===void 0?n(l):n(l,w))}}))}catch(l){return i.warn(`Service("${e}") did not open: ${u(l)}`),-1}return o},call(e,t,n,s,o){const l=f.get(e);if(!(l!=null&&l.call)){o(`Service call "${t}": no live session (serviceId ${e})`);return}E(()=>l.call(t,Array.isArray(n)?n:[]),s,o)},close(e){var n;const t=f.get(e);f.delete(e);try{(n=t==null?void 0:t.close)==null||n.call(t)}catch(s){i.warn(`a service's close threw: ${u(s)}`)}}}},bridge:{isViewSupported:e=>(r==null?void 0:r.views.has(e))??!1,viewVersion:e=>{var t;return((t=r==null?void 0:r.views.get(e))==null?void 0:t.version)??0},viewCall(e,t,n,s,o){const l=a.get(e);if(!(l!=null&&l.instance.call)){o(`NativeView call "${t}": no live view (viewId ${e})`);return}E(()=>l.instance.call(t,Array.isArray(n)?n:[]),s,o)}},content(e,t){e.type==="native"&&(t==="viewName"||t==="viewParams"||t==="viewId")&&$(e)},destination(e,t){if(e.kind!==V)return!1;if(t){const s=h(e.id,e.viewName,e.paramsJson);return s?(c||(c=v.createElement("div"),c.className="lc-view-full"),c.parentElement!==i.root&&i.root.insertBefore(c,i.root.firstChild),s.full=!0,m(s),!0):!1}const n=a.get(e.id);return n!=null&&n.full&&(n.full=!1,m(n),c==null||c.remove()),!0},forget(e){if(e.type==="native")for(const t of a.values())t.node===e&&(t.node=null,m(t))},destroy(){var e,t,n;p=!1;for(const s of a.values()){try{(t=(e=s.instance).destroy)==null||t.call(e)}catch(o){i.warn(`a view's destroy threw: ${u(o)}`)}s.instance.el.remove()}a.clear();for(const s of f.values())try{(n=s.close)==null||n.call(s)}catch{}f.clear(),c==null||c.remove(),c=null},stats:()=>({views:a.size,services:f.size})}}};export{A as plugins};
1
+ import{H as V,I as T}from"../lite.js";const u=i=>i instanceof Error?i.message:String(i),E=(i,v,r)=>{try{Promise.resolve(i()).then(a=>{a===void 0?v():v(a)},a=>r(u(a)))}catch(a){r(u(a))}},N=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}},A={name:"plugins",install(i){const v=i.root.ownerDocument,r=i.plugins,a=new Map,f=new Map;let g=1,c=null,p=!0;const h=(e,t,n)=>{const s=a.get(e);if(s)return s;const o=r==null?void 0:r.views.get(t);if(!o)return null;let l;try{l=o.factory(N(n),{emit:(d,S)=>{p&&a.has(e)&&i.emit(0,T,e,d,S)}},v)}catch(d){return i.warn(`NativeView("${t}") did not start: ${u(d)}`),null}l.el.classList.add("lc-view");const w={id:e,instance:l,node:null,full:!1};return a.set(e,w),w},m=e=>{var s;const t=e.full?c:((s=e.node)==null?void 0:s.el)??null,n=e.instance.el;n.parentElement!==t&&(t?t.appendChild(n):n.remove())},$=e=>{const t=e.strings.get("viewName"),n=Number(e.strings.get("viewId"));if(!t||!Number.isFinite(n)||n<=0)return;const s=h(n,t,e.strings.get("viewParams"));s&&(s.node=e,m(s))};return{globals:{_creatorService:{supported:e=>(r==null?void 0:r.services.has(e))??!1,version:e=>{var t;return((t=r==null?void 0:r.services.get(e))==null?void 0:t.version)??0},open(e,t,n){const s=r==null?void 0:r.services.get(e);if(!s)return-1;const o=g++;try{f.set(o,s.factory(N(t),{emit:(l,w)=>{!p||!f.has(o)||(w===void 0?n(l):n(l,w))}}))}catch(l){return i.warn(`Service("${e}") did not open: ${u(l)}`),-1}return o},call(e,t,n,s,o){const l=f.get(e);if(!(l!=null&&l.call)){o(`Service call "${t}": no live session (serviceId ${e})`);return}E(()=>l.call(t,Array.isArray(n)?n:[]),s,o)},close(e){var n;const t=f.get(e);f.delete(e);try{(n=t==null?void 0:t.close)==null||n.call(t)}catch(s){i.warn(`a service's close threw: ${u(s)}`)}}}},bridge:{isViewSupported:e=>(r==null?void 0:r.views.has(e))??!1,viewVersion:e=>{var t;return((t=r==null?void 0:r.views.get(e))==null?void 0:t.version)??0},viewCall(e,t,n,s,o){const l=a.get(e);if(!(l!=null&&l.instance.call)){o(`NativeView call "${t}": no live view (viewId ${e})`);return}E(()=>l.instance.call(t,Array.isArray(n)?n:[]),s,o)}},content(e,t){e.type==="native"&&(t==="viewName"||t==="viewParams"||t==="viewId")&&$(e)},destination(e,t){if(e.kind!==V)return!1;if(t){const s=h(e.id,e.viewName,e.paramsJson);return s?(c||(c=v.createElement("div"),c.className="lc-view-full"),c.parentElement!==i.root&&i.root.insertBefore(c,i.root.firstChild),s.full=!0,m(s),!0):!1}const n=a.get(e.id);return n!=null&&n.full&&(n.full=!1,m(n),c==null||c.remove()),!0},forget(e){if(e.type==="native")for(const t of a.values())t.node===e&&(t.node=null,m(t))},destroy(){var e,t,n;p=!1;for(const s of a.values()){try{(t=(e=s.instance).destroy)==null||t.call(e)}catch(o){i.warn(`a view's destroy threw: ${u(o)}`)}s.instance.el.remove()}a.clear();for(const s of f.values())try{(n=s.close)==null||n.call(s)}catch{}f.clear(),c==null||c.remove(),c=null},stats:()=>({views:a.size,services:f.size})}}};export{A as plugins};
@@ -0,0 +1 @@
1
+ import{e as b,f as G,a as M}from"../lite.js";let O=null;const R=()=>(O??(O=b(()=>import("./creator2d-1pSkYRCn.js"),[],import.meta.url).then(p=>p.default))).then(p=>p()),V=4096,v=p=>Math.min(V,Math.max(1,p|0)),h=p=>p?1:0,D=(p,u)=>{const c=p;c.creator2d_glContext=u.gl,c.creator2d_glOptions={majorVersion:2,minorVersion:0},c._c2dInit();const n=(e,t)=>{if(e==null)return t(0);const r=c._malloc(Math.max(4,e.length*4));c.HEAPF32.set(e,r>>>2);try{return t(r)}finally{c._free(r)}},A=(e,t)=>{const r=c._malloc(Math.max(4,e.length*4));c.HEAPU32.set(e,r>>>2);try{return t(r)}finally{c._free(r)}},E=(e,t)=>{const r=e instanceof Int32Array?e:Int32Array.from(e);return A(new Uint32Array(r.buffer,r.byteOffset,r.length),t)},_=(e,t)=>{const r=c._malloc(Math.max(1,e.length));c.HEAPU8.set(e,r);try{return t(r)}finally{c._free(r)}},S=(e,t)=>{const r=new TextEncoder().encode(e).length+1,i=c._malloc(r);c.stringToUTF8(e,i,r);try{return t(i)}finally{c._free(i)}},o=(e,t)=>{const r=c._malloc(e*4);try{c.HEAPF32.fill(0,r>>>2,(r>>>2)+e);const i=t(r),s=typeof i=="number"?Math.max(0,Math.min(e,i)):e;return c.HEAPF32.slice(r>>>2,(r>>>2)+s)}finally{c._free(r)}},P=new Set;let f=0,C=null,x=!1;const T=e=>{if(!u.canvasPixels)return x||(x=!0,console.warn("[creator-2d] canvas textures are not supported on this host")),null;const t=u.canvasPixels(e);return t&&t.width>0&&t.height>0?t:null},m=(e,t,r)=>{const i=u.bytes(e);return i||(r(new Error(`creator-2d: no data for ${t} systemId`)),null)};return{bridge:{backend:"sokol",version:()=>c._creator2dVersion(),render:e=>c._c2dRender(e),onUpdate:e=>{P.add(e)},offUpdate:e=>{P.delete(e)},setEarlyUpdate:e=>{c.onEarlyUpdate=e},setLateUpdate:e=>{c.onLateUpdate=e},setTimeScale:e=>c._c2dSetTimeScale(e),setOnAnimEvent:e=>{c.onAnimEvent=(t,r,i)=>e({entityId:t,clipId:r,type:i})},setOnPointer:e=>{C=e},setClearColor:(e,t,r,i)=>c._c2dSetClearColor(e,t,r,i),createScene:()=>c._c2dCreateScene(),destroyScene:e=>c._c2dDestroyScene(e),openScene:e=>{c._c2dOpenScene(e),f=0,u.onOpen(e)},closeScene:()=>{c._c2dCloseScene(),u.onClose()},sceneSetClearColor:(e,t,r,i,s)=>c._c2dSceneSetClearColor(e,t,r,i,s),addEntityToScene:(e,t)=>c._c2dAddEntityToScene(e,t),removeEntityFromScene:(e,t)=>c._c2dRemoveEntityFromScene(e,t),setYSort:(e,t)=>c._c2dSetYSort(e,h(t)),cameraSetPosition:(e,t,r)=>c._c2dCameraSetPosition(e,t,r),cameraSetZoom:(e,t)=>c._c2dCameraSetZoom(e,t),cameraSetRotation:(e,t)=>c._c2dCameraSetRotation(e,t),cameraScreenToWorld:(e,t,r)=>o(2,i=>c._c2dCameraScreenToWorld(e,t,r,i)),cameraWorldToScreen:(e,t,r)=>o(2,i=>c._c2dCameraWorldToScreen(e,t,r,i)),createEntity:()=>({id:c._c2dCreateEntity()}),destroyEntity:e=>c._c2dDestroyEntity(e),entityIsOwned:e=>c._c2dEntityIsOwned(e)!==0,setPosition:(e,t,r)=>c._c2dSetPosition(e,t,r),setRotation:(e,t)=>c._c2dSetRotation(e,t),setScale:(e,t,r)=>c._c2dSetScale(e,t,r),setRenderPriority:(e,t)=>c._c2dSetRenderPriority(e,t),setZ:(e,t)=>c._c2dSetZ(e,t),setMaterial:(e,t,r,i)=>c._c2dSetMaterial(e,t,r,i),setVisible:(e,t)=>c._c2dSetVisible(e,h(t)),getPosition:e=>o(2,t=>c._c2dGetPosition(e,t)),setParent:(e,t,r)=>c._c2dSetParent(e,t,h(r)),getParent:e=>c._c2dGetParent(e),getChildCount:e=>c._c2dGetChildCount(e),getChild:(e,t)=>c._c2dGetChild(e,t),getWorldPosition:e=>o(2,t=>c._c2dGetWorldPosition(e,t)),getWorldMatrix:e=>o(6,t=>c._c2dGetWorldMatrix(e,t)),worldToLocal:(e,t,r)=>o(2,i=>c._c2dWorldToLocal(e,t,r,i)),localToWorld:(e,t,r)=>o(2,i=>c._c2dLocalToWorld(e,t,r,i)),getLocalTransform:e=>o(5,t=>c._c2dGetLocalTransform(e,t)),setSprite:(e,t)=>c._c2dSetSprite(e,t),setSpriteFrame:(e,t,r,i,s)=>c._c2dSetSpriteFrame(e,t,r,i,s),setSpriteFramePx:(e,t,r,i,s)=>c._c2dSetSpriteFramePx(e,t,r,i,s),setSpriteSize:(e,t,r)=>c._c2dSetSpriteSize(e,t,r),setSpriteAnchor:(e,t,r)=>c._c2dSetSpriteAnchor(e,t,r),setSpriteColor:(e,t,r,i)=>c._c2dSetSpriteColor(e,t,r,i),setSpriteOpacity:(e,t)=>c._c2dSetSpriteOpacity(e,t),setSpriteFlip:(e,t,r)=>c._c2dSetSpriteFlip(e,h(t),h(r)),createTexture:(e,t,r)=>{try{const i=m(e,"texture",r);if(!i)return;const s=_(i,a=>c._c2dCreateTexture(a,i.length));if(s===0){r(new Error("creator-2d: texture decode failed"));return}t(s,c._c2dGetTextureWidth(s),c._c2dGetTextureHeight(s))}catch(i){r(i)}},getTextureWidth:e=>c._c2dGetTextureWidth(e),getTextureHeight:e=>c._c2dGetTextureHeight(e),destroyTexture:e=>c._c2dDestroyTexture(e),setDefaultFilter:e=>c._c2dSetDefaultFilter(h(e)),whiteTexture:()=>c._c2dWhiteTexture(),createTextureFromCanvas:e=>{const t=T(e);return t?_(t.rgba,r=>c._c2dCreateTextureFromRGBA(r,t.width,t.height)):0},updateTextureFromCanvas:(e,t)=>{const r=T(t);r&&_(r.rgba,i=>c._c2dUpdateTextureFromRGBA(e,i,r.width,r.height))},defineAnimation:(e,t,r,i)=>n(t,s=>c._c2dDefineAnimation(e,s,Math.floor(t.length/4),r,h(i))),playAnimation:(e,t)=>c._c2dPlayAnimation(e,t),stopAnimation:e=>c._c2dStopAnimation(e),setAnimationSpeed:(e,t)=>c._c2dSetAnimationSpeed(e,t),getAnimationFrame:e=>c._c2dGetAnimationFrame(e),createTilemap:(e,t,r,i,s,a,y,d)=>E(d,l=>c._c2dCreateTilemap(e,t,r,i,s,a,y,l)),setTile:(e,t,r,i)=>c._c2dSetTile(e,t,r,i),setPath:(e,t,r,i)=>n(t,s=>c._c2dSetPath(e,s,r,h(i))),pathClearHoles:e=>c._c2dPathClearHoles(e),pathAddHole:(e,t,r)=>n(t,i=>c._c2dPathAddHole(e,i,r)),setPathStroke:(e,t,r,i,s,a,y,d,l)=>c._c2dSetPathStroke(e,t,h(r),i,s,a,y,d,l),setPathFill:(e,t,r,i,s,a)=>c._c2dSetPathFill(e,h(t),r,i,s,a),setPathOutline:(e,t,r,i,s,a)=>c._c2dSetPathOutline(e,t,r,i,s,a),setPathAntialias:(e,t)=>c._c2dSetPathAntialias(e,h(t)),createFont:(e,t,r)=>{try{const i=m(e,"font",r);if(!i)return;const s=_(i,a=>c._c2dCreateFont(a,i.length));if(s===0){r(new Error("creator-2d: not a TTF/OTF font"));return}t(s)}catch(i){r(i)}},destroyFont:e=>c._c2dDestroyFont(e),setText:(e,t,r,i,s)=>S(r,a=>c._c2dSetText(e,t,a,i,h(s))),setTextStyle:(e,t,r,i,s)=>c._c2dSetTextStyle(e,t,r,i,s),setTextColor:(e,t,r,i,s)=>c._c2dSetTextColor(e,t,r,i,s),setTextOutline:(e,t,r,i,s,a)=>c._c2dSetTextOutline(e,t,r,i,s,a),getTextSize:e=>o(2,t=>c._c2dGetTextSize(e,t)),setParticles:(e,t,r,i,s)=>c._c2dSetParticles(e,t,r,i,s),particlesConfig:(e,t)=>n(t,r=>c._c2dParticlesConfig(e,r,t.length)),particlesSpawn:(e,t)=>c._c2dParticlesSpawn(e,t),particlesAlive:e=>c._c2dParticlesAlive(e),bulkSetPositions:(e,t,r)=>A(e,i=>n(t,s=>c._c2dBulkSetPositions(i,s,r))),physicsHasSupport:()=>c._c2dPhysicsHasSupport()!==0,physicsConfigure:(e,t,r,i)=>c._c2dPhysicsConfigure(e,t,r,i),setInterpolation:e=>c._c2dSetInterpolation(h(e)),setOnPhysicsEvent:e=>{c.onPhysicsEvent=e},physicsCreateBody:(e,t)=>c._c2dPhysicsCreateBody(e,t),physicsRemoveBody:e=>c._c2dPhysicsRemoveBody(e),physicsAddBox:(e,t,r,i,s,a,y,d,l,g)=>c._c2dPhysicsAddBox(e,t,r,i,s,a,y,h(d),l,g),physicsAddCircle:(e,t,r,i,s,a,y,d,l)=>c._c2dPhysicsAddCircle(e,t,r,i,s,a,h(y),d,l),physicsAddCapsule:(e,t,r,i,s,a,y,d,l,g,F)=>c._c2dPhysicsAddCapsule(e,t,r,i,s,a,y,d,h(l),g,F),physicsAddSegment:(e,t,r,i,s,a,y,d,l)=>c._c2dPhysicsAddSegment(e,t,r,i,s,a,y,d,l),physicsAddPolygon:(e,t,r,i,s,a,y,d)=>n(t,l=>c._c2dPhysicsAddPolygon(e,l,r,i,s,h(a),y,d)),physicsAddChain:(e,t,r,i,s,a,y,d)=>n(t,l=>c._c2dPhysicsAddChain(e,l,r,h(i),s,a,y,d)),physicsClearShapes:e=>c._c2dPhysicsClearShapes(e),physicsSetContactEvents:(e,t)=>c._c2dPhysicsSetContactEvents(e,h(t)),physicsSetLinearVelocity:(e,t,r)=>c._c2dPhysicsSetLinearVelocity(e,t,r),physicsGetLinearVelocity:e=>o(2,t=>c._c2dPhysicsGetLinearVelocity(e,t)),physicsSetAngularVelocity:(e,t)=>c._c2dPhysicsSetAngularVelocity(e,t),physicsGetAngularVelocity:e=>c._c2dPhysicsGetAngularVelocity(e),physicsApplyLinearImpulse:(e,t,r)=>c._c2dPhysicsApplyLinearImpulse(e,t,r),physicsApplyImpulseAt:(e,t,r,i,s)=>c._c2dPhysicsApplyImpulseAt(e,t,r,i,s),physicsApplyForce:(e,t,r)=>c._c2dPhysicsApplyForce(e,t,r),physicsSetFromEntity:e=>c._c2dPhysicsSetFromEntity(e),physicsSetFixedRotation:(e,t)=>c._c2dPhysicsSetFixedRotation(e,h(t)),physicsSetGravityScale:(e,t)=>c._c2dPhysicsSetGravityScale(e,t),physicsSetLinearDamping:(e,t)=>c._c2dPhysicsSetLinearDamping(e,t),physicsSetAngularDamping:(e,t)=>c._c2dPhysicsSetAngularDamping(e,t),physicsSetBullet:(e,t)=>c._c2dPhysicsSetBullet(e,h(t)),physicsSetEnabled:(e,t)=>c._c2dPhysicsSetEnabled(e,h(t)),physicsSetAwake:(e,t)=>c._c2dPhysicsSetAwake(e,h(t)),physicsSetMass:(e,t)=>c._c2dPhysicsSetMass(e,t),physicsGetMass:e=>c._c2dPhysicsGetMass(e),physicsSetMotionType:(e,t)=>c._c2dPhysicsSetMotionType(e,t),physicsSetFriction:(e,t)=>c._c2dPhysicsSetFriction(e,t),physicsSetBounce:(e,t)=>c._c2dPhysicsSetBounce(e,t),physicsSetFilter:(e,t,r)=>c._c2dPhysicsSetFilter(e,t,r),physicsRaycastClosest:(e,t,r,i,s,a,y)=>n(a,d=>o(7,l=>c._c2dPhysicsRaycastClosest(e,t,r,i,s,d,y,l))),physicsRaycastAll:(e,t,r,i,s,a,y,d)=>{const l=v(d);return n(a,g=>o(l*6,F=>c._c2dPhysicsRaycastAll(e,t,r,i,s,g,y,F,l)*6))},physicsOverlap:(e,t,r,i,s,a,y)=>{const d=v(y);return n(e,l=>n(s,g=>o(d,F=>c._c2dPhysicsOverlap(l,t,r,i,g,a,F,d))))},physicsOverlapPoint:(e,t,r,i,s)=>n(i,a=>c._c2dPhysicsOverlapPoint(e,t,r,a,s)),characterCreate:(e,t,r,i,s,a,y,d,l)=>c._c2dCharacterCreate(e,t,r,i,s,a,y,d,l),characterDestroy:e=>c._c2dCharacterDestroy(e),characterMove:(e,t)=>c._c2dCharacterMove(e,t),characterMoveFree:(e,t,r)=>c._c2dCharacterMoveFree(e,t,r),characterSetVerticalVelocity:(e,t)=>c._c2dCharacterSetVerticalVelocity(e,t),characterSetVelocity:(e,t,r)=>c._c2dCharacterSetVelocity(e,t,r),characterSetGravityScale:(e,t)=>c._c2dCharacterSetGravityScale(e,t),characterSetMaxSlope:(e,t)=>c._c2dCharacterSetMaxSlope(e,t),characterSetFilter:(e,t,r)=>c._c2dCharacterSetFilter(e,t,r),characterSetDropThrough:(e,t)=>c._c2dCharacterSetDropThrough(e,t),characterSetCapsule:(e,t,r,i,s,a)=>c._c2dCharacterSetCapsule(e,t,r,i,s,a)!==0,characterSetFromEntity:e=>c._c2dCharacterSetFromEntity(e),characterGetState:(e,t)=>{const r=o(8,i=>c._c2dCharacterGetState(e,i));t.set(t.length<8?r.subarray(0,t.length):r)},characterGetCollisions:(e,t)=>{const r=v(t);return o(r*3,i=>c._c2dCharacterGetCollisions(e,i,r)*3)},physicsSetOneWay:(e,t,r,i,s)=>c._c2dPhysicsSetOneWay(e,t,r,i,h(s)),pickSprite:(e,t,r)=>c._c2dPickSprite(e,t,r)},render(e){let t=f===0?0:(e-f)/1e3;if(t>.05&&(t=.05),t<0&&(t=0),f=e,P.size)for(const r of[...P])r(t);c._c2dRender(e)},resize(e,t,r){c._c2dSetViewport(Math.max(1,Math.round(e)),Math.max(1,Math.round(t))),c._c2dSetDensity(r>0?r:1)},pointer(e,t,r,i){C==null||C(e,t,r,i)},destroy(){P.clear(),C=null,c.onEarlyUpdate=c.onLateUpdate=void 0,c.onAnimEvent=void 0,c.onPhysicsEvent=void 0,c._c2dShutdown()}}},B=async p=>{const u=p.ownerDocument,c=u.defaultView??window,n=u.createElement("canvas");n.className="lc-scene",n.style.cssText="position: absolute; left: 0; top: 0; display: none; pointer-events: auto; touch-action: none";const A=n.getContext("webgl2",{alpha:!1,depth:!0,stencil:!0,antialias:!1,premultipliedAlpha:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1});if(!A)throw new Error("WebGL2 is not available");const E=await R();let _=-1,S=0,o;const P=e=>{S=0,!(_<0)&&(o.render(e),S=c.requestAnimationFrame(P))},f=()=>{const e=p.clientWidth,t=p.clientHeight;if(e<=0||t<=0)return;const r=c.devicePixelRatio||1;n.width=Math.round(e*r),n.height=Math.round(t*r),n.style.width=`${e}px`,n.style.height=`${t}px`,o.resize(n.width,n.height,r)};o=D(E,{gl:A,bytes:e=>{const t=M(e);return t?new Uint8Array(t):void 0},onOpen:e=>{_=e,n.style.display="block",f(),S||(S=c.requestAnimationFrame(P))},onClose:()=>{_=-1,n.style.display="none",S&&(c.cancelAnimationFrame(S),S=0)}});const C={pointerdown:0,pointermove:1,pointerup:2,pointercancel:3},x=e=>{if(_<0)return;const t=C[e.type];if(t===void 0)return;if(t===0)try{n.setPointerCapture(e.pointerId)}catch{}const r=n.getBoundingClientRect();o.pointer(t,e.pointerId,e.clientX-r.left,e.clientY-r.top)},T=Object.keys(C);let m=null;return{feature:{name:"scene2d",install(){p.insertBefore(n,p.firstChild),f(),m=new ResizeObserver(f),m.observe(p);for(const e of T)n.addEventListener(e,x);return{globals:{_creator2d:o.bridge},destination(e,t){return e.kind!==G?!1:(t?o.bridge.openScene(e.id):_===e.id&&o.bridge.closeScene(),!0)},hit:()=>null,destroy(){m==null||m.disconnect(),m=null;for(const e of T)n.removeEventListener(e,x);_=-1,S&&(c.cancelAnimationFrame(S),S=0),o.destroy(),n.remove()}}}},canvas:n,opened:()=>_,dispose(){S&&c.cancelAnimationFrame(S),o.destroy(),n.remove()}}};export{B as createScene2d};
@@ -1 +1 @@
1
- import{E as U,x as w,y as tt,z as nt,A as G,B as st,C as et}from"../lite.js";const ot=1,rt=4,it=8,lt=9,j=(s,a)=>{if(s.length<10||s[0]!==ot)return null;const l=s[7],i=s[8],d=s[9];let o=10;if(o+i+d*U>s.length)return null;const u=[];for(let f=0;f<i;f++)u.push(s[o++]);const m=[];for(let f=0;f<d;f++){const g=new Float32Array(U);for(let b=0;b<U;b++)g[b]=s[o++];m.push(g)}const c=f=>f>=0?a[f]:void 0,p=[];for(let f=0;f<l;f++){if(o+10>s.length)return null;const g=s[o+3],b=s[o+4],y=s[o+8],v={domain:s[o],target:s[o+1],prop:c(s[o+2])??"",kind:g,lanes:b,sig:c(s[o+9]),atMs:s[o+5],durMs:s[o+6],commit:s[o+7]!==0,keys:[]};if(o+=10,o+y*(7+b)>s.length)return null;const k=g===rt||g===it||g===lt;for(let O=0;O<y;O++){const _=s[o+1],x=[s[o+2],s[o+3],s[o+4],s[o+5]],S=_===tt?{kind:_,p:x,table:m[x[0]]}:{kind:_,p:x},L={t:s[o],easing:S};if(s[o+6]!==0)if(k)L.value={str:c(s[o+7])??""};else{const D=[];for(let F=0;F<b;F++)D.push(s[o+7+F]);L.value={lanes:D}}o+=7+b,v.keys.push(L)}p.push(v)}return o!==s.length?null:{clock:s[1],durationMs:s[2],delayMs:s[3],iterations:s[4],pingPong:s[5]!==0,rate:s[6],calls:u,tracks:p}},at=6,ct=11,H=(s,a,l,i,d)=>{let o=i[a]??0,u=i[a+1]??0,m=i[a+2]??0,c=i[a+3]??1;const p=l[a]??0,f=l[a+1]??0,g=l[a+2]??0,b=l[a+3]??1;let y=p*o+f*u+g*m+b*c;y<0&&(y=-y,o=-o,u=-u,m=-m,c=-c);let v=1-d,k=d;if(1-y>1e-6){const O=Math.acos(Math.min(1,y)),_=Math.sin(O);v=Math.sin((1-d)*O)/_,k=Math.sin(d*O)/_}s[a]=v*p+k*o,s[a+1]=v*f+k*u,s[a+2]=v*g+k*m,s[a+3]=v*b+k*c},q=(s,a)=>{const l=s.keys;if(l.length===0)return null;const i=s.durMs<=0?a>=s.atMs?1:0:Math.min(1,Math.max(0,(a-s.atMs)/s.durMs)),d=l[0],o=l[l.length-1];if(l.length===1||i<=d.t)return{from:d,to:d,s:0};if(i>=o.t)return{from:o,to:o,s:0};let u=0;for(;u+1<l.length&&l[u+1].t<=i;)u++;const m=l[u],c=l[u+1],p=c.t-m.t;return{from:m,to:c,s:w(m.easing,p>0?(i-m.t)/p:1)}},ft=(s,a,l)=>{const i=q(s,a);if(!i)return;const d=p=>p.value&&"lanes"in p.value?p.value.lanes:[],o=d(i.from),u=d(i.to),m=i.s,c=(p,f)=>{for(let g=p;g<f;g++)l[g]=(o[g]??0)+((u[g]??0)-(o[g]??0))*m};if(s.kind===at){H(l,0,o,u,m);return}if(s.kind===ct){c(0,3),H(l,3,o,u,m),c(7,10);return}c(0,s.lanes)},ut=0,gt=6,mt=0,pt=1,dt=2,ht=3,Mt=0,yt=1,bt=2,kt=3,Et=4,Tt=0,vt=1,_t=2,Ot=0,Nt=1,At=2,It=3,xt=1,Rt={translate:{args:2,unit:"px"},translateX:{args:1,unit:"px"},translateY:{args:1,unit:"px"},"translate%":{args:2,unit:"%"},"translateX%":{args:1,unit:"%"},"translateY%":{args:1,unit:"%"},rotate:{args:1,unit:"deg"},skewX:{args:1,unit:"deg"},skewY:{args:1,unit:"deg"},scale:{args:2,unit:""},scaleX:{args:1,unit:""},scaleY:{args:1,unit:""}},K=s=>Math.round(s*1e4)/1e4,St=(s,a)=>{const l=[];let i=0;for(const d of s.split(",").filter(Boolean)){const o=Rt[d];if(!o)continue;const u=a.slice(i,i+o.args).map(m=>`${K(m)}${o.unit}`);i+=o.args,l.push(`${d.replace("%","")}(${u.join(", ")})`)}return l.length>0?l.join(" "):"none"},Q=(s,a)=>{const l=a.value;if(!l)return;if("str"in l)return l.str;const i=l.lanes;switch(s.kind){case mt:return K(i[0]??0);case pt:return`${K(i[0]??0)}${s.sig??""}`;case dt:{const[d=0,o=0,u=0,m=1]=i,c=p=>Math.max(0,Math.min(255,Math.round(p*255)));return`rgba(${c(d)}, ${c(o)}, ${c(u)}, ${K(Math.max(0,Math.min(1,m)))})`}case ht:return St(s.sig??"",i);default:return i[0]}},Lt=s=>s.startsWith("--")?s:s==="float"?"cssFloat":s.replace(/-([a-z])/g,(a,l)=>l.toUpperCase()),Ct=(s,a,l,i)=>{const d=s.keys.map(f=>{const g=Q(s,f);return g===void 0?null:l(g)}),o=new Set;for(const f of d)if(f)for(const g of f.keys())o.add(g);if(o.size===0)return null;const u=f=>a>0?Math.min(1,Math.max(0,(s.atMs+f*s.durMs)/a)):f<=0?0:1,m=(f,g,b)=>{var v;const y={offset:g,easing:b};for(const k of o)y[Lt(k)]=((v=d[f])==null?void 0:v.get(k))??i(k);return y},c=[];let p=0;return s.keys.forEach((f,g)=>{p=Math.max(p,u(f.t)),c.push(m(g,p,nt(f.easing)))}),c.length===0?null:(c[0].offset>0&&c.unshift(m(0,0,"linear")),c[c.length-1].offset<1&&c.push(m(s.keys.length-1,1,"linear")),c)},Dt=new Set(["text","src","value"]),Ft=s=>{const a=s.root.ownerDocument,l=a.defaultView??window,i=new Map;let d=1,o=null;const u=new Map,m=(t,e)=>`${t.id}:${e}`,c=t=>t.pingPong&&t.iterations!==1,p=t=>t.iterations<0?1/0:Math.max(1,t.iterations)*(c(t)?2:1),f=t=>({duration:Math.max(0,t.durationMs),delay:Math.max(0,t.delayMs),iterations:p(t),direction:c(t)?"alternate":"normal",fill:"both",easing:"linear"}),g=t=>{var n;const e=(n=t.clock)==null?void 0:n.currentTime;return typeof e=="number"?Math.max(0,e-Math.max(0,t.blob.delayMs)):0},b=t=>{var n,r;const e=(r=(n=t.clock)==null?void 0:n.effect)==null?void 0:r.getComputedTiming().progress;return typeof e=="number"?e*t.blob.durationMs:0},y=t=>{const e=t.clock?[t.clock]:[];for(const n of t.parts)n.animation&&e.push(n.animation);return e},v=(t,e)=>{if(e==="overlayColor"&&t.type==="widget"){const n=s.scrim(t);return n?{el:n,css:r=>new Map([["background-color",st(r)]])}:null}return{el:t.el,css:n=>et([[e,n]],s.style)}},k=t=>{var n;(n=t.animation)==null||n.cancel(),t.animation=null;const e=m(t.node,t.prop);u.get(e)===t&&u.delete(e)},O=t=>{if(t.clock)return;const e=t.blob;s.flush(),t.clock=new l.Animation(new l.KeyframeEffect(null,null,f(e)),a.timeline);for(const n of e.tracks){const r=t.nodes[n.target]??null;if(n.domain===gt){t.driven.push({track:n,node:null,slot:t.slots[n.target]??0,last:null});continue}if(n.domain!==ut||!r)continue;if(Dt.has(n.prop)){t.driven.push({track:n,node:r,slot:0,last:null});continue}const h=G(n.prop),M=v(r,h);if(!M)continue;let E=null;const N=Ct(n,e.durationMs,M.css,A=>(E??(E=l.getComputedStyle(M.el))).getPropertyValue(A).trim());if(!N)continue;const R={track:n,node:r,el:M.el,prop:h,animation:null};try{R.animation=new l.Animation(new l.KeyframeEffect(M.el,N,f(e)),a.timeline)}catch(A){s.warn(`tween: "${n.prop}" cannot be animated here (${A instanceof Error?A.message:A})`);continue}const T=m(r,h),I=u.get(T);I&&k(I),u.set(T,R),t.parts.push(R)}t.clock.onfinish=()=>{i.get(t.id)===t&&t.playing&&V(t)}};let _=0;const x=[],S=t=>{if(t.driven.length===0)return;const e=b(t);for(const n of t.driven){if(n.node){const r=q(n.track,e),h=r&&(r.s>=1?r.to:r.from).value,M=h&&"str"in h?h.str:null;M!==null&&M!==n.last&&(n.last=M,s.setString(n.node.id,n.track.prop,M));continue}x.length=n.track.lanes,ft(n.track,e,x),o==null||o(t.id,_t,n.slot,...x)}},L=t=>{const e=t.blob,n=g(t),r=t.reached;if(t.reached=n,e.calls.length===0||!(e.durationMs>0)||n<=r)return;const h=e.durationMs,M=Math.min(Math.floor(n/h),p(e)-1);for(let E=Math.floor(r/h);E<=M;E++){const N=c(e)&&E%2===1,R=e.calls.map((T,I)=>({at:E*h+(N?h-T:T),index:I})).sort((T,I)=>T.at-I.at);for(const T of R){if(!i.has(t.id))return;(T.at>r||r===0&&T.at===0)&&T.at<=n&&(o==null||o(t.id,Tt,T.index))}}},D=t=>t.playing&&t.onEnd===null&&(t.driven.length>0||t.blob.calls.length>0),F=()=>{_=0;for(const t of[...i.values()])!D(t)||i.get(t.id)!==t||(S(t),L(t));P()};function P(){if(_===0){for(const t of i.values())if(D(t)){_=l.requestAnimationFrame(F);return}}}const C=t=>{var e;i.delete(t.id),t.clock&&(t.clock.onfinish=null);for(const n of t.parts)k(n);(e=t.clock)==null||e.cancel(),t.playing=!1};function V(t){if(t.clock&&t.driven.length>0){try{t.clock.finish()}catch{}S(t)}if(t.blob.calls.length>0&&Number.isFinite(p(t.blob))){const n=t.blob.durationMs*p(t.blob);if(t.clock)try{t.clock.currentTime=Math.max(0,t.blob.delayMs)+n}catch{}L(t)}if(!i.has(t.id))return;const e=t.parts.filter(n=>n.animation&&n.track.commit);C(t);for(const n of e){const r=n.track.keys[n.track.keys.length-1],h=r&&Q(n.track,r);h!==void 0&&s.setStyle(n.node,n.prop,h)}t.onEnd?t.onEnd():o==null||o(t.id,vt,0)}const z=t=>{O(t),t.playing=!0,t.reached=0;const n=t.rate<0&&Number.isFinite(p(t.blob))?Math.max(0,t.blob.delayMs)+t.blob.durationMs*p(t.blob):0;for(const r of y(t))r.playbackRate=t.rate,r.currentTime=n,r.play();t.driven.length>0&&s.post(()=>{i.get(t.id)===t&&t.playing&&S(t)}),P()},W=(t,e)=>{O(t);const n=Math.max(0,t.blob.delayMs)+Math.max(0,e);for(const r of y(t))r.currentTime=n;t.reached=Math.max(0,e),S(t)},X=(t,e,n)=>{const r={id:d++,blob:t,nodes:e,slots:n,parts:[],driven:[],clock:null,rate:t.rate,playing:!1,reached:0,onEnd:null};return i.set(r.id,r),r},Z=new FinalizationRegistry(t=>{const e=i.get(t);e&&!e.playing&&C(e)}),$=new Map;let J=1;return{stage:()=>{let t=null;const e={run(n,r,h,M){e.settle();const E=$.get(h);if(!E||!n&&!r){M();return}const N=!!n&&!!r,R=N?Ot:At,T=N?Nt:It,I=E.roles.map(Y=>Y===R?n:Y===T?r:null),A=X(E.blob,I,[]),B=t={tween:A,leaving:r,onEnd:M};A.onEnd=()=>{t===B&&(t=null),B.onEnd()},z(A),A.parts.length===0&&(C(A),A.onEnd())},settle(){const n=t;n&&(t=null,C(n.tween),n.onEnd())},enterOnTop:n=>{var r;return((r=$.get(n))==null?void 0:r.enterOnTop)??!0},holds:n=>(t==null?void 0:t.leaving)===n};return e},bridge:{defineTransition(t,e,n,r){const h=j(t,e);if(!h||h.tracks.some(E=>E.target>=n.length))return 0;const M=J++;return $.set(M,{blob:h,roles:n.slice(),enterOnTop:(r&xt)!==0}),M},tweenCreate(t,e,n){const r=j(t,e);if(!r)return null;const h=Array.from(n,N=>typeof N=="number"?N:0),M=X(r,h.map(N=>s.node(N)??null),h),E={id:M.id};return Z.register(E,M.id),E},tweenControl(t,e){const n=i.get(t);if(n)switch(e){case Mt:z(n);break;case yt:O(n),n.playing=!1;for(const r of y(n))r.pause();break;case bt:O(n),n.playing=!0;for(const r of y(n))r.play();P();break;case kt:C(n);break;case Et:O(n),n.playing=!0,V(n);break}},tweenSeek(t,e){const n=i.get(t);n&&W(n,e)},tweenSetRate(t,e){const n=i.get(t);if(n){n.rate=e;for(const r of y(n))r.playbackRate=e}},tweenGetTime:t=>{const e=i.get(t);return e?b(e):0},tweenGetElapsed:t=>{const e=i.get(t);return e?g(e):0},registerTweenEvent(t){o=t}},styled(t,e){const n=u.get(m(t,G(e)));n&&k(n)},forget(t){for(const e of i.values()){for(const n of e.parts)n.node===t&&k(n);e.driven=e.driven.filter(n=>n.node!==t),e.nodes=e.nodes.map(n=>n===t?null:n)}},count:()=>i.size,destroy(){_!==0&&l.cancelAnimationFrame(_),_=0;for(const t of[...i.values()])C(t);u.clear(),$.clear(),o=null}}},Pt={name:"tween",install(s){const a=Ft(s);return{bridge:a.bridge,stage:a.stage,styled:a.styled,forget:a.forget,destroy:a.destroy,stats:()=>({tweens:a.count()})}}};export{Pt as tween};
1
+ import{E as U,y as w,z as tt,A as nt,B as G,C as st,D as et}from"../lite.js";const ot=1,rt=4,it=8,lt=9,j=(s,a)=>{if(s.length<10||s[0]!==ot)return null;const l=s[7],i=s[8],d=s[9];let o=10;if(o+i+d*U>s.length)return null;const u=[];for(let f=0;f<i;f++)u.push(s[o++]);const m=[];for(let f=0;f<d;f++){const g=new Float32Array(U);for(let b=0;b<U;b++)g[b]=s[o++];m.push(g)}const c=f=>f>=0?a[f]:void 0,p=[];for(let f=0;f<l;f++){if(o+10>s.length)return null;const g=s[o+3],b=s[o+4],y=s[o+8],v={domain:s[o],target:s[o+1],prop:c(s[o+2])??"",kind:g,lanes:b,sig:c(s[o+9]),atMs:s[o+5],durMs:s[o+6],commit:s[o+7]!==0,keys:[]};if(o+=10,o+y*(7+b)>s.length)return null;const k=g===rt||g===it||g===lt;for(let O=0;O<y;O++){const _=s[o+1],R=[s[o+2],s[o+3],s[o+4],s[o+5]],S=_===tt?{kind:_,p:R,table:m[R[0]]}:{kind:_,p:R},L={t:s[o],easing:S};if(s[o+6]!==0)if(k)L.value={str:c(s[o+7])??""};else{const D=[];for(let F=0;F<b;F++)D.push(s[o+7+F]);L.value={lanes:D}}o+=7+b,v.keys.push(L)}p.push(v)}return o!==s.length?null:{clock:s[1],durationMs:s[2],delayMs:s[3],iterations:s[4],pingPong:s[5]!==0,rate:s[6],calls:u,tracks:p}},at=6,ct=11,H=(s,a,l,i,d)=>{let o=i[a]??0,u=i[a+1]??0,m=i[a+2]??0,c=i[a+3]??1;const p=l[a]??0,f=l[a+1]??0,g=l[a+2]??0,b=l[a+3]??1;let y=p*o+f*u+g*m+b*c;y<0&&(y=-y,o=-o,u=-u,m=-m,c=-c);let v=1-d,k=d;if(1-y>1e-6){const O=Math.acos(Math.min(1,y)),_=Math.sin(O);v=Math.sin((1-d)*O)/_,k=Math.sin(d*O)/_}s[a]=v*p+k*o,s[a+1]=v*f+k*u,s[a+2]=v*g+k*m,s[a+3]=v*b+k*c},q=(s,a)=>{const l=s.keys;if(l.length===0)return null;const i=s.durMs<=0?a>=s.atMs?1:0:Math.min(1,Math.max(0,(a-s.atMs)/s.durMs)),d=l[0],o=l[l.length-1];if(l.length===1||i<=d.t)return{from:d,to:d,s:0};if(i>=o.t)return{from:o,to:o,s:0};let u=0;for(;u+1<l.length&&l[u+1].t<=i;)u++;const m=l[u],c=l[u+1],p=c.t-m.t;return{from:m,to:c,s:w(m.easing,p>0?(i-m.t)/p:1)}},ft=(s,a,l)=>{const i=q(s,a);if(!i)return;const d=p=>p.value&&"lanes"in p.value?p.value.lanes:[],o=d(i.from),u=d(i.to),m=i.s,c=(p,f)=>{for(let g=p;g<f;g++)l[g]=(o[g]??0)+((u[g]??0)-(o[g]??0))*m};if(s.kind===at){H(l,0,o,u,m);return}if(s.kind===ct){c(0,3),H(l,3,o,u,m),c(7,10);return}c(0,s.lanes)},ut=0,gt=6,mt=0,pt=1,dt=2,ht=3,Mt=0,yt=1,bt=2,kt=3,Et=4,Tt=0,vt=1,_t=2,Ot=0,Nt=1,At=2,It=3,Rt=1,xt={translate:{args:2,unit:"px"},translateX:{args:1,unit:"px"},translateY:{args:1,unit:"px"},"translate%":{args:2,unit:"%"},"translateX%":{args:1,unit:"%"},"translateY%":{args:1,unit:"%"},rotate:{args:1,unit:"deg"},skewX:{args:1,unit:"deg"},skewY:{args:1,unit:"deg"},scale:{args:2,unit:""},scaleX:{args:1,unit:""},scaleY:{args:1,unit:""}},K=s=>Math.round(s*1e4)/1e4,St=(s,a)=>{const l=[];let i=0;for(const d of s.split(",").filter(Boolean)){const o=xt[d];if(!o)continue;const u=a.slice(i,i+o.args).map(m=>`${K(m)}${o.unit}`);i+=o.args,l.push(`${d.replace("%","")}(${u.join(", ")})`)}return l.length>0?l.join(" "):"none"},Q=(s,a)=>{const l=a.value;if(!l)return;if("str"in l)return l.str;const i=l.lanes;switch(s.kind){case mt:return K(i[0]??0);case pt:return`${K(i[0]??0)}${s.sig??""}`;case dt:{const[d=0,o=0,u=0,m=1]=i,c=p=>Math.max(0,Math.min(255,Math.round(p*255)));return`rgba(${c(d)}, ${c(o)}, ${c(u)}, ${K(Math.max(0,Math.min(1,m)))})`}case ht:return St(s.sig??"",i);default:return i[0]}},Lt=s=>s.startsWith("--")?s:s==="float"?"cssFloat":s.replace(/-([a-z])/g,(a,l)=>l.toUpperCase()),Ct=(s,a,l,i)=>{const d=s.keys.map(f=>{const g=Q(s,f);return g===void 0?null:l(g)}),o=new Set;for(const f of d)if(f)for(const g of f.keys())o.add(g);if(o.size===0)return null;const u=f=>a>0?Math.min(1,Math.max(0,(s.atMs+f*s.durMs)/a)):f<=0?0:1,m=(f,g,b)=>{var v;const y={offset:g,easing:b};for(const k of o)y[Lt(k)]=((v=d[f])==null?void 0:v.get(k))??i(k);return y},c=[];let p=0;return s.keys.forEach((f,g)=>{p=Math.max(p,u(f.t)),c.push(m(g,p,nt(f.easing)))}),c.length===0?null:(c[0].offset>0&&c.unshift(m(0,0,"linear")),c[c.length-1].offset<1&&c.push(m(s.keys.length-1,1,"linear")),c)},Dt=new Set(["text","src","value"]),Ft=s=>{const a=s.root.ownerDocument,l=a.defaultView??window,i=new Map;let d=1,o=null;const u=new Map,m=(t,e)=>`${t.id}:${e}`,c=t=>t.pingPong&&t.iterations!==1,p=t=>t.iterations<0?1/0:Math.max(1,t.iterations)*(c(t)?2:1),f=t=>({duration:Math.max(0,t.durationMs),delay:Math.max(0,t.delayMs),iterations:p(t),direction:c(t)?"alternate":"normal",fill:"both",easing:"linear"}),g=t=>{var n;const e=(n=t.clock)==null?void 0:n.currentTime;return typeof e=="number"?Math.max(0,e-Math.max(0,t.blob.delayMs)):0},b=t=>{var n,r;const e=(r=(n=t.clock)==null?void 0:n.effect)==null?void 0:r.getComputedTiming().progress;return typeof e=="number"?e*t.blob.durationMs:0},y=t=>{const e=t.clock?[t.clock]:[];for(const n of t.parts)n.animation&&e.push(n.animation);return e},v=(t,e)=>{if(e==="overlayColor"&&t.type==="widget"){const n=s.scrim(t);return n?{el:n,css:r=>new Map([["background-color",st(r)]])}:null}return{el:t.el,css:n=>et([[e,n]],s.style)}},k=t=>{var n;(n=t.animation)==null||n.cancel(),t.animation=null;const e=m(t.node,t.prop);u.get(e)===t&&u.delete(e)},O=t=>{if(t.clock)return;const e=t.blob;s.flush(),t.clock=new l.Animation(new l.KeyframeEffect(null,null,f(e)),a.timeline);for(const n of e.tracks){const r=t.nodes[n.target]??null;if(n.domain===gt){t.driven.push({track:n,node:null,slot:t.slots[n.target]??0,last:null});continue}if(n.domain!==ut||!r)continue;if(Dt.has(n.prop)){t.driven.push({track:n,node:r,slot:0,last:null});continue}const h=G(n.prop),M=v(r,h);if(!M)continue;let E=null;const N=Ct(n,e.durationMs,M.css,A=>(E??(E=l.getComputedStyle(M.el))).getPropertyValue(A).trim());if(!N)continue;const x={track:n,node:r,el:M.el,prop:h,animation:null};try{x.animation=new l.Animation(new l.KeyframeEffect(M.el,N,f(e)),a.timeline)}catch(A){s.warn(`tween: "${n.prop}" cannot be animated here (${A instanceof Error?A.message:A})`);continue}const T=m(r,h),I=u.get(T);I&&k(I),u.set(T,x),t.parts.push(x)}t.clock.onfinish=()=>{i.get(t.id)===t&&t.playing&&V(t)}};let _=0;const R=[],S=t=>{if(t.driven.length===0)return;const e=b(t);for(const n of t.driven){if(n.node){const r=q(n.track,e),h=r&&(r.s>=1?r.to:r.from).value,M=h&&"str"in h?h.str:null;M!==null&&M!==n.last&&(n.last=M,s.setString(n.node.id,n.track.prop,M));continue}R.length=n.track.lanes,ft(n.track,e,R),o==null||o(t.id,_t,n.slot,...R)}},L=t=>{const e=t.blob,n=g(t),r=t.reached;if(t.reached=n,e.calls.length===0||!(e.durationMs>0)||n<=r)return;const h=e.durationMs,M=Math.min(Math.floor(n/h),p(e)-1);for(let E=Math.floor(r/h);E<=M;E++){const N=c(e)&&E%2===1,x=e.calls.map((T,I)=>({at:E*h+(N?h-T:T),index:I})).sort((T,I)=>T.at-I.at);for(const T of x){if(!i.has(t.id))return;(T.at>r||r===0&&T.at===0)&&T.at<=n&&(o==null||o(t.id,Tt,T.index))}}},D=t=>t.playing&&t.onEnd===null&&(t.driven.length>0||t.blob.calls.length>0),F=()=>{_=0;for(const t of[...i.values()])!D(t)||i.get(t.id)!==t||(S(t),L(t));P()};function P(){if(_===0){for(const t of i.values())if(D(t)){_=l.requestAnimationFrame(F);return}}}const C=t=>{var e;i.delete(t.id),t.clock&&(t.clock.onfinish=null);for(const n of t.parts)k(n);(e=t.clock)==null||e.cancel(),t.playing=!1};function V(t){if(t.clock&&t.driven.length>0){try{t.clock.finish()}catch{}S(t)}if(t.blob.calls.length>0&&Number.isFinite(p(t.blob))){const n=t.blob.durationMs*p(t.blob);if(t.clock)try{t.clock.currentTime=Math.max(0,t.blob.delayMs)+n}catch{}L(t)}if(!i.has(t.id))return;const e=t.parts.filter(n=>n.animation&&n.track.commit);C(t);for(const n of e){const r=n.track.keys[n.track.keys.length-1],h=r&&Q(n.track,r);h!==void 0&&s.setStyle(n.node,n.prop,h)}t.onEnd?t.onEnd():o==null||o(t.id,vt,0)}const z=t=>{O(t),t.playing=!0,t.reached=0;const n=t.rate<0&&Number.isFinite(p(t.blob))?Math.max(0,t.blob.delayMs)+t.blob.durationMs*p(t.blob):0;for(const r of y(t))r.playbackRate=t.rate,r.currentTime=n,r.play();t.driven.length>0&&s.post(()=>{i.get(t.id)===t&&t.playing&&S(t)}),P()},W=(t,e)=>{O(t);const n=Math.max(0,t.blob.delayMs)+Math.max(0,e);for(const r of y(t))r.currentTime=n;t.reached=Math.max(0,e),S(t)},X=(t,e,n)=>{const r={id:d++,blob:t,nodes:e,slots:n,parts:[],driven:[],clock:null,rate:t.rate,playing:!1,reached:0,onEnd:null};return i.set(r.id,r),r},Z=new FinalizationRegistry(t=>{const e=i.get(t);e&&!e.playing&&C(e)}),$=new Map;let J=1;return{stage:()=>{let t=null;const e={run(n,r,h,M){e.settle();const E=$.get(h);if(!E||!n&&!r){M();return}const N=!!n&&!!r,x=N?Ot:At,T=N?Nt:It,I=E.roles.map(Y=>Y===x?n:Y===T?r:null),A=X(E.blob,I,[]),B=t={tween:A,leaving:r,onEnd:M};A.onEnd=()=>{t===B&&(t=null),B.onEnd()},z(A),A.parts.length===0&&(C(A),A.onEnd())},settle(){const n=t;n&&(t=null,C(n.tween),n.onEnd())},enterOnTop:n=>{var r;return((r=$.get(n))==null?void 0:r.enterOnTop)??!0},holds:n=>(t==null?void 0:t.leaving)===n};return e},bridge:{defineTransition(t,e,n,r){const h=j(t,e);if(!h||h.tracks.some(E=>E.target>=n.length))return 0;const M=J++;return $.set(M,{blob:h,roles:n.slice(),enterOnTop:(r&Rt)!==0}),M},tweenCreate(t,e,n){const r=j(t,e);if(!r)return null;const h=Array.from(n,N=>typeof N=="number"?N:0),M=X(r,h.map(N=>s.node(N)??null),h),E={id:M.id};return Z.register(E,M.id),E},tweenControl(t,e){const n=i.get(t);if(n)switch(e){case Mt:z(n);break;case yt:O(n),n.playing=!1;for(const r of y(n))r.pause();break;case bt:O(n),n.playing=!0;for(const r of y(n))r.play();P();break;case kt:C(n);break;case Et:O(n),n.playing=!0,V(n);break}},tweenSeek(t,e){const n=i.get(t);n&&W(n,e)},tweenSetRate(t,e){const n=i.get(t);if(n){n.rate=e;for(const r of y(n))r.playbackRate=e}},tweenGetTime:t=>{const e=i.get(t);return e?b(e):0},tweenGetElapsed:t=>{const e=i.get(t);return e?g(e):0},registerTweenEvent(t){o=t}},styled(t,e){const n=u.get(m(t,G(e)));n&&k(n)},forget(t){for(const e of i.values()){for(const n of e.parts)n.node===t&&k(n);e.driven=e.driven.filter(n=>n.node!==t),e.nodes=e.nodes.map(n=>n===t?null:n)}},count:()=>i.size,destroy(){_!==0&&l.cancelAnimationFrame(_),_=0;for(const t of[...i.values()])C(t);u.clear(),$.clear(),o=null}}},Pt={name:"tween",install(s){const a=Ft(s);return{bridge:a.bridge,stage:a.stage,styled:a.styled,forget:a.forget,destroy:a.destroy,stats:()=>({tweens:a.count()})}}};export{Pt as tween};
@@ -1 +1 @@
1
- import{F as d,d as p}from"../lite.js";const m="opacity: 0; position: absolute; top: 0; left: 0; width: 1px; height: 1px",y={name:"video",install(l){const a=l.root.ownerDocument,r=new Map;let t=null,s=null;const c=(e,n)=>{if(e.parentElement===n)return;const o=n;if(o.moveBefore&&e.isConnected&&n.isConnected)try{o.moveBefore(e,null);return}catch{}const i=!e.paused;n.appendChild(e),i&&e.paused&&e.play().catch(()=>{})},u=(e,n)=>{const o=p(n),i=r.get(e);i!==o&&(i&&f(e),o instanceof HTMLVideoElement&&(r.set(e,o),o.style.cssText="",o.className="lc-video-picture",c(o,s===e&&t?t:e.el)))};function f(e){const n=r.get(e);n&&(r.delete(e),n.className="",n.style.cssText=m,n.isConnected&&c(n,a.body))}return{content(e,n,o){e.type==="video"&&n==="playerId"&&u(e,Number(o))},destination(e,n){const o=e.node;if(e.kind!==d||!o)return!1;const i=r.get(o);return n?(t||(t=a.createElement("div"),t.className="lc-video-full"),t.parentElement!==l.root&&l.root.insertBefore(t,l.root.firstChild),s=o,i&&c(i,t),!0):(s===o&&(s=null,i&&c(i,o.el),t==null||t.remove()),!0)},forget(e){s===e&&(s=null,t==null||t.remove()),f(e)},destroy(){for(const e of[...r.keys()])f(e);t==null||t.remove(),t=null,s=null}}}};export{y as video};
1
+ import{G as d,d as p}from"../lite.js";const m="opacity: 0; position: absolute; top: 0; left: 0; width: 1px; height: 1px",y={name:"video",install(l){const a=l.root.ownerDocument,r=new Map;let t=null,s=null;const c=(e,n)=>{if(e.parentElement===n)return;const o=n;if(o.moveBefore&&e.isConnected&&n.isConnected)try{o.moveBefore(e,null);return}catch{}const i=!e.paused;n.appendChild(e),i&&e.paused&&e.play().catch(()=>{})},u=(e,n)=>{const o=p(n),i=r.get(e);i!==o&&(i&&f(e),o instanceof HTMLVideoElement&&(r.set(e,o),o.style.cssText="",o.className="lc-video-picture",c(o,s===e&&t?t:e.el)))};function f(e){const n=r.get(e);n&&(r.delete(e),n.className="",n.style.cssText=m,n.isConnected&&c(n,a.body))}return{content(e,n,o){e.type==="video"&&n==="playerId"&&u(e,Number(o))},destination(e,n){const o=e.node;if(e.kind!==d||!o)return!1;const i=r.get(o);return n?(t||(t=a.createElement("div"),t.className="lc-video-full"),t.parentElement!==l.root&&l.root.insertBefore(t,l.root.firstChild),s=o,i&&c(i,t),!0):(s===o&&(s=null,i&&c(i,o.el),t==null||t.remove()),!0)},forget(e){s===e&&(s=null,t==null||t.remove()),f(e)},destroy(){for(const e of[...r.keys()])f(e);t==null||t.remove(),t=null,s=null}}}};export{y as video};
@@ -1 +1 @@
1
- import{u as W,w as B}from"../lite.js";const F=(m,c)=>{let d=[],l=[];const r=new Map,f=new Map,a=new Set;let e=[0],o=0,t=0,i=0,y=0,w=!0,O=!1,v=!1,p=!1,M=!1,K=!0;const I=n=>f.get(d[n])??l[n],E=n=>{o=Math.min(o,n)},N=()=>{const n=d.length;e.length=n+1,o>n&&(o=n),o===0&&(e[0]=0);for(let s=o;s<n;s++)e[s+1]=e[s]+I(s);o=n},L=()=>(N(),e[d.length]??0),k=n=>{for(let s=n;s<d.length;s++)r.set(d[s],s)},C=()=>m.inverted?Math.max(0,y-L()):0,_=()=>Math.max(0,L()-y),R=()=>{N();const n=d.length;if(n===0||y<=0)return[-1,-2];const s=m.overscan<0?y:m.overscan,u=t-s,h=t+y+s;let T=0,g=n;for(;T<g;){const S=T+g>>1;e[S+1]>u?g=S:T=S+1}const x=Math.min(T,n-1);for(T=0,g=n;T<g;){const S=T+g>>1;e[S]<h?T=S+1:g=S}return[Math.max(x,0),Math.min(T-1,n-1)]},H=()=>{m.endThreshold>0&&(L()-(t+y)<=m.endThreshold?O||(O=!0,c.edge(!0)):O=!1),m.startThreshold>0&&(t<=m.startThreshold?v||(v=!0,c.edge(!1)):v=!1)},z=()=>{if(p){M=!0;return}p=!0;try{for(let n=0;n<4;n++){M=!1;const[s,u]=R(),h=[],T=[];for(const g of a){const x=r.get(g);(x===void 0||x<s||x>u)&&h.push(g)}for(let g=s;g<=u;g++)a.has(d[g])||T.push(d[g]);if(h.length===0&&T.length===0||(c.sync(h,T),!M))break}}finally{p=!1}},b=n=>{t=Math.max(0,Math.min(n,_())),c.adjust(t)},D=(n,s,u)=>{const h=I(s);if(f.set(n,u),Math.abs(u-h)<=.5)return;N();const T=e[s];E(s),T<t?b(t+(u-h)):m.inverted&&w&&b(_()),M=!0};return{setKeys(n,s){d=n.slice(),l=d.map((u,h)=>s[h]??0),r.clear(),k(0),E(0),b(t),z(),H()},insertKeys(n,s,u){if(s.length===0)return;const h=d.length;(n<0||n>h)&&(n=h);const T=h>0,g=n===h;let x=0;s.forEach((V,A)=>{x+=f.get(V)??u[A]??0}),d.splice(n,0,...s),l.splice(n,0,...s.map((V,A)=>u[A]??0)),k(n),E(n);const S=w;N(),T&&!g&&e[n]<=t+.5&&b(t+x),m.inverted&&S&&g&&(b(_()),w=!0),z(),H()},removeKeys(n){let s=0;N();for(const u of n){const h=r.get(u);h!==void 0&&(e[h+1]<=t&&(s+=I(h)),d.splice(h,1),l.splice(h,1),r.delete(u),f.delete(u),k(h),E(h),N())}b(s>0?t-s:t),z(),H()},invalidate(n){if(!(!a.has(n)||p)){p=!0;try{c.sync([n],[n])}finally{p=!1}M&&(M=!1,z())}},mounted(n,s){const u=r.get(n);u!==void 0&&(a.add(n),D(n,u,s))},unmounted(n){a.delete(n)},isMounted:n=>a.has(n),resized(n,s){const u=r.get(n);u===void 0||!a.has(n)||(D(n,u,s),M&&!p&&(M=!1,z()))},scrolled(n){t=Math.max(0,n),w=t+y>=L()-2,z(),H()},viewport(n,s,u){if(!(n>0)||!(s>0))return;const h=Math.abs(n-i)>.5,T=Math.abs(s-y)>.5;if(i=n,y=s,L()<=y&&(w=!0),h){E(0);for(const g of a)f.set(g,u(g))}K?(K=!1,m.inverted&&(b(_()),w=!0)):m.inverted&&w&&T?b(_()):h&&b(t),z()},offsetOf(n){const s=r.get(n);return s===void 0?NaN:(N(),C()+e[s])},mountedTop(){let n=-1;for(const s of a){const u=r.get(s);u!==void 0&&(n<0||u<n)&&(n=u)}return N(),C()+(n<0?0:e[n])},indexOf:n=>r.get(n)??-1,contentHeight:()=>m.inverted?Math.max(L(),y):L(),maxScroll:_,scrollY:()=>t,mountedKeys:()=>[...a]}},$=m=>{const c=new Map,d=new Map,l=e=>{e.content.style.minHeight=`${e.window.contentHeight()}px`,e.content.style.paddingTop=`${e.window.mountedTop()}px`},r=(e,o)=>{const t=e.items.get(o);e.window.unmounted(o),t&&(e.items.delete(o),e.keyOf.delete(t),d.delete(t),e.sizes.unobserve(t.el),t.el.remove(),m.rootOwned(t,!1))},f=(e,o,t)=>{if(Number.isNaN(o))return;l(e);const i=Math.max(0,Math.min(o,e.window.maxScroll()));e.node.el.scrollTo({top:i,behavior:t?"smooth":"instant"})},a=e=>{for(const o of[...e.items.keys()])r(e,o);e.sizes.disconnect(),e.node.el.removeEventListener("scroll",e.onScroll),e.content.remove(),c.delete(e.node)};return{init(e,o,t,i,y){if(c.has(e))return;const w=e.el,O=w.ownerDocument.createElement("div");O.className="lc-vlist-content",w.appendChild(O);const v={node:e,content:O,items:new Map,keyOf:new Map,onScroll:()=>{v.window.scrolled(w.scrollTop),l(v)}};v.window=F({overscan:o,inverted:t,startThreshold:i,endThreshold:y},{sync(p,M){for(const K of p)r(v,K);m.emit(e.id,B,p,M),l(v)},adjust(p){l(v),Math.abs(w.scrollTop-p)>=.5&&(w.scrollTop=p)},edge:p=>{m.emitLater(e.id,W,p)}}),v.sizes=new ResizeObserver(p=>{for(const M of p){const K=M.target;if(K===w){v.window.viewport(w.clientWidth,w.clientHeight,I=>{var E;return((E=v.items.get(I))==null?void 0:E.el.offsetHeight)??0});continue}for(const[I,E]of v.keyOf)if(I.el===K){v.window.resized(E,K.offsetHeight);break}}l(v)}),v.sizes.observe(w),w.addEventListener("scroll",v.onScroll,{passive:!0}),c.set(e,v)},setKeys(e,o,t){const i=c.get(e);i&&(i.window.setKeys(o,Array.from(t)),l(i))},insertKeys(e,o,t,i){const y=c.get(e);y&&(y.window.insertKeys(o,t,Array.from(i)),l(y))},removeKeys(e,o){const t=c.get(e);t&&(t.window.removeKeys(o),l(t))},invalidate(e,o){const t=c.get(e);t&&(t.window.invalidate(o),l(t))},mount(e,o,t){const i=c.get(e);if(!i||!t)return;if(t.parent!==null||t.rooted){m.warn(`vlist: the item for key '${o}' is attached elsewhere`);return}const y=i.window.indexOf(o);if(y<0)return;i.items.has(o)&&r(i,o);let w=null,O=1/0;for(const[v,p]of i.items){const M=i.window.indexOf(v);M>y&&M<O&&(w=p,O=M)}i.items.set(o,t),i.keyOf.set(t,o),d.set(t,i),m.rootOwned(t,!0),i.content.insertBefore(t.el,(w==null?void 0:w.el)??null),m.flush(),i.sizes.observe(t.el),i.window.mounted(o,t.el.offsetHeight)},scrollTo(e,o,t){const i=c.get(e);i&&f(i,o,t)},scrollToKey(e,o,t){const i=c.get(e);i&&f(i,i.window.offsetOf(o),t)},scrollToEnd(e,o){const t=c.get(e);t&&f(t,t.window.maxScroll(),o)},mounted(e){const o=c.get(e);return o?[...o.items.values()].sort((t,i)=>t.el.compareDocumentPosition(i.el)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1):null},ownerOf:e=>{var o;return((o=d.get(e))==null?void 0:o.node)??null},forget(e){const o=c.get(e);o&&a(o);const t=d.get(e),i=t==null?void 0:t.keyOf.get(e);t&&i!==void 0&&(t.window.unmounted(i),t.items.delete(i),t.keyOf.delete(e),t.sizes.unobserve(e.el),d.delete(e))},destroy(){for(const e of c.values())e.sizes.disconnect(),e.content.remove();c.clear(),d.clear()}}},G={name:"vlist",install(m){const c=$({emit:m.emit,emitLater:m.emitLater,warn:m.warn,rootOwned:m.rootOwned,flush:m.flush}),d=l=>{const r=m.node(l);return(r==null?void 0:r.type)==="vlist"?r:void 0};return{bridge:{vlistInit(l,r,f,a,e){const o=d(l);o&&c.init(o,r,f,a,e)},vlistSetKeys(l,r,f){const a=d(l);a&&c.setKeys(a,r,f)},vlistInsertKeys(l,r,f,a){const e=d(l);e&&c.insertKeys(e,r,f,a)},vlistRemoveKeys(l,r){const f=d(l);f&&c.removeKeys(f,r)},vlistInvalidate(l,r){const f=d(l);f&&c.invalidate(f,r)},vlistMount(l,r,f){const a=d(l);a&&c.mount(a,r,m.node(f))},vlistScrollTo(l,r,f){const a=d(l);a&&c.scrollTo(a,r,f)},vlistScrollToKey(l,r,f){const a=d(l);a&&c.scrollToKey(a,r,f)},vlistScrollToEnd(l,r){const f=d(l);f&&c.scrollToEnd(f,r)}},forget:c.forget,destroy:c.destroy,dump(l,r,f){const a=c.mounted(l);a&&(r.items=a.map(f))}}}};export{$ as createVLists,G as vlist};
1
+ import{w as W,x as B}from"../lite.js";const F=(m,c)=>{let d=[],l=[];const r=new Map,f=new Map,a=new Set;let e=[0],o=0,t=0,i=0,y=0,w=!0,O=!1,v=!1,p=!1,M=!1,K=!0;const I=n=>f.get(d[n])??l[n],E=n=>{o=Math.min(o,n)},x=()=>{const n=d.length;e.length=n+1,o>n&&(o=n),o===0&&(e[0]=0);for(let s=o;s<n;s++)e[s+1]=e[s]+I(s);o=n},L=()=>(x(),e[d.length]??0),k=n=>{for(let s=n;s<d.length;s++)r.set(d[s],s)},C=()=>m.inverted?Math.max(0,y-L()):0,_=()=>Math.max(0,L()-y),R=()=>{x();const n=d.length;if(n===0||y<=0)return[-1,-2];const s=m.overscan<0?y:m.overscan,u=t-s,h=t+y+s;let T=0,g=n;for(;T<g;){const S=T+g>>1;e[S+1]>u?g=S:T=S+1}const N=Math.min(T,n-1);for(T=0,g=n;T<g;){const S=T+g>>1;e[S]<h?T=S+1:g=S}return[Math.max(N,0),Math.min(T-1,n-1)]},H=()=>{m.endThreshold>0&&(L()-(t+y)<=m.endThreshold?O||(O=!0,c.edge(!0)):O=!1),m.startThreshold>0&&(t<=m.startThreshold?v||(v=!0,c.edge(!1)):v=!1)},z=()=>{if(p){M=!0;return}p=!0;try{for(let n=0;n<4;n++){M=!1;const[s,u]=R(),h=[],T=[];for(const g of a){const N=r.get(g);(N===void 0||N<s||N>u)&&h.push(g)}for(let g=s;g<=u;g++)a.has(d[g])||T.push(d[g]);if(h.length===0&&T.length===0||(c.sync(h,T),!M))break}}finally{p=!1}},b=n=>{t=Math.max(0,Math.min(n,_())),c.adjust(t)},D=(n,s,u)=>{const h=I(s);if(f.set(n,u),Math.abs(u-h)<=.5)return;x();const T=e[s];E(s),T<t?b(t+(u-h)):m.inverted&&w&&b(_()),M=!0};return{setKeys(n,s){d=n.slice(),l=d.map((u,h)=>s[h]??0),r.clear(),k(0),E(0),b(t),z(),H()},insertKeys(n,s,u){if(s.length===0)return;const h=d.length;(n<0||n>h)&&(n=h);const T=h>0,g=n===h;let N=0;s.forEach((V,A)=>{N+=f.get(V)??u[A]??0}),d.splice(n,0,...s),l.splice(n,0,...s.map((V,A)=>u[A]??0)),k(n),E(n);const S=w;x(),T&&!g&&e[n]<=t+.5&&b(t+N),m.inverted&&S&&g&&(b(_()),w=!0),z(),H()},removeKeys(n){let s=0;x();for(const u of n){const h=r.get(u);h!==void 0&&(e[h+1]<=t&&(s+=I(h)),d.splice(h,1),l.splice(h,1),r.delete(u),f.delete(u),k(h),E(h),x())}b(s>0?t-s:t),z(),H()},invalidate(n){if(!(!a.has(n)||p)){p=!0;try{c.sync([n],[n])}finally{p=!1}M&&(M=!1,z())}},mounted(n,s){const u=r.get(n);u!==void 0&&(a.add(n),D(n,u,s))},unmounted(n){a.delete(n)},isMounted:n=>a.has(n),resized(n,s){const u=r.get(n);u===void 0||!a.has(n)||(D(n,u,s),M&&!p&&(M=!1,z()))},scrolled(n){t=Math.max(0,n),w=t+y>=L()-2,z(),H()},viewport(n,s,u){if(!(n>0)||!(s>0))return;const h=Math.abs(n-i)>.5,T=Math.abs(s-y)>.5;if(i=n,y=s,L()<=y&&(w=!0),h){E(0);for(const g of a)f.set(g,u(g))}K?(K=!1,m.inverted&&(b(_()),w=!0)):m.inverted&&w&&T?b(_()):h&&b(t),z()},offsetOf(n){const s=r.get(n);return s===void 0?NaN:(x(),C()+e[s])},mountedTop(){let n=-1;for(const s of a){const u=r.get(s);u!==void 0&&(n<0||u<n)&&(n=u)}return x(),C()+(n<0?0:e[n])},indexOf:n=>r.get(n)??-1,contentHeight:()=>m.inverted?Math.max(L(),y):L(),maxScroll:_,scrollY:()=>t,mountedKeys:()=>[...a]}},$=m=>{const c=new Map,d=new Map,l=e=>{e.content.style.minHeight=`${e.window.contentHeight()}px`,e.content.style.paddingTop=`${e.window.mountedTop()}px`},r=(e,o)=>{const t=e.items.get(o);e.window.unmounted(o),t&&(e.items.delete(o),e.keyOf.delete(t),d.delete(t),e.sizes.unobserve(t.el),t.el.remove(),m.rootOwned(t,!1))},f=(e,o,t)=>{if(Number.isNaN(o))return;l(e);const i=Math.max(0,Math.min(o,e.window.maxScroll()));e.node.el.scrollTo({top:i,behavior:t?"smooth":"instant"})},a=e=>{for(const o of[...e.items.keys()])r(e,o);e.sizes.disconnect(),e.node.el.removeEventListener("scroll",e.onScroll),e.content.remove(),c.delete(e.node)};return{init(e,o,t,i,y){if(c.has(e))return;const w=e.el,O=w.ownerDocument.createElement("div");O.className="lc-vlist-content",w.appendChild(O);const v={node:e,content:O,items:new Map,keyOf:new Map,onScroll:()=>{v.window.scrolled(w.scrollTop),l(v)}};v.window=F({overscan:o,inverted:t,startThreshold:i,endThreshold:y},{sync(p,M){for(const K of p)r(v,K);m.emit(e.id,B,p,M),l(v)},adjust(p){l(v),Math.abs(w.scrollTop-p)>=.5&&(w.scrollTop=p)},edge:p=>{m.emitLater(e.id,W,p)}}),v.sizes=new ResizeObserver(p=>{for(const M of p){const K=M.target;if(K===w){v.window.viewport(w.clientWidth,w.clientHeight,I=>{var E;return((E=v.items.get(I))==null?void 0:E.el.offsetHeight)??0});continue}for(const[I,E]of v.keyOf)if(I.el===K){v.window.resized(E,K.offsetHeight);break}}l(v)}),v.sizes.observe(w),w.addEventListener("scroll",v.onScroll,{passive:!0}),c.set(e,v)},setKeys(e,o,t){const i=c.get(e);i&&(i.window.setKeys(o,Array.from(t)),l(i))},insertKeys(e,o,t,i){const y=c.get(e);y&&(y.window.insertKeys(o,t,Array.from(i)),l(y))},removeKeys(e,o){const t=c.get(e);t&&(t.window.removeKeys(o),l(t))},invalidate(e,o){const t=c.get(e);t&&(t.window.invalidate(o),l(t))},mount(e,o,t){const i=c.get(e);if(!i||!t)return;if(t.parent!==null||t.rooted){m.warn(`vlist: the item for key '${o}' is attached elsewhere`);return}const y=i.window.indexOf(o);if(y<0)return;i.items.has(o)&&r(i,o);let w=null,O=1/0;for(const[v,p]of i.items){const M=i.window.indexOf(v);M>y&&M<O&&(w=p,O=M)}i.items.set(o,t),i.keyOf.set(t,o),d.set(t,i),m.rootOwned(t,!0),i.content.insertBefore(t.el,(w==null?void 0:w.el)??null),m.flush(),i.sizes.observe(t.el),i.window.mounted(o,t.el.offsetHeight)},scrollTo(e,o,t){const i=c.get(e);i&&f(i,o,t)},scrollToKey(e,o,t){const i=c.get(e);i&&f(i,i.window.offsetOf(o),t)},scrollToEnd(e,o){const t=c.get(e);t&&f(t,t.window.maxScroll(),o)},mounted(e){const o=c.get(e);return o?[...o.items.values()].sort((t,i)=>t.el.compareDocumentPosition(i.el)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1):null},ownerOf:e=>{var o;return((o=d.get(e))==null?void 0:o.node)??null},forget(e){const o=c.get(e);o&&a(o);const t=d.get(e),i=t==null?void 0:t.keyOf.get(e);t&&i!==void 0&&(t.window.unmounted(i),t.items.delete(i),t.keyOf.delete(e),t.sizes.unobserve(e.el),d.delete(e))},destroy(){for(const e of c.values())e.sizes.disconnect(),e.content.remove();c.clear(),d.clear()}}},G={name:"vlist",install(m){const c=$({emit:m.emit,emitLater:m.emitLater,warn:m.warn,rootOwned:m.rootOwned,flush:m.flush}),d=l=>{const r=m.node(l);return(r==null?void 0:r.type)==="vlist"?r:void 0};return{bridge:{vlistInit(l,r,f,a,e){const o=d(l);o&&c.init(o,r,f,a,e)},vlistSetKeys(l,r,f){const a=d(l);a&&c.setKeys(a,r,f)},vlistInsertKeys(l,r,f,a){const e=d(l);e&&c.insertKeys(e,r,f,a)},vlistRemoveKeys(l,r){const f=d(l);f&&c.removeKeys(f,r)},vlistInvalidate(l,r){const f=d(l);f&&c.invalidate(f,r)},vlistMount(l,r,f){const a=d(l);a&&c.mount(a,r,m.node(f))},vlistScrollTo(l,r,f){const a=d(l);a&&c.scrollTo(a,r,f)},vlistScrollToKey(l,r,f){const a=d(l);a&&c.scrollToKey(a,r,f)},vlistScrollToEnd(l,r){const f=d(l);f&&c.scrollToEnd(f,r)}},forget:c.forget,destroy:c.destroy,dump(l,r,f){const a=c.mounted(l);a&&(r.items=a.map(f))}}}};export{$ as createVLists,G as vlist};
@@ -17,6 +17,18 @@
17
17
  "assets/neutral_ibl128-D-lzdkLN.ktx"
18
18
  ]
19
19
  },
20
+ {
21
+ "name": "scene2d",
22
+ "uses": [
23
+ "_creator2d.createScene",
24
+ "_creator2d.createEntity"
25
+ ],
26
+ "files": [
27
+ "assets/scene2d-F6T1Io7I.js",
28
+ "assets/creator2d-1pSkYRCn.js",
29
+ "assets/creator2d-Ci5-pZGr.wasm"
30
+ ]
31
+ },
20
32
  {
21
33
  "name": "anim",
22
34
  "uses": [
@@ -60,7 +72,7 @@
60
72
  "pagerSetContent"
61
73
  ],
62
74
  "files": [
63
- "assets/pager-DpGa2uaE.js"
75
+ "assets/pager-BZAO9gMC.js"
64
76
  ]
65
77
  },
66
78
  {
@@ -69,7 +81,7 @@
69
81
  "vlistInit"
70
82
  ],
71
83
  "files": [
72
- "assets/vlist-CwSYpLz-.js"
84
+ "assets/vlist-Ap-F4H5J.js"
73
85
  ]
74
86
  },
75
87
  {
@@ -79,7 +91,7 @@
79
91
  "defineTransition"
80
92
  ],
81
93
  "files": [
82
- "assets/tween-BnWYhJ7P.js"
94
+ "assets/tween-DbrQTld4.js"
83
95
  ]
84
96
  },
85
97
  {
@@ -88,7 +100,7 @@
88
100
  "_creatorCanvas."
89
101
  ],
90
102
  "files": [
91
- "assets/canvas-WxiusXCB.js"
103
+ "assets/canvas-wFjS40IX.js"
92
104
  ]
93
105
  },
94
106
  {
@@ -97,7 +109,7 @@
97
109
  "createVideo"
98
110
  ],
99
111
  "files": [
100
- "assets/video-BLj61nDx.js"
112
+ "assets/video-bzR_t2i6.js"
101
113
  ]
102
114
  },
103
115
  {
@@ -108,7 +120,7 @@
108
120
  "_creatorService."
109
121
  ],
110
122
  "files": [
111
- "assets/plugins-CuEPHbHL.js"
123
+ "assets/plugins-B7TuO_p4.js"
112
124
  ]
113
125
  }
114
126
  ],