@esotericsoftware/spine-pixi-v8 4.2.63 → 4.2.64

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.
@@ -24,4 +24,4 @@
24
24
 
25
25
  finalColor.a = outColor.a * vColor.a;
26
26
  finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;
27
- `}},li=class extends pe.Shader{constructor(e){const t=(0,pe.compileHighShaderGlProgram)({name:"dark-tint-batch",bits:[pe.colorBitGl,oi,(0,pe.generateTextureBatchBitGl)(e),pe.roundPixelsBitGl]}),s=(0,pe.compileHighShaderGpuProgram)({name:"dark-tint-batch",bits:[pe.colorBit,ai,(0,pe.generateTextureBatchBit)(e),pe.roundPixelsBit]});super({glProgram:t,gpuProgram:s,resources:{batchSamplers:(0,pe.getBatchSamplersUniformGroup)(e)}})}},Hs=null,$s=class extends ct.Batcher{geometry=new ni;shader=Hs||(Hs=new li(this.maxTextures));name=$s.extension.name;vertexSize=7;packAttributes(e,t,s,r,n){const h=n<<16|e.roundPixels&65535,o=e.transform,i=o.a,l=o.b,a=o.c,c=o.d,d=o.tx,f=o.ty,{positions:u,uvs:m}=e,p=e.color,w=(p>>24&255)/255,b=ct.Color.shared.setValue(e.darkColor).premultiply(w,!0).toPremultiplied(1,!1),g=e.attributeOffset,x=g+e.attributeSize;for(let v=g;v<x;v++){const y=v*2,C=u[y],S=u[y+1];t[r++]=i*C+a*S+d,t[r++]=c*S+l*C+f,t[r++]=m[y],t[r++]=m[y+1],s[r++]=p,s[r++]=b,s[r++]=h}}packQuadAttributes(e,t,s,r,n){const h=e.texture,o=e.transform,i=o.a,l=o.b,a=o.c,c=o.d,d=o.tx,f=o.ty,u=e.bounds,m=u.maxX,p=u.minX,w=u.maxY,b=u.minY,g=h.uvs,x=e.color,v=e.darkColor,y=n<<16|e.roundPixels&65535;t[r+0]=i*p+a*b+d,t[r+1]=c*b+l*p+f,t[r+2]=g.x0,t[r+3]=g.y0,s[r+4]=x,s[r+5]=v,s[r+6]=y,t[r+7]=i*m+a*b+d,t[r+8]=c*b+l*m+f,t[r+9]=g.x1,t[r+10]=g.y1,s[r+11]=x,s[r+12]=v,s[r+13]=y,t[r+14]=i*m+a*w+d,t[r+15]=c*w+l*m+f,t[r+16]=g.x2,t[r+17]=g.y2,s[r+18]=x,s[r+19]=v,s[r+20]=y,t[r+21]=i*p+a*w+d,t[r+22]=c*w+l*p+f,t[r+23]=g.x3,t[r+24]=g.y3,s[r+25]=x,s[r+26]=v,s[r+27]=y}},js=$s;R(js,"extension",{type:[ct.ExtensionType.Batcher],name:"darkTint"}),ct.extensions.add(js);var We=xe("pixi.js"),hi=class{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const e=this.data.color,t=this.renderable.groupColor,s=this.renderable.groupAlpha;let r;const n=e.a*s*255;if(t!==16777215){const h=t>>16&255,o=t>>8&255,i=t&255,l=e.r*i,a=e.g*o,c=e.b*h;r=n<<24|c<<16|a<<8|l}else r=n<<24|e.b*255<<16|e.g*255<<8|e.r*255;return r}get darkColor(){const e=this.data.darkColor;return e.b*255<<16|e.g*255<<8|e.r*255}get groupTransform(){return this.renderable.groupTransform}setData(e,t,s,r){if(this.renderable=e,this.transform=e.groupTransform,this.data=t,t.clipped){const n=t.clippedData;this.indexSize=n.indicesCount,this.attributeSize=n.vertexCount,this.positions=n.vertices,this.indices=n.indices,this.uvs=n.uvs}else this.indexSize=t.indices.length,this.attributeSize=t.vertices.length/2,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs;this.texture=t.texture,this.roundPixels=r,this.blendMode=s,this.batcherName=t.darkTint?"darkTint":"default"}},ci={0:"normal",1:"add",2:"multiply",3:"screen"},us=class{renderer;gpuSpineData={};constructor(e){this.renderer=e}validateRenderable(e){if(e._applyState(),e.spineAttachmentsDirty)return!0;if(e.spineTexturesDirty){const t=e.skeleton.drawOrder,s=this.gpuSpineData[e.uid];for(let r=0,n=t.length;r<n;r++){const h=t[r],o=h.getAttachment();if(o instanceof O||o instanceof le){const i=e._getCachedData(h,o),l=s.slotBatches[i.id],a=i.texture;if(a!==l.texture&&!l._batcher.checkAndUpdateTexture(l,a))return!0}}}return!1}addRenderable(e,t){const s=this.gpuSpineData[e.uid]||={slotBatches:{}},r=this.renderer.renderPipes.batch,n=e.skeleton.drawOrder,h=this.renderer._roundPixels|e._roundPixels;e._applyState();for(let o=0,i=n.length;o<i;o++){const l=n[o],a=l.getAttachment(),c=ci[l.data.blendMode];if(a instanceof O||a instanceof le){const f=e._getCachedData(l,a),u=s.slotBatches[f.id]||=new hi;u.setData(e,f,c,h),f.skipRender||r.addToBatch(u,t)}const d=e._slotsObject[l.data.name];if(d){const f=d.container;f.includeInBuild=!0,(0,We.collectAllRenderables)(f,t,this.renderer),f.includeInBuild=!1}}}updateRenderable(e){const t=this.gpuSpineData[e.uid];e._applyState();const s=e.skeleton.drawOrder;for(let r=0,n=s.length;r<n;r++){const h=s[r],o=h.getAttachment();if((o instanceof O||o instanceof le)&&!e._getCachedData(h,o).skipRender){const l=t.slotBatches[e._getCachedData(h,o).id];l._batcher?.updateElement(l)}}}destroyRenderable(e){this.gpuSpineData[e.uid]=null}destroy(){this.gpuSpineData=null,this.renderer=null}};R(us,"extension",{type:[We.ExtensionType.WebGLPipes,We.ExtensionType.WebGPUPipes,We.ExtensionType.CanvasPipes],name:"spine"}),We.extensions.add(us);var se=xe("pixi.js"),dt=new _e;Fe.yDown=!0;var De=new lt,Js=new Be(()=>new se.Graphics),ms=class extends se.ViewContainer{batched=!0;buildId=0;renderPipeId="spine";_didSpineUpdate=!1;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};skeleton;state;skeletonBounds;darkTint=!1;_debug=void 0;_slotsObject=Object.create(null);clippingSlotToPixiMasks=Object.create(null);getSlotFromRef(e){let t;if(typeof e=="number"?t=this.skeleton.slots[e]:typeof e=="string"?t=this.skeleton.findSlot(e):t=e,!t)throw new Error(`No slot found with the given slot reference: ${e}`);return t}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(e){this._debug&&this._debug.unregisterSpine(this),e&&e.registerSpine(this),this._debug=e}autoUpdateWarned=!1;_autoUpdate=!0;get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e?(se.Ticker.shared.add(this.internalUpdate,this),this.autoUpdateWarned=!1):se.Ticker.shared.remove(this.internalUpdate,this),this._autoUpdate=e}constructor(e){e instanceof qe&&(e={skeletonData:e}),super();const t=e instanceof qe?e:e.skeletonData;this.skeleton=new Fe(t),this.state=new Gt(new Ps(t)),this.autoUpdate=e?.autoUpdate??!0,this.darkTint=e?.darkTint===void 0?this.skeleton.slots.some(r=>!!r.data.darkColor):e?.darkTint;const s=this.skeleton.slots;for(let r=0;r<s.length;r++)this.attachmentCacheData[r]=Object.create(null);this._updateState(0)}update(e){this.autoUpdate&&!this.autoUpdateWarned&&(console.warn("You are calling update on a Spine instance that has autoUpdate set to true. This is probably not what you want."),this.autoUpdateWarned=!0),this.internalUpdate(0,e)}internalUpdate(e,t){this._updateState(t??se.Ticker.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(e,t){const s=e;if(typeof e=="string"&&(e=this.skeleton.findBone(e)),!e)throw Error(`Cant set bone position, bone ${String(s)} not found`);if(dt.set(t.x,t.y),e.parent){const r=e.parent.worldToLocal(dt);e.x=r.x,e.y=-r.y}else e.x=dt.x,e.y=dt.y}getBonePosition(e,t){const s=e;return typeof e=="string"&&(e=this.skeleton.findBone(e)),e?(t||(t={x:0,y:0}),t.x=e.worldX,t.y=e.worldY,t):(console.error(`Cant set bone position! Bone ${String(s)} not found`),t)}_updateState(e){this.state.update(e),this.skeleton.update(e),this._stateChanged=!0,this._boundsDirty=!0,this.onViewUpdate()}_applyState(){if(!this._stateChanged)return;this._stateChanged=!1;const{skeleton:e}=this;this.state.apply(e),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.validateAttachments(),this.transformAttachments(),this.updateSlotObjects()}validateAttachments(){const e=this.skeleton.drawOrder,t=this._lastAttachments;let s=0,r=!1;for(let n=0;n<e.length;n++){const o=e[n].getAttachment();o&&(o!==t[s]&&(r=!0,t[s]=o),s++)}s!==t.length&&(r=!0,t.length=s),this.spineAttachmentsDirty=r}updateAndSetPixiMask(e,t){const s=e.attachment;if(s&&s instanceof ve){const h=this.clippingSlotToPixiMasks[e.data.name]||={slot:e,vertices:new Array};h.maskComputed=!1,this.currentClippingSlot=this.clippingSlotToPixiMasks[e.data.name];return}let r=this.currentClippingSlot,n=this._slotsObject[e.data.name];if(r&&n){let h=r.slot,o=h.attachment,i=r.mask;if(i||(i=Js.obtain(),r.mask=i,this.addChild(i)),!r.maskComputed){r.maskComputed=!0;const l=o.worldVerticesLength,a=r.vertices;o.computeWorldVertices(h,0,l,a,0,2),i.clear().poly(a).stroke({width:0}).fill({alpha:.25})}n.container.mask=i}else n?.container.mask&&(n.container.mask=null);if(r&&r.slot.attachment.endSlot==e.data&&(this.currentClippingSlot=void 0),t)for(const h in this.clippingSlotToPixiMasks){const o=this.clippingSlotToPixiMasks[h];(!(o.slot.attachment instanceof ve)||!o.maskComputed)&&o.mask&&(this.removeChild(o.mask),Js.free(o.mask),o.mask=void 0)}}currentClippingSlot;transformAttachments(){const e=this.skeleton.drawOrder;for(let t=0;t<e.length;t++){const s=e[t];this.updateAndSetPixiMask(s,t===e.length-1);const r=s.getAttachment();if(r){if(r instanceof le||r instanceof O){const n=this._getCachedData(s,r);r instanceof O?r.computeWorldVertices(s,n.vertices,0,2):r.computeWorldVertices(s,0,r.worldVerticesLength,n.vertices,0,2),(0,se.fastCopy)(r.uvs.buffer,n.uvs.buffer);const o=s.bone.skeleton.color,i=s.color,l=r.color;n.color.set(o.r*i.r*l.r,o.g*i.g*l.g,o.b*i.b*l.b,o.a*i.a*l.a),s.darkColor&&n.darkColor.setFromColor(s.darkColor),n.skipRender=n.clipped=!1;const a=r.region?.texture.texture||se.Texture.EMPTY;n.texture!==a&&(n.texture=a,this.spineTexturesDirty=!0),De.isClipping()&&this.updateClippingData(n)}else if(r instanceof ve){De.clipStart(s,r);continue}}De.clipEndWithSlot(s)}De.clipEnd()}updateClippingData(e){e.clipped=!0,De.clipTrianglesUnpacked(e.vertices,e.indices,e.indices.length,e.uvs);const{clippedVertices:t,clippedUVs:s,clippedTriangles:r}=De,n=t.length/2,h=r.length;e.clippedData||(e.clippedData={vertices:new Float32Array(n*2),uvs:new Float32Array(n*2),vertexCount:n,indices:new Uint16Array(h),indicesCount:h},this.spineAttachmentsDirty=!0);const o=e.clippedData,i=o.vertexCount!==n||h!==o.indicesCount;e.skipRender=n===0,i&&(this.spineAttachmentsDirty=!0,o.vertexCount<n&&(o.vertices=new Float32Array(n*2),o.uvs=new Float32Array(n*2)),o.indices.length<h&&(o.indices=new Uint16Array(h)));const{vertices:l,uvs:a,indices:c}=o;for(let d=0;d<n;d++)l[d*2]=t[d*2],l[d*2+1]=t[d*2+1],a[d*2]=s[d*2],a[d*2+1]=s[d*2+1];o.vertexCount=n;for(let d=0;d<h;d++)c[d]!==r[d]&&(this.spineAttachmentsDirty=!0,c[d]=r[d]);o.indicesCount=h}updateSlotObjects(){for(const e in this._slotsObject){const t=this._slotsObject[e];t&&this.updateSlotObject(t)}}updateSlotObject(e){const{slot:t,container:s}=e;if(s.visible=this.skeleton.drawOrder.includes(t),s.visible){const r=t.bone;s.position.set(r.worldX,r.worldY),s.scale.x=r.getWorldScaleX(),s.scale.y=r.getWorldScaleY(),s.rotation=r.getWorldRotationX()*se.DEG_TO_RAD,s.alpha=this.skeleton.color.a*t.color.a}}_getCachedData(e,t){return this.attachmentCacheData[e.data.index][t.name]||this.initCachedData(e,t)}initCachedData(e,t){let s;return t instanceof O?(s=new Float32Array(8),this.attachmentCacheData[e.data.index][t.name]={id:`${e.data.index}-${t.name}`,vertices:s,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(t.uvs.length),color:new _(1,1,1,1),darkColor:new _(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:t.region?.texture.texture}):(s=new Float32Array(t.worldVerticesLength),this.attachmentCacheData[e.data.index][t.name]={id:`${e.data.index}-${t.name}`,vertices:s,clipped:!1,indices:t.triangles,uvs:new Float32Array(t.uvs.length),color:new _(1,1,1,1),darkColor:new _(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:t.region?.texture.texture}),this.attachmentCacheData[e.data.index][t.name]}onViewUpdate(){if(this._didChangeId+=1<<12,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(e,t){e=this.getSlotFromRef(e);for(const r in this._slotsObject)this._slotsObject[r]?.container===t&&this.removeSlotObject(this._slotsObject[r].slot);this.removeSlotObject(e),t.includeInBuild=!1,this.addChild(t);const s={container:t,slot:e};this._slotsObject[e.data.name]=s,this.updateSlotObject(s)}removeSlotObject(e){let t;if(e instanceof se.Container){for(const s in this._slotsObject)if(this._slotsObject[s]?.container===e){this._slotsObject[s]=null,t=e;break}}else{const s=this.getSlotFromRef(e);t=this._slotsObject[s.data.name]?.container,this._slotsObject[s.data.name]=null}t&&(this.removeChild(t),t.includeInBuild=!0)}getSlotObject(e){return e=this.getSlotFromRef(e),this._slotsObject[e.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new ds;const e=this.skeletonBounds;if(e.update(this.skeleton,!0),e.minX===1/0){this._applyState();const t=this.skeleton.drawOrder,s=this._bounds;s.clear();for(let r=0;r<t.length;r++){const n=t[r],h=n.getAttachment();if(h&&(h instanceof O||h instanceof le)){const o=this._getCachedData(n,h);s.addVertexData(o.vertices,0,o.vertices.length)}}}else this._bounds.minX=e.minX,this._bounds.minY=e.minY,this._bounds.maxX=e.maxX,this._bounds.maxY=e.maxY}addBounds(e){e.addBounds(this.bounds)}destroy(e=!1){super.destroy(e),se.Ticker.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(e){this.worldTransform.apply(e,e)}pixiWorldCoordinatesToSkeleton(e){this.worldTransform.applyInverse(e,e)}pixiWorldCoordinatesToBone(e,t){this.pixiWorldCoordinatesToSkeleton(e),t.parent?t.parent.worldToLocal(e):t.worldToLocal(e)}static from({skeleton:e,atlas:t,scale:s=1,darkTint:r,autoUpdate:n=!0}){const h=`${e}-${t}-${s}`;if(se.Cache.has(h))return new ms(se.Cache.get(h));const o=se.Assets.get(e),i=se.Assets.get(t),l=new Ls(i),a=o instanceof Uint8Array?new Ws(l):new Gs(l);a.scale=s;const c=a.readSkeletonData(o);return se.Cache.set(h,c),new ms({skeletonData:c,darkTint:r,autoUpdate:n})}},re=xe("pixi.js"),di=class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(e){if(this.registeredSpines.has(e)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);return}const t={parentDebugContainer:new re.Container,bones:new re.Container,skeletonXY:new re.Graphics,regionAttachmentsShape:new re.Graphics,meshTrianglesLine:new re.Graphics,meshHullLine:new re.Graphics,clippingPolygon:new re.Graphics,boundingBoxesRect:new re.Graphics,boundingBoxesCircle:new re.Graphics,boundingBoxesPolygon:new re.Graphics,pathsCurve:new re.Graphics,pathsLine:new re.Graphics,eventText:new re.Container,eventCallback:{event:(s,r)=>{if(this.drawEvents){const n=Math.abs(e.scale.x||e.scale.y||1),h=new re.Text({text:r.data.name,style:{fontSize:this.eventFontSize/n,fill:this.eventFontColor,fontFamily:"monospace"}});h.scale.x=Math.sign(e.scale.x),h.anchor.set(.5),t.eventText.addChild(h),setTimeout(()=>{h.destroyed||h.destroy()},250)}}}};t.parentDebugContainer.addChild(t.bones),t.parentDebugContainer.addChild(t.skeletonXY),t.parentDebugContainer.addChild(t.regionAttachmentsShape),t.parentDebugContainer.addChild(t.meshTrianglesLine),t.parentDebugContainer.addChild(t.meshHullLine),t.parentDebugContainer.addChild(t.clippingPolygon),t.parentDebugContainer.addChild(t.boundingBoxesRect),t.parentDebugContainer.addChild(t.boundingBoxesCircle),t.parentDebugContainer.addChild(t.boundingBoxesPolygon),t.parentDebugContainer.addChild(t.pathsCurve),t.parentDebugContainer.addChild(t.pathsLine),t.parentDebugContainer.addChild(t.eventText),t.parentDebugContainer.zIndex=9999999,t.parentDebugContainer.accessibleChildren=!1,t.parentDebugContainer.eventMode="none",t.parentDebugContainer.interactiveChildren=!1,e.addChild(t.parentDebugContainer),e.state.addListener(t.eventCallback),this.registeredSpines.set(e,t)}renderDebug(e){this.registeredSpines.has(e)||this.registerSpine(e);const t=this.registeredSpines.get(e);if(!t)return;e.addChild(t.parentDebugContainer),t.skeletonXY.clear(),t.regionAttachmentsShape.clear(),t.meshTrianglesLine.clear(),t.meshHullLine.clear(),t.clippingPolygon.clear(),t.boundingBoxesRect.clear(),t.boundingBoxesCircle.clear(),t.boundingBoxesPolygon.clear(),t.pathsCurve.clear(),t.pathsLine.clear();for(let n=t.bones.children.length;n>0;n--)t.bones.children[n-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(e.scale.x||e.scale.y||1),r=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(e,t,r,s),this.drawPaths&&this.drawPathsFunc(e,t,r),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(e,t,r),this.drawClipping&&this.drawClippingFunc(e,t,r),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(e,t,r),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(e,t,r),this.drawEvents)for(const n of t.eventText.children)n.alpha-=.05,n.y-=2}drawBonesFunc(e,t,s,r){const n=e.skeleton,h=n.x,o=n.y,i=n.bones;t.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let a=0,c=i.length;a<c;a++){const d=i[a],f=d.data.length,u=h+d.worldX,m=o+d.worldY,p=h+f*d.a+d.worldX,w=o+f*d.b+d.worldY;if(d.data.name==="root"||d.data.parent===null)continue;const b=Math.abs(u-p),g=Math.abs(m-w),x=Math.pow(b,2),v=g,y=Math.pow(g,2),C=Math.sqrt(x+y),S=Math.pow(C,2),A=Math.PI/180,M=Math.acos((S+y-x)/(2*v*C))||0;if(C===0)continue;const T=new re.Graphics;t.bones.addChild(T);const X=C/50/r;T.context.poly([0,0,0-X,C-X*3,0,C-X,0+X,C-X*3]).fill(this.bonesColor),T.x=u,T.y=m,T.pivot.y=C;let F=0;u<p&&m<w?F=-M+180*A:u>p&&m<w?F=180*A+M:u>p&&m>w?F=-M:u<p&&m>w?F=M:m===w&&u<p?F=90*A:m===w&&u>p?F=-90*A:u===p&&m<w?F=180*A:u===p&&m>w&&(F=0),T.rotation=F,T.circle(0,C,X*1.2).fill({color:0,alpha:.6}).stroke({width:s+X/2.4,color:this.bonesColor})}const l=s*3;t.skeletonXY.context.moveTo(h-l,o-l).lineTo(h+l,o+l).moveTo(h+l,o-l).lineTo(h-l,o+l).stroke()}drawRegionAttachmentsFunc(e,t,s){const n=e.skeleton.slots;for(let h=0,o=n.length;h<o;h++){const i=n[h],l=i.getAttachment();if(l===null||!(l instanceof O))continue;const a=l,c=new Float32Array(8);a.computeWorldVertices(i,c,0,2),t.regionAttachmentsShape.poly(Array.from(c.slice(0,8)))}t.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(e,t,s){const n=e.skeleton.slots;for(let h=0,o=n.length;h<o;h++){const i=n[h];if(!i.bone.active)continue;const l=i.getAttachment();if(l===null||!(l instanceof le))continue;const a=l,c=new Float32Array(a.worldVerticesLength),d=a.triangles;let f=a.hullLength;if(a.computeWorldVertices(i,0,a.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let u=0,m=d.length;u<m;u+=3){const p=d[u]*2,w=d[u+1]*2,b=d[u+2]*2;t.meshTrianglesLine.context.moveTo(c[p],c[p+1]).lineTo(c[w],c[w+1]).lineTo(c[b],c[b+1])}if(this.drawMeshHull&&f>0){f=(f>>1)*2;let u=c[f-2],m=c[f-1];for(let p=0,w=f;p<w;p+=2){const b=c[p],g=c[p+1];t.meshHullLine.context.moveTo(b,g).lineTo(u,m),u=b,m=g}}}t.meshHullLine.stroke({width:s,color:this.meshHullColor}),t.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(e,t,s){const n=e.skeleton.slots;for(let h=0,o=n.length;h<o;h++){const i=n[h];if(!i.bone.active)continue;const l=i.getAttachment();if(l===null||!(l instanceof ve))continue;const a=l,c=a.worldVerticesLength,d=new Float32Array(c);a.computeWorldVertices(i,0,c,d,0,2),t.clippingPolygon.poly(Array.from(d))}t.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(e,t,s){const r=new ds;r.update(e.skeleton,!0),r.minX!==1/0&&t.boundingBoxesRect.rect(r.minX,r.minY,r.getWidth(),r.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const n=r.polygons,h=(o,i,l)=>{if(l<3)throw new Error("Polygon must contain at least 3 vertices");const a=[],c=s*2;for(let d=0,f=o.length;d<f;d+=2){const u=o[d],m=o[d+1];t.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),t.boundingBoxesCircle.drawCircle(u,m,c),t.boundingBoxesCircle.fill(0),t.boundingBoxesCircle.circle(u,m,c).fill({color:this.boundingBoxesCircleColor}),a.push(u,m)}t.boundingBoxesPolygon.poly(a).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let o=0,i=n.length;o<i;o++){const l=n[o];h(l,0,l.length)}}drawPathsFunc(e,t,s){const n=e.skeleton.slots;for(let h=0,o=n.length;h<o;h++){const i=n[h];if(!i.bone.active)continue;const l=i.getAttachment();if(l===null||!(l instanceof Ye))continue;const a=l;let c=a.worldVerticesLength;const d=new Float32Array(c);a.computeWorldVertices(i,0,c,d,0,2);let f=d[2],u=d[3],m=0,p=0;if(a.closed){const w=d[0],b=d[1],g=d[c-2],x=d[c-1];m=d[c-4],p=d[c-3],t.pathsCurve.moveTo(f,u),t.pathsCurve.bezierCurveTo(w,b,g,x,m,p),t.pathsLine.moveTo(f,u),t.pathsLine.lineTo(w,b),t.pathsLine.moveTo(m,p),t.pathsLine.lineTo(g,x)}c-=4;for(let w=4;w<c;w+=6){const b=d[w],g=d[w+1],x=d[w+2],v=d[w+3];m=d[w+4],p=d[w+5],t.pathsCurve.moveTo(f,u),t.pathsCurve.bezierCurveTo(b,g,x,v,m,p),t.pathsLine.moveTo(f,u),t.pathsLine.lineTo(b,g),t.pathsLine.moveTo(m,p),t.pathsLine.lineTo(x,v),f=m,u=p}}t.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),t.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(e){this.registeredSpines.has(e)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",e);const t=this.registeredSpines.get(e);t&&(e.state.removeListener(t.eventCallback),t.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(e))}};return lr(xs)})();
27
+ `}},li=class extends pe.Shader{constructor(e){const t=(0,pe.compileHighShaderGlProgram)({name:"dark-tint-batch",bits:[pe.colorBitGl,oi,(0,pe.generateTextureBatchBitGl)(e),pe.roundPixelsBitGl]}),s=(0,pe.compileHighShaderGpuProgram)({name:"dark-tint-batch",bits:[pe.colorBit,ai,(0,pe.generateTextureBatchBit)(e),pe.roundPixelsBit]});super({glProgram:t,gpuProgram:s,resources:{batchSamplers:(0,pe.getBatchSamplersUniformGroup)(e)}})}},Hs=null,$s=class extends ct.Batcher{geometry=new ni;shader=Hs||(Hs=new li(this.maxTextures));name=$s.extension.name;vertexSize=7;packAttributes(e,t,s,r,n){const h=n<<16|e.roundPixels&65535,o=e.transform,i=o.a,l=o.b,a=o.c,c=o.d,d=o.tx,f=o.ty,{positions:u,uvs:m}=e,p=e.color,w=(p>>24&255)/255,b=ct.Color.shared.setValue(e.darkColor).premultiply(w,!0).toPremultiplied(1,!1),g=e.attributeOffset,x=g+e.attributeSize;for(let v=g;v<x;v++){const y=v*2,C=u[y],S=u[y+1];t[r++]=i*C+a*S+d,t[r++]=c*S+l*C+f,t[r++]=m[y],t[r++]=m[y+1],s[r++]=p,s[r++]=b,s[r++]=h}}packQuadAttributes(e,t,s,r,n){const h=e.texture,o=e.transform,i=o.a,l=o.b,a=o.c,c=o.d,d=o.tx,f=o.ty,u=e.bounds,m=u.maxX,p=u.minX,w=u.maxY,b=u.minY,g=h.uvs,x=e.color,v=e.darkColor,y=n<<16|e.roundPixels&65535;t[r+0]=i*p+a*b+d,t[r+1]=c*b+l*p+f,t[r+2]=g.x0,t[r+3]=g.y0,s[r+4]=x,s[r+5]=v,s[r+6]=y,t[r+7]=i*m+a*b+d,t[r+8]=c*b+l*m+f,t[r+9]=g.x1,t[r+10]=g.y1,s[r+11]=x,s[r+12]=v,s[r+13]=y,t[r+14]=i*m+a*w+d,t[r+15]=c*w+l*m+f,t[r+16]=g.x2,t[r+17]=g.y2,s[r+18]=x,s[r+19]=v,s[r+20]=y,t[r+21]=i*p+a*w+d,t[r+22]=c*w+l*p+f,t[r+23]=g.x3,t[r+24]=g.y3,s[r+25]=x,s[r+26]=v,s[r+27]=y}},js=$s;R(js,"extension",{type:[ct.ExtensionType.Batcher],name:"darkTint"}),ct.extensions.add(js);var We=xe("pixi.js"),hi=class{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const e=this.data.color,t=this.renderable.groupColor,s=this.renderable.groupAlpha;let r;const n=e.a*s*255;if(t!==16777215){const h=t>>16&255,o=t>>8&255,i=t&255,l=e.r*i,a=e.g*o,c=e.b*h;r=n<<24|c<<16|a<<8|l}else r=n<<24|e.b*255<<16|e.g*255<<8|e.r*255;return r}get darkColor(){const e=this.data.darkColor;return e.b*255<<16|e.g*255<<8|e.r*255}get groupTransform(){return this.renderable.groupTransform}setData(e,t,s,r){if(this.renderable=e,this.transform=e.groupTransform,this.data=t,t.clipped){const n=t.clippedData;this.indexSize=n.indicesCount,this.attributeSize=n.vertexCount,this.positions=n.vertices,this.indices=n.indices,this.uvs=n.uvs}else this.indexSize=t.indices.length,this.attributeSize=t.vertices.length/2,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs;this.texture=t.texture,this.roundPixels=r,this.blendMode=s,this.batcherName=t.darkTint?"darkTint":"default"}},ci={0:"normal",1:"add",2:"multiply",3:"screen"},us=class{renderer;gpuSpineData={};constructor(e){this.renderer=e}validateRenderable(e){if(e._applyState(),e.spineAttachmentsDirty)return!0;if(e.spineTexturesDirty){const t=e.skeleton.drawOrder,s=this.gpuSpineData[e.uid];for(let r=0,n=t.length;r<n;r++){const h=t[r],o=h.getAttachment();if(o instanceof O||o instanceof le){const i=e._getCachedData(h,o),l=s.slotBatches[i.id],a=i.texture;if(a!==l.texture&&!l._batcher.checkAndUpdateTexture(l,a))return!0}}}return!1}addRenderable(e,t){const s=this.gpuSpineData[e.uid]||={slotBatches:{}},r=this.renderer.renderPipes.batch,n=e.skeleton.drawOrder,h=this.renderer._roundPixels|e._roundPixels;e._applyState();for(let o=0,i=n.length;o<i;o++){const l=n[o],a=l.getAttachment(),c=ci[l.data.blendMode];if(a instanceof O||a instanceof le){const f=e._getCachedData(l,a),u=s.slotBatches[f.id]||=new hi;u.setData(e,f,c,h),f.skipRender||r.addToBatch(u,t)}const d=e._slotsObject[l.data.name];if(d){const f=d.container;f.includeInBuild=!0,(0,We.collectAllRenderables)(f,t,this.renderer),f.includeInBuild=!1}}}updateRenderable(e){const t=this.gpuSpineData[e.uid];e._applyState();const s=e.skeleton.drawOrder;for(let r=0,n=s.length;r<n;r++){const h=s[r],o=h.getAttachment();if((o instanceof O||o instanceof le)&&!e._getCachedData(h,o).skipRender){const l=t.slotBatches[e._getCachedData(h,o).id];l._batcher?.updateElement(l)}}}destroyRenderable(e){this.gpuSpineData[e.uid]=null}destroy(){this.gpuSpineData=null,this.renderer=null}};R(us,"extension",{type:[We.ExtensionType.WebGLPipes,We.ExtensionType.WebGPUPipes,We.ExtensionType.CanvasPipes],name:"spine"}),We.extensions.add(us);var se=xe("pixi.js"),dt=new _e;Fe.yDown=!0;var De=new lt,Js=new Be(()=>new se.Graphics),ms=class extends se.ViewContainer{batched=!0;buildId=0;renderPipeId="spine";_didSpineUpdate=!1;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};skeleton;state;skeletonBounds;darkTint=!1;_debug=void 0;_slotsObject=Object.create(null);clippingSlotToPixiMasks=Object.create(null);getSlotFromRef(e){let t;if(typeof e=="number"?t=this.skeleton.slots[e]:typeof e=="string"?t=this.skeleton.findSlot(e):t=e,!t)throw new Error(`No slot found with the given slot reference: ${e}`);return t}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(e){this._debug&&this._debug.unregisterSpine(this),e&&e.registerSpine(this),this._debug=e}autoUpdateWarned=!1;_autoUpdate=!0;get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e?(se.Ticker.shared.add(this.internalUpdate,this),this.autoUpdateWarned=!1):se.Ticker.shared.remove(this.internalUpdate,this),this._autoUpdate=e}constructor(e){e instanceof qe&&(e={skeletonData:e}),super();const t=e instanceof qe?e:e.skeletonData;this.skeleton=new Fe(t),this.state=new Gt(new Ps(t)),this.autoUpdate=e?.autoUpdate??!0,this.darkTint=e?.darkTint===void 0?this.skeleton.slots.some(r=>!!r.data.darkColor):e?.darkTint;const s=this.skeleton.slots;for(let r=0;r<s.length;r++)this.attachmentCacheData[r]=Object.create(null);this._updateState(0)}update(e){this.autoUpdate&&!this.autoUpdateWarned&&(console.warn("You are calling update on a Spine instance that has autoUpdate set to true. This is probably not what you want."),this.autoUpdateWarned=!0),this.internalUpdate(0,e)}internalUpdate(e,t){this._updateState(t??se.Ticker.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(e,t){const s=e;if(typeof e=="string"&&(e=this.skeleton.findBone(e)),!e)throw Error(`Cant set bone position, bone ${String(s)} not found`);if(dt.set(t.x,t.y),e.parent){const r=e.parent.worldToLocal(dt);e.x=r.x,e.y=-r.y}else e.x=dt.x,e.y=dt.y}getBonePosition(e,t){const s=e;return typeof e=="string"&&(e=this.skeleton.findBone(e)),e?(t||(t={x:0,y:0}),t.x=e.worldX,t.y=e.worldY,t):(console.error(`Cant set bone position! Bone ${String(s)} not found`),t)}_updateState(e){this.state.update(e),this.skeleton.update(e),this._stateChanged=!0,this._boundsDirty=!0,this.onViewUpdate()}_applyState(){if(!this._stateChanged)return;this._stateChanged=!1;const{skeleton:e}=this;this.state.apply(e),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.validateAttachments(),this.transformAttachments(),this.updateSlotObjects()}validateAttachments(){const e=this.skeleton.drawOrder,t=this._lastAttachments;let s=0,r=!1;for(let n=0;n<e.length;n++){const o=e[n].getAttachment();o&&(o!==t[s]&&(r=!0,t[s]=o),s++)}s!==t.length&&(r=!0,t.length=s),this.spineAttachmentsDirty=r}updateAndSetPixiMask(e,t){const s=e.attachment;if(s&&s instanceof ve){const h=this.clippingSlotToPixiMasks[e.data.name]||={slot:e,vertices:new Array};h.maskComputed=!1,this.currentClippingSlot=this.clippingSlotToPixiMasks[e.data.name];return}let r=this.currentClippingSlot,n=this._slotsObject[e.data.name];if(r&&n){let h=r.slot,o=h.attachment,i=r.mask;if(i||(i=Js.obtain(),r.mask=i,this.addChild(i)),!r.maskComputed){r.maskComputed=!0;const l=o.worldVerticesLength,a=r.vertices;o.computeWorldVertices(h,0,l,a,0,2),i.clear().poly(a).stroke({width:0}).fill({alpha:.25})}n.container.mask=i}else n?.container.mask&&(n.container.mask=null);if(r&&r.slot.attachment.endSlot==e.data&&(this.currentClippingSlot=void 0),t)for(const h in this.clippingSlotToPixiMasks){const o=this.clippingSlotToPixiMasks[h];(!(o.slot.attachment instanceof ve)||!o.maskComputed)&&o.mask&&(this.removeChild(o.mask),Js.free(o.mask),o.mask=void 0)}}currentClippingSlot;transformAttachments(){const e=this.skeleton.drawOrder;for(let t=0;t<e.length;t++){const s=e[t];this.updateAndSetPixiMask(s,t===e.length-1);const r=s.getAttachment();if(r){if(r instanceof le||r instanceof O){const n=this._getCachedData(s,r);r instanceof O?r.computeWorldVertices(s,n.vertices,0,2):r.computeWorldVertices(s,0,r.worldVerticesLength,n.vertices,0,2),n.uvs.length<r.uvs.length&&(n.uvs=new Float32Array(r.uvs.length)),(0,se.fastCopy)(r.uvs.buffer,n.uvs.buffer);const o=s.bone.skeleton.color,i=s.color,l=r.color;n.color.set(o.r*i.r*l.r,o.g*i.g*l.g,o.b*i.b*l.b,o.a*i.a*l.a),s.darkColor&&n.darkColor.setFromColor(s.darkColor),n.skipRender=n.clipped=!1;const a=r.region?.texture.texture||se.Texture.EMPTY;n.texture!==a&&(n.texture=a,this.spineTexturesDirty=!0),De.isClipping()&&this.updateClippingData(n)}else if(r instanceof ve){De.clipStart(s,r);continue}}De.clipEndWithSlot(s)}De.clipEnd()}updateClippingData(e){e.clipped=!0,De.clipTrianglesUnpacked(e.vertices,e.indices,e.indices.length,e.uvs);const{clippedVertices:t,clippedUVs:s,clippedTriangles:r}=De,n=t.length/2,h=r.length;e.clippedData||(e.clippedData={vertices:new Float32Array(n*2),uvs:new Float32Array(n*2),vertexCount:n,indices:new Uint16Array(h),indicesCount:h},this.spineAttachmentsDirty=!0);const o=e.clippedData,i=o.vertexCount!==n||h!==o.indicesCount;e.skipRender=n===0,i&&(this.spineAttachmentsDirty=!0,o.vertexCount<n&&(o.vertices=new Float32Array(n*2),o.uvs=new Float32Array(n*2)),o.indices.length<h&&(o.indices=new Uint16Array(h)));const{vertices:l,uvs:a,indices:c}=o;for(let d=0;d<n;d++)l[d*2]=t[d*2],l[d*2+1]=t[d*2+1],a[d*2]=s[d*2],a[d*2+1]=s[d*2+1];o.vertexCount=n;for(let d=0;d<h;d++)c[d]!==r[d]&&(this.spineAttachmentsDirty=!0,c[d]=r[d]);o.indicesCount=h}updateSlotObjects(){for(const e in this._slotsObject){const t=this._slotsObject[e];t&&this.updateSlotObject(t)}}updateSlotObject(e){const{slot:t,container:s}=e;if(s.visible=this.skeleton.drawOrder.includes(t),s.visible){const r=t.bone;s.position.set(r.worldX,r.worldY),s.scale.x=r.getWorldScaleX(),s.scale.y=r.getWorldScaleY(),s.rotation=r.getWorldRotationX()*se.DEG_TO_RAD,s.alpha=this.skeleton.color.a*t.color.a}}_getCachedData(e,t){return this.attachmentCacheData[e.data.index][t.name]||this.initCachedData(e,t)}initCachedData(e,t){let s;return t instanceof O?(s=new Float32Array(8),this.attachmentCacheData[e.data.index][t.name]={id:`${e.data.index}-${t.name}`,vertices:s,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(t.uvs.length),color:new _(1,1,1,1),darkColor:new _(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:t.region?.texture.texture}):(s=new Float32Array(t.worldVerticesLength),this.attachmentCacheData[e.data.index][t.name]={id:`${e.data.index}-${t.name}`,vertices:s,clipped:!1,indices:t.triangles,uvs:new Float32Array(t.uvs.length),color:new _(1,1,1,1),darkColor:new _(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:t.region?.texture.texture}),this.attachmentCacheData[e.data.index][t.name]}onViewUpdate(){if(this._didChangeId+=1<<12,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(e,t){e=this.getSlotFromRef(e);for(const r in this._slotsObject)this._slotsObject[r]?.container===t&&this.removeSlotObject(this._slotsObject[r].slot);this.removeSlotObject(e),t.includeInBuild=!1,this.addChild(t);const s={container:t,slot:e};this._slotsObject[e.data.name]=s,this.updateSlotObject(s)}removeSlotObject(e){let t;if(e instanceof se.Container){for(const s in this._slotsObject)if(this._slotsObject[s]?.container===e){this._slotsObject[s]=null,t=e;break}}else{const s=this.getSlotFromRef(e);t=this._slotsObject[s.data.name]?.container,this._slotsObject[s.data.name]=null}t&&(this.removeChild(t),t.includeInBuild=!0)}getSlotObject(e){return e=this.getSlotFromRef(e),this._slotsObject[e.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new ds;const e=this.skeletonBounds;if(e.update(this.skeleton,!0),e.minX===1/0){this._applyState();const t=this.skeleton.drawOrder,s=this._bounds;s.clear();for(let r=0;r<t.length;r++){const n=t[r],h=n.getAttachment();if(h&&(h instanceof O||h instanceof le)){const o=this._getCachedData(n,h);s.addVertexData(o.vertices,0,o.vertices.length)}}}else this._bounds.minX=e.minX,this._bounds.minY=e.minY,this._bounds.maxX=e.maxX,this._bounds.maxY=e.maxY}addBounds(e){e.addBounds(this.bounds)}destroy(e=!1){super.destroy(e),se.Ticker.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(e){this.worldTransform.apply(e,e)}pixiWorldCoordinatesToSkeleton(e){this.worldTransform.applyInverse(e,e)}pixiWorldCoordinatesToBone(e,t){this.pixiWorldCoordinatesToSkeleton(e),t.parent?t.parent.worldToLocal(e):t.worldToLocal(e)}static from({skeleton:e,atlas:t,scale:s=1,darkTint:r,autoUpdate:n=!0}){const h=`${e}-${t}-${s}`;if(se.Cache.has(h))return new ms(se.Cache.get(h));const o=se.Assets.get(e),i=se.Assets.get(t),l=new Ls(i),a=o instanceof Uint8Array?new Ws(l):new Gs(l);a.scale=s;const c=a.readSkeletonData(o);return se.Cache.set(h,c),new ms({skeletonData:c,darkTint:r,autoUpdate:n})}},re=xe("pixi.js"),di=class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(e){if(this.registeredSpines.has(e)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);return}const t={parentDebugContainer:new re.Container,bones:new re.Container,skeletonXY:new re.Graphics,regionAttachmentsShape:new re.Graphics,meshTrianglesLine:new re.Graphics,meshHullLine:new re.Graphics,clippingPolygon:new re.Graphics,boundingBoxesRect:new re.Graphics,boundingBoxesCircle:new re.Graphics,boundingBoxesPolygon:new re.Graphics,pathsCurve:new re.Graphics,pathsLine:new re.Graphics,eventText:new re.Container,eventCallback:{event:(s,r)=>{if(this.drawEvents){const n=Math.abs(e.scale.x||e.scale.y||1),h=new re.Text({text:r.data.name,style:{fontSize:this.eventFontSize/n,fill:this.eventFontColor,fontFamily:"monospace"}});h.scale.x=Math.sign(e.scale.x),h.anchor.set(.5),t.eventText.addChild(h),setTimeout(()=>{h.destroyed||h.destroy()},250)}}}};t.parentDebugContainer.addChild(t.bones),t.parentDebugContainer.addChild(t.skeletonXY),t.parentDebugContainer.addChild(t.regionAttachmentsShape),t.parentDebugContainer.addChild(t.meshTrianglesLine),t.parentDebugContainer.addChild(t.meshHullLine),t.parentDebugContainer.addChild(t.clippingPolygon),t.parentDebugContainer.addChild(t.boundingBoxesRect),t.parentDebugContainer.addChild(t.boundingBoxesCircle),t.parentDebugContainer.addChild(t.boundingBoxesPolygon),t.parentDebugContainer.addChild(t.pathsCurve),t.parentDebugContainer.addChild(t.pathsLine),t.parentDebugContainer.addChild(t.eventText),t.parentDebugContainer.zIndex=9999999,t.parentDebugContainer.accessibleChildren=!1,t.parentDebugContainer.eventMode="none",t.parentDebugContainer.interactiveChildren=!1,e.addChild(t.parentDebugContainer),e.state.addListener(t.eventCallback),this.registeredSpines.set(e,t)}renderDebug(e){this.registeredSpines.has(e)||this.registerSpine(e);const t=this.registeredSpines.get(e);if(!t)return;e.addChild(t.parentDebugContainer),t.skeletonXY.clear(),t.regionAttachmentsShape.clear(),t.meshTrianglesLine.clear(),t.meshHullLine.clear(),t.clippingPolygon.clear(),t.boundingBoxesRect.clear(),t.boundingBoxesCircle.clear(),t.boundingBoxesPolygon.clear(),t.pathsCurve.clear(),t.pathsLine.clear();for(let n=t.bones.children.length;n>0;n--)t.bones.children[n-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(e.scale.x||e.scale.y||1),r=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(e,t,r,s),this.drawPaths&&this.drawPathsFunc(e,t,r),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(e,t,r),this.drawClipping&&this.drawClippingFunc(e,t,r),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(e,t,r),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(e,t,r),this.drawEvents)for(const n of t.eventText.children)n.alpha-=.05,n.y-=2}drawBonesFunc(e,t,s,r){const n=e.skeleton,h=n.x,o=n.y,i=n.bones;t.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let a=0,c=i.length;a<c;a++){const d=i[a],f=d.data.length,u=h+d.worldX,m=o+d.worldY,p=h+f*d.a+d.worldX,w=o+f*d.b+d.worldY;if(d.data.name==="root"||d.data.parent===null)continue;const b=Math.abs(u-p),g=Math.abs(m-w),x=Math.pow(b,2),v=g,y=Math.pow(g,2),C=Math.sqrt(x+y),S=Math.pow(C,2),A=Math.PI/180,M=Math.acos((S+y-x)/(2*v*C))||0;if(C===0)continue;const T=new re.Graphics;t.bones.addChild(T);const X=C/50/r;T.context.poly([0,0,0-X,C-X*3,0,C-X,0+X,C-X*3]).fill(this.bonesColor),T.x=u,T.y=m,T.pivot.y=C;let F=0;u<p&&m<w?F=-M+180*A:u>p&&m<w?F=180*A+M:u>p&&m>w?F=-M:u<p&&m>w?F=M:m===w&&u<p?F=90*A:m===w&&u>p?F=-90*A:u===p&&m<w?F=180*A:u===p&&m>w&&(F=0),T.rotation=F,T.circle(0,C,X*1.2).fill({color:0,alpha:.6}).stroke({width:s+X/2.4,color:this.bonesColor})}const l=s*3;t.skeletonXY.context.moveTo(h-l,o-l).lineTo(h+l,o+l).moveTo(h+l,o-l).lineTo(h-l,o+l).stroke()}drawRegionAttachmentsFunc(e,t,s){const n=e.skeleton.slots;for(let h=0,o=n.length;h<o;h++){const i=n[h],l=i.getAttachment();if(l===null||!(l instanceof O))continue;const a=l,c=new Float32Array(8);a.computeWorldVertices(i,c,0,2),t.regionAttachmentsShape.poly(Array.from(c.slice(0,8)))}t.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(e,t,s){const n=e.skeleton.slots;for(let h=0,o=n.length;h<o;h++){const i=n[h];if(!i.bone.active)continue;const l=i.getAttachment();if(l===null||!(l instanceof le))continue;const a=l,c=new Float32Array(a.worldVerticesLength),d=a.triangles;let f=a.hullLength;if(a.computeWorldVertices(i,0,a.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let u=0,m=d.length;u<m;u+=3){const p=d[u]*2,w=d[u+1]*2,b=d[u+2]*2;t.meshTrianglesLine.context.moveTo(c[p],c[p+1]).lineTo(c[w],c[w+1]).lineTo(c[b],c[b+1])}if(this.drawMeshHull&&f>0){f=(f>>1)*2;let u=c[f-2],m=c[f-1];for(let p=0,w=f;p<w;p+=2){const b=c[p],g=c[p+1];t.meshHullLine.context.moveTo(b,g).lineTo(u,m),u=b,m=g}}}t.meshHullLine.stroke({width:s,color:this.meshHullColor}),t.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(e,t,s){const n=e.skeleton.slots;for(let h=0,o=n.length;h<o;h++){const i=n[h];if(!i.bone.active)continue;const l=i.getAttachment();if(l===null||!(l instanceof ve))continue;const a=l,c=a.worldVerticesLength,d=new Float32Array(c);a.computeWorldVertices(i,0,c,d,0,2),t.clippingPolygon.poly(Array.from(d))}t.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(e,t,s){const r=new ds;r.update(e.skeleton,!0),r.minX!==1/0&&t.boundingBoxesRect.rect(r.minX,r.minY,r.getWidth(),r.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const n=r.polygons,h=(o,i,l)=>{if(l<3)throw new Error("Polygon must contain at least 3 vertices");const a=[],c=s*2;for(let d=0,f=o.length;d<f;d+=2){const u=o[d],m=o[d+1];t.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),t.boundingBoxesCircle.drawCircle(u,m,c),t.boundingBoxesCircle.fill(0),t.boundingBoxesCircle.circle(u,m,c).fill({color:this.boundingBoxesCircleColor}),a.push(u,m)}t.boundingBoxesPolygon.poly(a).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let o=0,i=n.length;o<i;o++){const l=n[o];h(l,0,l.length)}}drawPathsFunc(e,t,s){const n=e.skeleton.slots;for(let h=0,o=n.length;h<o;h++){const i=n[h];if(!i.bone.active)continue;const l=i.getAttachment();if(l===null||!(l instanceof Ye))continue;const a=l;let c=a.worldVerticesLength;const d=new Float32Array(c);a.computeWorldVertices(i,0,c,d,0,2);let f=d[2],u=d[3],m=0,p=0;if(a.closed){const w=d[0],b=d[1],g=d[c-2],x=d[c-1];m=d[c-4],p=d[c-3],t.pathsCurve.moveTo(f,u),t.pathsCurve.bezierCurveTo(w,b,g,x,m,p),t.pathsLine.moveTo(f,u),t.pathsLine.lineTo(w,b),t.pathsLine.moveTo(m,p),t.pathsLine.lineTo(g,x)}c-=4;for(let w=4;w<c;w+=6){const b=d[w],g=d[w+1],x=d[w+2],v=d[w+3];m=d[w+4],p=d[w+5],t.pathsCurve.moveTo(f,u),t.pathsCurve.bezierCurveTo(b,g,x,v,m,p),t.pathsLine.moveTo(f,u),t.pathsLine.lineTo(b,g),t.pathsLine.moveTo(m,p),t.pathsLine.lineTo(x,v),f=m,u=p}}t.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),t.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(e){this.registeredSpines.has(e)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",e);const t=this.registeredSpines.get(e);t&&(e.state.removeListener(t.eventCallback),t.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(e))}};return lr(xs)})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esotericsoftware/spine-pixi-v8",
3
- "version": "4.2.63",
3
+ "version": "4.2.64",
4
4
  "description": "The official Spine Runtimes for PixiJS v8.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme",
33
33
  "dependencies": {
34
- "@esotericsoftware/spine-core": "4.2.63"
34
+ "@esotericsoftware/spine-core": "4.2.64"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "pixi.js": "^8.4.0"