infernojs 0.0.1

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.
@@ -0,0 +1,69 @@
1
+ import { Vector2D, Rectangle, AABB, Circle } from './types.mjs';
2
+
3
+ /**
4
+ * Create a new vector
5
+ */
6
+ declare function vec2(x: number, y: number): Vector2D;
7
+ /**
8
+ * Vector addition
9
+ */
10
+ declare function add(a: Vector2D, b: Vector2D): Vector2D;
11
+ /**
12
+ * Vector subtraction
13
+ */
14
+ declare function subtract(a: Vector2D, b: Vector2D): Vector2D;
15
+ /**
16
+ * Vector scaling
17
+ */
18
+ declare function scale(v: Vector2D, scalar: number): Vector2D;
19
+ /**
20
+ * Dot product of two vectors
21
+ */
22
+ declare function dot(a: Vector2D, b: Vector2D): number;
23
+ /**
24
+ * Cross product magnitude of two 2D vectors
25
+ */
26
+ declare function cross(a: Vector2D, b: Vector2D): number;
27
+ /**
28
+ * Get squared length of a vector (avoids sqrt for performance)
29
+ */
30
+ declare function lengthSquared(v: Vector2D): number;
31
+ /**
32
+ * Get vector length
33
+ */
34
+ declare function length(v: Vector2D): number;
35
+ /**
36
+ * Normalize a vector (make it unit length)
37
+ */
38
+ declare function normalize(v: Vector2D): Vector2D;
39
+ /**
40
+ * Distance squared between two points (avoids sqrt for performance)
41
+ */
42
+ declare function distanceSquared(a: Vector2D, b: Vector2D): number;
43
+ /**
44
+ * Distance between two points
45
+ */
46
+ declare function distance(a: Vector2D, b: Vector2D): number;
47
+ /**
48
+ * Create an AABB from a rectangle
49
+ */
50
+ declare function rectToAABB(rect: Rectangle): AABB;
51
+ /**
52
+ * Create an AABB from a circle
53
+ */
54
+ declare function circleToAABB(circle: Circle): AABB;
55
+ /**
56
+ * Check if two AABBs intersect
57
+ */
58
+ declare function aabbIntersect(a: AABB, b: AABB): boolean;
59
+ /**
60
+ * Calculate cell indices for a position in a spatial grid
61
+ */
62
+ declare function positionToCell(position: Vector2D, cellSize: number): [number, number];
63
+ /**
64
+ * Calculate a unique cell ID from grid coordinates
65
+ * Uses a spatial hashing function to convert 2D coordinates to 1D
66
+ */
67
+ declare function cellToId(x: number, y: number): number;
68
+
69
+ export { aabbIntersect, add, cellToId, circleToAABB, cross, distance, distanceSquared, dot, length, lengthSquared, normalize, positionToCell, rectToAABB, scale, subtract, vec2 };
@@ -0,0 +1,69 @@
1
+ import { Vector2D, Rectangle, AABB, Circle } from './types.js';
2
+
3
+ /**
4
+ * Create a new vector
5
+ */
6
+ declare function vec2(x: number, y: number): Vector2D;
7
+ /**
8
+ * Vector addition
9
+ */
10
+ declare function add(a: Vector2D, b: Vector2D): Vector2D;
11
+ /**
12
+ * Vector subtraction
13
+ */
14
+ declare function subtract(a: Vector2D, b: Vector2D): Vector2D;
15
+ /**
16
+ * Vector scaling
17
+ */
18
+ declare function scale(v: Vector2D, scalar: number): Vector2D;
19
+ /**
20
+ * Dot product of two vectors
21
+ */
22
+ declare function dot(a: Vector2D, b: Vector2D): number;
23
+ /**
24
+ * Cross product magnitude of two 2D vectors
25
+ */
26
+ declare function cross(a: Vector2D, b: Vector2D): number;
27
+ /**
28
+ * Get squared length of a vector (avoids sqrt for performance)
29
+ */
30
+ declare function lengthSquared(v: Vector2D): number;
31
+ /**
32
+ * Get vector length
33
+ */
34
+ declare function length(v: Vector2D): number;
35
+ /**
36
+ * Normalize a vector (make it unit length)
37
+ */
38
+ declare function normalize(v: Vector2D): Vector2D;
39
+ /**
40
+ * Distance squared between two points (avoids sqrt for performance)
41
+ */
42
+ declare function distanceSquared(a: Vector2D, b: Vector2D): number;
43
+ /**
44
+ * Distance between two points
45
+ */
46
+ declare function distance(a: Vector2D, b: Vector2D): number;
47
+ /**
48
+ * Create an AABB from a rectangle
49
+ */
50
+ declare function rectToAABB(rect: Rectangle): AABB;
51
+ /**
52
+ * Create an AABB from a circle
53
+ */
54
+ declare function circleToAABB(circle: Circle): AABB;
55
+ /**
56
+ * Check if two AABBs intersect
57
+ */
58
+ declare function aabbIntersect(a: AABB, b: AABB): boolean;
59
+ /**
60
+ * Calculate cell indices for a position in a spatial grid
61
+ */
62
+ declare function positionToCell(position: Vector2D, cellSize: number): [number, number];
63
+ /**
64
+ * Calculate a unique cell ID from grid coordinates
65
+ * Uses a spatial hashing function to convert 2D coordinates to 1D
66
+ */
67
+ declare function cellToId(x: number, y: number): number;
68
+
69
+ export { aabbIntersect, add, cellToId, circleToAABB, cross, distance, distanceSquared, dot, length, lengthSquared, normalize, positionToCell, rectToAABB, scale, subtract, vec2 };
package/dist/utils.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var u=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var D=(r,t)=>{for(var e in t)u(r,e,{get:t[e],enumerable:!0})},V=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of m(t))!f.call(r,o)&&o!==e&&u(r,o,{get:()=>t[o],enumerable:!(n=y(t,o))||n.enumerable});return r};var p=r=>V(u({},"__esModule",{value:!0}),r);var I={};D(I,{aabbIntersect:()=>M,add:()=>a,cellToId:()=>C,circleToAABB:()=>q,cross:()=>b,distance:()=>l,distanceSquared:()=>i,dot:()=>B,length:()=>c,lengthSquared:()=>x,normalize:()=>h,positionToCell:()=>T,rectToAABB:()=>g,scale:()=>A,subtract:()=>d,vec2:()=>s});module.exports=p(I);function s(r,t){return{x:r,y:t}}function a(r,t){return{x:r.x+t.x,y:r.y+t.y}}function d(r,t){return{x:r.x-t.x,y:r.y-t.y}}function A(r,t){return{x:r.x*t,y:r.y*t}}function B(r,t){return r.x*t.x+r.y*t.y}function b(r,t){return r.x*t.y-r.y*t.x}function x(r){return r.x*r.x+r.y*r.y}function c(r){return Math.sqrt(x(r))}function h(r){let t=c(r);return t<1e-10?{x:0,y:0}:{x:r.x/t,y:r.y/t}}function i(r,t){let e=t.x-r.x,n=t.y-r.y;return e*e+n*n}function l(r,t){return Math.sqrt(i(r,t))}function g(r){return{min:{x:r.position.x,y:r.position.y},max:{x:r.position.x+r.width,y:r.position.y+r.height}}}function q(r){return{min:{x:r.center.x-r.radius,y:r.center.y-r.radius},max:{x:r.center.x+r.radius,y:r.center.y+r.radius}}}function M(r,t){return!(r.max.x<t.min.x||r.min.x>t.max.x||r.max.y<t.min.y||r.min.y>t.max.y)}function T(r,t){return[Math.floor(r.x/t),Math.floor(r.y/t)]}function C(r,t){return(r+t)*(r+t+1)/2+t}0&&(module.exports={aabbIntersect,add,cellToId,circleToAABB,cross,distance,distanceSquared,dot,length,lengthSquared,normalize,positionToCell,rectToAABB,scale,subtract,vec2});
2
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts"],"sourcesContent":["import { Vector2D, AABB, Circle, Rectangle } from \"./types\";\n\n/**\n * Create a new vector\n */\nexport function vec2(x: number, y: number): Vector2D {\n return { x, y };\n}\n\n/**\n * Vector addition\n */\nexport function add(a: Vector2D, b: Vector2D): Vector2D {\n return { x: a.x + b.x, y: a.y + b.y };\n}\n\n/**\n * Vector subtraction\n */\nexport function subtract(a: Vector2D, b: Vector2D): Vector2D {\n return { x: a.x - b.x, y: a.y - b.y };\n}\n\n/**\n * Vector scaling\n */\nexport function scale(v: Vector2D, scalar: number): Vector2D {\n return { x: v.x * scalar, y: v.y * scalar };\n}\n\n/**\n * Dot product of two vectors\n */\nexport function dot(a: Vector2D, b: Vector2D): number {\n return a.x * b.x + a.y * b.y;\n}\n\n/**\n * Cross product magnitude of two 2D vectors\n */\nexport function cross(a: Vector2D, b: Vector2D): number {\n return a.x * b.y - a.y * b.x;\n}\n\n/**\n * Get squared length of a vector (avoids sqrt for performance)\n */\nexport function lengthSquared(v: Vector2D): number {\n return v.x * v.x + v.y * v.y;\n}\n\n/**\n * Get vector length\n */\nexport function length(v: Vector2D): number {\n return Math.sqrt(lengthSquared(v));\n}\n\n/**\n * Normalize a vector (make it unit length)\n */\nexport function normalize(v: Vector2D): Vector2D {\n const len = length(v);\n // Avoid division by zero\n if (len < 1e-10) return { x: 0, y: 0 };\n return { x: v.x / len, y: v.y / len };\n}\n\n/**\n * Distance squared between two points (avoids sqrt for performance)\n */\nexport function distanceSquared(a: Vector2D, b: Vector2D): number {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n return dx * dx + dy * dy;\n}\n\n/**\n * Distance between two points\n */\nexport function distance(a: Vector2D, b: Vector2D): number {\n return Math.sqrt(distanceSquared(a, b));\n}\n\n/**\n * Create an AABB from a rectangle\n */\nexport function rectToAABB(rect: Rectangle): AABB {\n return {\n min: { x: rect.position.x, y: rect.position.y },\n max: { x: rect.position.x + rect.width, y: rect.position.y + rect.height },\n };\n}\n\n/**\n * Create an AABB from a circle\n */\nexport function circleToAABB(circle: Circle): AABB {\n return {\n min: {\n x: circle.center.x - circle.radius,\n y: circle.center.y - circle.radius,\n },\n max: {\n x: circle.center.x + circle.radius,\n y: circle.center.y + circle.radius,\n },\n };\n}\n\n/**\n * Check if two AABBs intersect\n */\nexport function aabbIntersect(a: AABB, b: AABB): boolean {\n // Exit with no intersection if separated along an axis\n if (a.max.x < b.min.x || a.min.x > b.max.x) return false;\n if (a.max.y < b.min.y || a.min.y > b.max.y) return false;\n\n // Overlapping on all axes means AABBs are intersecting\n return true;\n}\n\n/**\n * Calculate cell indices for a position in a spatial grid\n */\nexport function positionToCell(\n position: Vector2D,\n cellSize: number,\n): [number, number] {\n return [Math.floor(position.x / cellSize), Math.floor(position.y / cellSize)];\n}\n\n/**\n * Calculate a unique cell ID from grid coordinates\n * Uses a spatial hashing function to convert 2D coordinates to 1D\n */\nexport function cellToId(x: number, y: number): number {\n // Cantor pairing function - maps two non-negative integers to a unique non-negative integer\n return ((x + y) * (x + y + 1)) / 2 + y;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,QAAAC,EAAA,aAAAC,EAAA,iBAAAC,EAAA,UAAAC,EAAA,aAAAC,EAAA,oBAAAC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M,EAAKL,EAAE,EAAID,EAAE,EACnB,OAAOK,EAAKA,EAAKC,EAAKA,CACxB,CAKO,SAASpB,EAASc,EAAaC,EAAqB,CACzD,OAAO,KAAK,KAAKd,EAAgBa,EAAGC,CAAC,CAAC,CACxC,CAKO,SAASR,EAAWc,EAAuB,CAChD,MAAO,CACL,IAAK,CAAE,EAAGA,EAAK,SAAS,EAAG,EAAGA,EAAK,SAAS,CAAE,EAC9C,IAAK,CAAE,EAAGA,EAAK,SAAS,EAAIA,EAAK,MAAO,EAAGA,EAAK,SAAS,EAAIA,EAAK,MAAO,CAC3E,CACF,CAKO,SAASvB,EAAawB,EAAsB,CACjD,MAAO,CACL,IAAK,CACH,EAAGA,EAAO,OAAO,EAAIA,EAAO,OAC5B,EAAGA,EAAO,OAAO,EAAIA,EAAO,MAC9B,EACA,IAAK,CACH,EAAGA,EAAO,OAAO,EAAIA,EAAO,OAC5B,EAAGA,EAAO,OAAO,EAAIA,EAAO,MAC9B,CACF,CACF,CAKO,SAAS3B,EAAcmB,EAASC,EAAkB,CAGvD,MADI,EAAAD,EAAE,IAAI,EAAIC,EAAE,IAAI,GAAKD,EAAE,IAAI,EAAIC,EAAE,IAAI,GACrCD,EAAE,IAAI,EAAIC,EAAE,IAAI,GAAKD,EAAE,IAAI,EAAIC,EAAE,IAAI,EAI3C,CAKO,SAAST,EACdiB,EACAC,EACkB,CAClB,MAAO,CAAC,KAAK,MAAMD,EAAS,EAAIC,CAAQ,EAAG,KAAK,MAAMD,EAAS,EAAIC,CAAQ,CAAC,CAC9E,CAMO,SAAS3B,EAASe,EAAWC,EAAmB,CAErD,OAASD,EAAIC,IAAMD,EAAIC,EAAI,GAAM,EAAIA,CACvC","names":["utils_exports","__export","aabbIntersect","add","cellToId","circleToAABB","cross","distance","distanceSquared","dot","length","lengthSquared","normalize","positionToCell","rectToAABB","scale","subtract","vec2","__toCommonJS","x","y","a","b","v","scalar","len","dx","dy","rect","circle","position","cellSize"]}
package/dist/utils.mjs ADDED
@@ -0,0 +1,2 @@
1
+ function c(r,t){return{x:r,y:t}}function i(r,t){return{x:r.x+t.x,y:r.y+t.y}}function y(r,t){return{x:r.x-t.x,y:r.y-t.y}}function m(r,t){return{x:r.x*t,y:r.y*t}}function f(r,t){return r.x*t.x+r.y*t.y}function D(r,t){return r.x*t.y-r.y*t.x}function o(r){return r.x*r.x+r.y*r.y}function u(r){return Math.sqrt(o(r))}function V(r){let t=u(r);return t<1e-10?{x:0,y:0}:{x:r.x/t,y:r.y/t}}function x(r,t){let e=t.x-r.x,n=t.y-r.y;return e*e+n*n}function p(r,t){return Math.sqrt(x(r,t))}function s(r){return{min:{x:r.position.x,y:r.position.y},max:{x:r.position.x+r.width,y:r.position.y+r.height}}}function a(r){return{min:{x:r.center.x-r.radius,y:r.center.y-r.radius},max:{x:r.center.x+r.radius,y:r.center.y+r.radius}}}function d(r,t){return!(r.max.x<t.min.x||r.min.x>t.max.x||r.max.y<t.min.y||r.min.y>t.max.y)}function A(r,t){return[Math.floor(r.x/t),Math.floor(r.y/t)]}function B(r,t){return(r+t)*(r+t+1)/2+t}export{d as aabbIntersect,i as add,B as cellToId,a as circleToAABB,D as cross,p as distance,x as distanceSquared,f as dot,u as length,o as lengthSquared,V as normalize,A as positionToCell,s as rectToAABB,m as scale,y as subtract,c as vec2};
2
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts"],"sourcesContent":["import { Vector2D, AABB, Circle, Rectangle } from \"./types\";\n\n/**\n * Create a new vector\n */\nexport function vec2(x: number, y: number): Vector2D {\n return { x, y };\n}\n\n/**\n * Vector addition\n */\nexport function add(a: Vector2D, b: Vector2D): Vector2D {\n return { x: a.x + b.x, y: a.y + b.y };\n}\n\n/**\n * Vector subtraction\n */\nexport function subtract(a: Vector2D, b: Vector2D): Vector2D {\n return { x: a.x - b.x, y: a.y - b.y };\n}\n\n/**\n * Vector scaling\n */\nexport function scale(v: Vector2D, scalar: number): Vector2D {\n return { x: v.x * scalar, y: v.y * scalar };\n}\n\n/**\n * Dot product of two vectors\n */\nexport function dot(a: Vector2D, b: Vector2D): number {\n return a.x * b.x + a.y * b.y;\n}\n\n/**\n * Cross product magnitude of two 2D vectors\n */\nexport function cross(a: Vector2D, b: Vector2D): number {\n return a.x * b.y - a.y * b.x;\n}\n\n/**\n * Get squared length of a vector (avoids sqrt for performance)\n */\nexport function lengthSquared(v: Vector2D): number {\n return v.x * v.x + v.y * v.y;\n}\n\n/**\n * Get vector length\n */\nexport function length(v: Vector2D): number {\n return Math.sqrt(lengthSquared(v));\n}\n\n/**\n * Normalize a vector (make it unit length)\n */\nexport function normalize(v: Vector2D): Vector2D {\n const len = length(v);\n // Avoid division by zero\n if (len < 1e-10) return { x: 0, y: 0 };\n return { x: v.x / len, y: v.y / len };\n}\n\n/**\n * Distance squared between two points (avoids sqrt for performance)\n */\nexport function distanceSquared(a: Vector2D, b: Vector2D): number {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n return dx * dx + dy * dy;\n}\n\n/**\n * Distance between two points\n */\nexport function distance(a: Vector2D, b: Vector2D): number {\n return Math.sqrt(distanceSquared(a, b));\n}\n\n/**\n * Create an AABB from a rectangle\n */\nexport function rectToAABB(rect: Rectangle): AABB {\n return {\n min: { x: rect.position.x, y: rect.position.y },\n max: { x: rect.position.x + rect.width, y: rect.position.y + rect.height },\n };\n}\n\n/**\n * Create an AABB from a circle\n */\nexport function circleToAABB(circle: Circle): AABB {\n return {\n min: {\n x: circle.center.x - circle.radius,\n y: circle.center.y - circle.radius,\n },\n max: {\n x: circle.center.x + circle.radius,\n y: circle.center.y + circle.radius,\n },\n };\n}\n\n/**\n * Check if two AABBs intersect\n */\nexport function aabbIntersect(a: AABB, b: AABB): boolean {\n // Exit with no intersection if separated along an axis\n if (a.max.x < b.min.x || a.min.x > b.max.x) return false;\n if (a.max.y < b.min.y || a.min.y > b.max.y) return false;\n\n // Overlapping on all axes means AABBs are intersecting\n return true;\n}\n\n/**\n * Calculate cell indices for a position in a spatial grid\n */\nexport function positionToCell(\n position: Vector2D,\n cellSize: number,\n): [number, number] {\n return [Math.floor(position.x / cellSize), Math.floor(position.y / cellSize)];\n}\n\n/**\n * Calculate a unique cell ID from grid coordinates\n * Uses a spatial hashing function to convert 2D coordinates to 1D\n */\nexport function cellToId(x: number, y: number): number {\n // Cantor pairing function - maps two non-negative integers to a unique non-negative integer\n return ((x + y) * (x + y + 1)) / 2 + y;\n}\n"],"mappings":"AAKO,SAASA,EAAKC,EAAWC,EAAqB,CACnD,MAAO,CAAE,EAAAD,EAAG,EAAAC,CAAE,CAChB,CAKO,SAASC,EAAIC,EAAaC,EAAuB,CACtD,MAAO,CAAE,EAAGD,EAAE,EAAIC,EAAE,EAAG,EAAGD,EAAE,EAAIC,EAAE,CAAE,CACtC,CAKO,SAASC,EAASF,EAAaC,EAAuB,CAC3D,MAAO,CAAE,EAAGD,EAAE,EAAIC,EAAE,EAAG,EAAGD,EAAE,EAAIC,EAAE,CAAE,CACtC,CAKO,SAASE,EAAMC,EAAaC,EAA0B,CAC3D,MAAO,CAAE,EAAGD,EAAE,EAAIC,EAAQ,EAAGD,EAAE,EAAIC,CAAO,CAC5C,CAKO,SAASC,EAAIN,EAAaC,EAAqB,CACpD,OAAOD,EAAE,EAAIC,EAAE,EAAID,EAAE,EAAIC,EAAE,CAC7B,CAKO,SAASM,EAAMP,EAAaC,EAAqB,CACtD,OAAOD,EAAE,EAAIC,EAAE,EAAID,EAAE,EAAIC,EAAE,CAC7B,CAKO,SAASO,EAAcJ,EAAqB,CACjD,OAAOA,EAAE,EAAIA,EAAE,EAAIA,EAAE,EAAIA,EAAE,CAC7B,CAKO,SAASK,EAAOL,EAAqB,CAC1C,OAAO,KAAK,KAAKI,EAAcJ,CAAC,CAAC,CACnC,CAKO,SAASM,EAAUN,EAAuB,CAC/C,IAAMO,EAAMF,EAAOL,CAAC,EAEpB,OAAIO,EAAM,MAAc,CAAE,EAAG,EAAG,EAAG,CAAE,E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scalar","dot","cross","lengthSquared","length","normalize","len","distanceSquared","dx","dy","distance","rectToAABB","rect","circleToAABB","circle","aabbIntersect","positionToCell","position","cellSize","cellToId"]}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "infernojs",
3
+ "version": "0.0.1",
4
+ "description": "A spicy, high-performance library for building 2D games in JavaScript",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "scripts": {
15
+ "build": "tsup",
16
+ "dev": "tsup --watch",
17
+ "typecheck": "tsc --noEmit",
18
+ "test": "vitest run",
19
+ "test:watch": "vitest",
20
+ "bench": "vitest bench",
21
+ "bench:watch": "vitest bench --watch",
22
+ "lint": "eslint \"src/**/*.ts\" --fix",
23
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
24
+ "prepublishOnly": "npm run lint && npm run format && npm run test && npm run build",
25
+ "example": "node examples/basic-collision.js",
26
+ "example:detectors": "node examples/collision-detectors.js"
27
+ },
28
+ "keywords": [
29
+ "2d",
30
+ "game",
31
+ "collision",
32
+ "detection",
33
+ "physics",
34
+ "performance"
35
+ ],
36
+ "author": "",
37
+ "license": "MIT",
38
+ "devDependencies": {
39
+ "@types/node": "^20.11.5",
40
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
41
+ "@typescript-eslint/parser": "^6.19.0",
42
+ "eslint": "^8.56.0",
43
+ "eslint-config-prettier": "^10.0.2",
44
+ "eslint-plugin-prettier": "^5.2.3",
45
+ "prettier": "^3.5.3",
46
+ "ts-node": "^10.9.2",
47
+ "tsup": "^8.0.1",
48
+ "typescript": "^5.3.3",
49
+ "vitest": "^1.2.1"
50
+ },
51
+ "engines": {
52
+ "node": ">=14.0.0"
53
+ }
54
+ }