adofai 2.9.13 → 2.9.15

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 (46) hide show
  1. package/dist/src/effectProcessor.d.ts +32 -0
  2. package/dist/src/effectProcessor.js +89 -0
  3. package/dist/src/format.d.ts +8 -0
  4. package/dist/src/format.js +46 -0
  5. package/dist/src/index.d.ts +5 -0
  6. package/dist/src/index.js +48 -0
  7. package/dist/src/parser/ArrayBufferParser.d.ts +9 -0
  8. package/dist/src/parser/ArrayBufferParser.js +108 -0
  9. package/dist/src/parser/BufferParser.d.ts +9 -0
  10. package/dist/src/parser/BufferParser.js +102 -0
  11. package/{src/parser/Parser.ts → dist/src/parser/Parser.d.ts} +5 -6
  12. package/dist/src/parser/Parser.js +5 -0
  13. package/dist/src/parser/StringParser.d.ts +7 -0
  14. package/{src/parser/StringParser.ts → dist/src/parser/StringParser.js} +448 -438
  15. package/dist/src/parser/index.d.ts +16 -0
  16. package/dist/src/parser/index.js +28 -0
  17. package/{src/parser.ts → dist/src/parser.d.ts} +1 -2
  18. package/dist/src/parser.js +14 -0
  19. package/dist/src/pathdata.d.ts +13 -0
  20. package/dist/src/pathdata.js +16 -0
  21. package/dist/src/presets.d.ts +10 -0
  22. package/{src/presets.ts → dist/src/presets.js} +12 -19
  23. package/dist/src/structure/Level.d.ts +54 -0
  24. package/dist/src/structure/Level.js +387 -0
  25. package/{src/structure/interfaces.ts → dist/src/structure/interfaces.d.ts} +33 -38
  26. package/dist/src/structure/interfaces.js +2 -0
  27. package/{src/structure.ts → dist/src/structure.d.ts} +4 -6
  28. package/dist/src/structure.js +4 -0
  29. package/dist/umd/index.js +2 -0
  30. package/dist/umd/index.js.LICENSE.txt +1 -0
  31. package/package.json +8 -4
  32. package/.babelrc +0 -5
  33. package/index.ts +0 -12
  34. package/src/effectProcessor.ts +0 -82
  35. package/src/format.ts +0 -69
  36. package/src/parser/ArrayBufferParser.ts +0 -101
  37. package/src/parser/BufferParser.ts +0 -93
  38. package/src/parser/index.ts +0 -28
  39. package/src/pathdata.ts +0 -20
  40. package/src/structure/Level.ts +0 -351
  41. package/src/structure.ts.bak +0 -412
  42. package/test/Buffer.js +0 -2030
  43. package/test/editor.html +0 -501
  44. package/test/index.html +0 -31
  45. package/tsconfig.json +0 -17
  46. package/webpack.config.mjs +0 -35
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,4 @@
1
- import { Level } from './structure/Level';
2
- import { AdofaiEvent, LevelOptions, EventCallback, GuidCallback, Tile, ParseProvider } from './structure/interfaces';
3
-
4
- export { AdofaiEvent, LevelOptions, EventCallback, GuidCallback, Tile, ParseProvider };
5
-
6
- export default Level;
1
+ import { Level } from './structure/Level';
2
+ import { AdofaiEvent, LevelOptions, EventCallback, GuidCallback, Tile, ParseProvider } from './structure/interfaces';
3
+ export { AdofaiEvent, LevelOptions, EventCallback, GuidCallback, Tile, ParseProvider };
4
+ export default Level;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Level_1 = require("./structure/Level");
4
+ exports.default = Level_1.Level;
@@ -0,0 +1,2 @@
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ADOFAI=e():t.ADOFAI=e()}(globalThis,(()=>(()=>{"use strict";var t={15:function(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function o(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}function a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(a=function(){return!!t})()}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function s(t,e){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},s(t,e)}var c=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ArrayBufferParser=void 0,e.stripBOM=d,e.normalizeJsonArrayBuffer=v,e.decodeStringFromUTF8BOM=b;var l=c(r(484)),f=c(r(773)),h=new Uint8Array([239,187,191]),p=new Uint8Array([44]),y=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,r){return e=u(e),function(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,a()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(e,t),r=e,(o=[{key:"parse",value:function(t){return"string"==typeof t?f.default.prototype.parse.call(f.default.prototype,t):f.default.prototype.parse.call(f.default.prototype,b(v(d(t))))}},{key:"stringify",value:function(t){return JSON.stringify(t)}}])&&i(r.prototype,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o}(l.default);function d(t){var e=new Uint8Array(t);return e.length>=3&&e[0]===h[0]&&e[1]===h[1]&&e[2]===h[2]?t.slice(3):t}function v(t){for(var e=new Uint8Array(t),r=[],n="other",i=0,o=0;o<e.length;o++){var a=e[o];if("escape"==n)n="string";else switch(a){case 34:switch(n){case"string":n="other";break;case"comma":r.push(p);default:n="string"}break;case 92:"string"===n&&(n="escape");break;case 44:r.push(e.subarray(i,o)),i=o+1,"other"===n&&(n="comma");break;case 93:case 125:"comma"===n&&(n="other");break;case 9:case 10:case 11:case 12:case 13:case 32:break;default:"comma"===n&&(r.push(p),n="other")}}r.push(e.subarray(i));for(var u=0,s=0,c=r;s<c.length;s++)u+=c[s].length;for(var l=new Uint8Array(u),f=0,h=0,y=r;h<y.length;h++){var d=y[h];l.set(d,f),f+=d.length}return l.buffer}function b(t){var e=d(t);return new TextDecoder("utf-8").decode(e)}e.ArrayBufferParser=y,e.default=y},43:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.preset_inner_no_deco=e.preset_noeffect_completely=e.preset_nomovecamera=e.preset_noholds=e.preset_noeffect=void 0,e.preset_noeffect={type:"exclude",events:["Flash","SetFilter","SetFilterAdvanced","HallOfMirrors","Bloom","ScalePlanets","ScreenTile","ScreenScroll","ShakeScreen"]},e.preset_noholds={type:"exclude",events:["Hold"]},e.preset_nomovecamera={type:"exclude",events:["MoveCamera"]},e.preset_noeffect_completely={type:"exclude",events:["AddDecoration","AddText","AddObject","Checkpoint","SetHitsound","PlaySound","SetPlanetRotation","ScalePlanets","ColorTrack","AnimateTrack","RecolorTrack","MoveTrack","PositionTrack","MoveDecorations","SetText","SetObject","SetDefaultText","CustomBackground","Flash","MoveCamera","SetFilter","HallOfMirrors","ShakeScreen","Bloom","ScreenTile","ScreenScroll","SetFrameRate","RepeatEvents","SetConditionalEvents","EditorComment","Bookmark","Hold","SetHoldSound","Hide","ScaleMargin","ScaleRadius"]},e.preset_inner_no_deco={type:"special",events:["MoveDecorations","SetText","SetObject","SetDefaultText"]}},279:function(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function o(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}var a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var u=a(r(773)),s=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return e=t,r=[{key:"parseError",value:function(t){return t}},{key:"parseAsObject",value:function(e,r){return(r||new u.default).parse(t.parseAsText(e))}},{key:"parseAsText",value:function(t){return this.parseError(t)}}],null&&i(e.prototype,null),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r}();e.default=s},314:function(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function o(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}function a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(a=function(){return!!t})()}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function s(t,e){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},s(t,e)}var c=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.BufferParser=void 0,e.stripBOM=d,e.normalizeJsonBuffer=v,e.decodeStringFromUTF8BOM=b;var l,f,h=c(r(484)),p=c(r(773));try{l=Buffer.of(239,187,191),f=Buffer.from(",")}catch(t){console.warn("Buffer is not available in current environment, try to use ArrayBufferParser"),l={equals:function(){return!1},subarray:function(){return null}},f={equals:function(){return!1},subarray:function(){return null}}}var y=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,r){return e=u(e),function(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,a()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(e,t),r=e,(o=[{key:"parse",value:function(t){return"string"==typeof t?p.default.prototype.parse.call(p.default.prototype,t):p.default.prototype.parse.call(p.default.prototype,b(v(d(t))))}},{key:"stringify",value:function(t){return JSON.stringify(t)}}])&&i(r.prototype,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o}(h.default);function d(t){return t.length>=3&&l.equals(t.subarray(0,3))?t.subarray(3):t}function v(t){var e=[],r="other",n=0;return t.forEach((function(i,o){if("escape"==r)r="string";else switch(i){case 34:switch(r){case"string":r="other";break;case"comma":e.push(f);default:r="string"}break;case 92:"string"===r&&(r="escape");break;case 44:e.push(t.subarray(n,o)),n=o+1,"other"===r&&(r="comma");break;case 93:case 125:"comma"===r&&(r="other");break;case 9:case 10:case 11:case 12:case 13:case 32:break;default:"comma"===r&&(e.push(f),r="other")}})),e.push(t.subarray(n)),Buffer.concat(e)}function b(t){return d(t).toString("utf-8")}e.BufferParser=y,e.default=y},427:function(t,e,r){var n,i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||(n=function(t){return n=Object.getOwnPropertyNames||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[e.length]=r);return e},n(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r=n(t),a=0;a<r.length;a++)"default"!==r[a]&&i(e,t,r[a]);return o(e,t),e}),u=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Presets=e.Structure=e.Level=e.Parsers=e.pathData=void 0;var s=u(r(476));e.pathData=s.default;var c=a(r(880));e.Parsers=c;var l=a(r(742)),f=l;e.Level=l.default,e.Structure=f;var h=a(r(43));e.Presets=h},476:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var r={R:0,p:15,J:30,E:45,T:60,o:75,U:90,q:105,G:120,Q:135,H:150,W:165,L:180,x:195,N:210,Z:225,F:240,V:255,D:270,Y:285,B:300,C:315,M:330,A:345,5:555,6:666,7:777,8:888,"!":999};e.default={pathDataTable:r,parseToangleData:function(t){return Array.from(String(t)).map((function(t){return r[t]}))}}},484:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function i(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(t){var e=function(t){if("object"!=r(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:e+""}Object.defineProperty(e,"__esModule",{value:!0});var a=i((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}));e.default=a},716:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("object"!==r(t)||null===t)return JSON.stringify(t);if(Array.isArray(t)){if(t.every((function(t){return"object"!==r(t)||null===t})))return"["+t.map((function(t){return n(t)})).join(",")+"]";var a=" ".repeat(e);return"[\n"+t.map((function(t){return a+" "+i(t)})).join(",\n")+"\n"+a+"]"}var u=" ".repeat(e),s=Object.keys(t);return o?"{\n"+s.map((function(e){return" "+JSON.stringify(e)+": "+n(t[e],2)})).join(",\n")+"\n}":"{\n"+s.map((function(r){return u+" "+JSON.stringify(r)+": "+n(t[r],e+2)})).join(",\n")+"\n"+u+"}"}function i(t){return"object"!==r(t)||null===t?n(t):Array.isArray(t)?"["+t.map(i).join(",")+"]":"{"+Object.keys(t).map((function(e){return JSON.stringify(e)+": "+i(t[e])})).join(", ")+"}"}Object.defineProperty(e,"__esModule",{value:!0}),e.default=n},724:function(t,e,r){var n,i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||(n=function(t){return n=Object.getOwnPropertyNames||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[e.length]=r);return e},n(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r=n(t),a=0;a<r.length;a++)"default"!==r[a]&&i(e,t,r[a]);return o(e,t),e});Object.defineProperty(e,"__esModule",{value:!0});var u=a(r(43)),s={clearDecorations:function(t){if(!Array.isArray(t))throw new Error("Arguments are not supported.");return t.map((function(t){var e=Object.assign({},t);return e.hasOwnProperty("addDecorations")&&(e.addDecorations=[]),Array.isArray(e.actions)&&(e.actions=e.actions.filter((function(t){return!u.preset_inner_no_deco.events.includes(t.eventType)}))),e}))},clearEvents:function(t,e){return e.map((function(e){var r=Object.assign({},e);return Array.isArray(r.actions)&&(r.actions=r.actions.filter((function(e){return!t.includes(e.eventType)}))),r}))},keepEvents:function(t,e){return e.map((function(e){var r=Object.assign({},e);return Array.isArray(r.actions)&&(r.actions=r.actions.filter((function(e){return t.includes(e.eventType)}))),r}))}};e.default=s},735:function(t,e,r){function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function i(){i=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(e,r,n,i){var o=r&&r.prototype instanceof y?r:y,a=Object.create(o.prototype);return l(a,"_invoke",function(e,r,n){var i=1;return function(o,a){if(3===i)throw Error("Generator is already running");if(4===i){if("throw"===o)throw a;return{value:t,done:!0}}for(n.method=o,n.arg=a;;){var u=n.delegate;if(u){var s=S(u,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===i)throw i=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=3;var c=h(e,r,n);if("normal"===c.type){if(i=n.done?4:2,c.arg===p)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=4,n.method="throw",n.arg=c.arg)}}}(e,n,new E(i||[])),!0),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p={};function y(){}function d(){}function v(){}var b={};l(b,u,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(P([])));m&&m!==r&&n.call(m,u)&&(b=m);var _=v.prototype=y.prototype=Object.create(b);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function r(i,a,u,s){var c=h(t[i],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==o(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,u,s)}),(function(t){r("throw",t,u,s)})):e.resolve(f).then((function(t){l.value=t,u(l)}),(function(t){return r("throw",t,u,s)}))}s(c.arg)}var i;l(this,"_invoke",(function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}),!0)}function S(e,r){var n=r.method,i=e.i[n];if(i===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var o=h(i,e.i,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var a=o.arg;return a?a.done?(r[e.r]=a.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,p):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function j(t){this.tryEntries.push(t)}function k(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function E(t){this.tryEntries=[[-1]],t.forEach(j,this),this.reset(!0)}function P(e){if(null!=e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(o(e)+" is not iterable")}return d.prototype=v,l(_,"constructor",v),l(v,"constructor",d),d.displayName=l(v,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,l(t,c,"GeneratorFunction")),t.prototype=Object.create(_),t},e.awrap=function(t){return{__await:t}},O(w.prototype),l(w.prototype,s,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new w(f(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(_),l(_,c,"Generator"),l(_,u,(function(){return this})),l(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=P,E.prototype={constructor:E,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){a.type="throw",a.arg=e,r.next=t}for(var i=r.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o[4],u=this.prev,s=o[1],c=o[2];if(-1===o[0])return n("end"),!1;if(!s&&!c)throw Error("try statement without catch or finally");if(null!=o[0]&&o[0]<=u){if(u<s)return this.method="next",this.arg=t,n(s),!0;if(u<c)return n(c),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var i=n;break}}i&&("break"===t||"continue"===t)&&i[0]<=e&&e<=i[2]&&(i=null);var o=i?i[4]:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i[2],p):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),k(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var i=n.arg;k(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:P(e),r,n},"next"===this.method&&(this.arg=t),p}},e}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}var s,c=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),l=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f=this&&this.__importStar||(s=function(t){return s=Object.getOwnPropertyNames||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[e.length]=r);return e},s(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r=s(t),n=0;n<r.length;n++)"default"!==r[n]&&c(e,t,r[n]);return l(e,t),e}),h=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{s(n.next(t))}catch(t){o(t)}}function u(t){try{s(n.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}s((n=n.apply(t,e||[])).next())}))},p=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r},y=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Level=void 0;var d=y(r(476)),v=y(r(716)),b=y(r(880)),g=y(r(724)),m=f(r(43)),_=function(){return t=function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._events=new Map,this.guidCallbacks=new Map,this.guidCounter=0,this._options=e,this._provider=r},e=[{key:"generateGUID",value:function(){return"event_".concat(Date.now(),"_").concat(this.guidCounter++,"_").concat(Math.floor(1e3*Math.random()))}},{key:"load",value:function(){var t=this;return new Promise((function(e,r){var n,i=t._options;switch(o(i)){case"string":try{n=b.default.parseAsObject(i,t._provider)}catch(t){return void r(t)}break;case"object":n=Object.assign({},i);break;default:return void r("Options must be String or Object")}if(n&&"object"===o(n)&&null!==n&&void 0!==n.pathData)t.angleData=d.default.parseToangleData(n.pathData);else{if(!n||"object"!==o(n)||null===n||void 0===n.angleData)return void r("There is not any angle datas.");t.angleData=n.angleData}n&&"object"===o(n)&&null!==n&&void 0!==n.actions?t.actions=n.actions:t.actions=[],n&&"object"===o(n)&&null!==n&&void 0!==n.settings?(t.settings=n.settings,n&&"object"===o(n)&&null!==n&&void 0!==n.decorations?t.__decorations=n.decorations:t.__decorations=[],t.tiles=[],t._angleDir=-180,t._twirlCount=0,t._createArray(t.angleData.length,{angleData:t.angleData,actions:t.actions,decorations:t.__decorations}).then((function(r){t.tiles=r,t.trigger("load",t),e(!0)})).catch((function(t){r(t)}))):r("There is no ADOFAI settings.")}))}},{key:"on",value:function(t,e){this._events.has(t)||this._events.set(t,[]);var r=this.generateGUID();return this._events.get(t).push({guid:r,callback:e}),this.guidCallbacks.set(r,{eventName:t,callback:e}),r}},{key:"trigger",value:function(t,e){this._events.has(t)&&this._events.get(t).forEach((function(t){return(0,t.callback)(e)}))}},{key:"off",value:function(t){if(this.guidCallbacks.has(t)){var e=this.guidCallbacks.get(t).eventName;if(this.guidCallbacks.delete(t),this._events.has(e)){var r=this._events.get(e),n=r.findIndex((function(e){return e.guid===t}));-1!==n&&r.splice(n,1)}}}},{key:"_createArray",value:function(t,e){return h(this,void 0,void 0,i().mark((function r(){var n,o=this;return i().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=Array.from({length:t},(function(t,r){return{direction:e.angleData[r],_lastdir:e.angleData[r-1]||0,actions:o._filterByFloor(e.actions,r),angle:o._parseAngle(e.angleData,r,o._twirlCount%2),addDecorations:o._filterByFloorwithDeco(e.decorations,r),twirl:o._twirlCount,extraProps:{}}})),r.abrupt("return",n);case 2:case"end":return r.stop()}}),r)})))}},{key:"_changeAngle",value:function(){var t=this,e=0;return this.tiles.map((function(r){return e++,r.angle=t._parsechangedAngle(r.direction,e,r.twirl,r._lastdir),r}))}},{key:"_parsechangedAngle",value:function(t,e,r,n){var i=0;return 0===e&&(this._angleDir=180),999===t?(this._angleDir=n,isNaN(this._angleDir)&&(this._angleDir=0),i=0):(0==(i=0===r?(this._angleDir-t)%360:360-(this._angleDir-t)%360)&&(i=360),this._angleDir=t+180),i}},{key:"_filterByFloor",value:function(t,e){var r=t.filter((function(t){return t.floor===e}));return this._twirlCount+=r.filter((function(t){return"Twirl"===t.eventType})).length,r.map((function(t){return t.floor,p(t,["floor"])}))}},{key:"_flattenAngleDatas",value:function(t){return t.map((function(t){return t.direction}))}},{key:"_flattenActionsWithFloor",value:function(t){return t.map((function(t){return t.actions})).flat()}},{key:"_filterByFloorwithDeco",value:function(t,e){return t.filter((function(t){return t.floor===e})).map((function(t){return t.floor,p(t,["floor"])}))}},{key:"_flattenDecorationsWithFloor",value:function(t){return t.map((function(t){return t.addDecorations})).flat()}},{key:"_parseAngle",value:function(t,e,r){var n=0;return 0===e&&(this._angleDir=180),999===t[e]?(this._angleDir=t[e-1],isNaN(this._angleDir)&&(this._angleDir=0),n=0):(0==(n=0===r?(this._angleDir-t[e])%360:360-(this._angleDir-t[e])%360)&&(n=360),this._angleDir=t[e]+180),n}},{key:"filterActionsByEventType",value:function(t){return Object.entries(this.tiles).flatMap((function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,a,u=[],s=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(t){c=!0,i=t}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t,2),r=e[0];return(e[1].actions||[]).map((function(t){return{b:t,index:r}}))})).filter((function(e){return e.b.eventType===t})).map((function(t){var e=t.b,r=t.index;return{index:Number(r),action:e}}))}},{key:"getActionsByIndex",value:function(t,e){var r=this.filterActionsByEventType(t).filter((function(t){return t.index===e}));return{count:r.length,actions:r.map((function(t){return t.action}))}}},{key:"calculateTileCoordinates",value:function(){for(var t=this.angleData,e=[],r=[0,0],n=0;n<this.tiles.length;n++){var i=t[n];999===i&&(i=t[n-1]+180),e.push(i)}for(var o=0;o<=e.length;o++){var a=Number(o===e.length?e[o-1]:e[o])||0,u=Number(0===o?0:e[o-1])||0,s=this.tiles[o];if(this.getActionsByIndex("PositionTrack",o).count>0){var c=this.getActionsByIndex("PositionTrack",o).actions[0];c.positionOffset&&!0!==c.editorOnly&&"Enabled"!==c.editorOnly&&(r[0]+=c.positionOffset[0],r[1]+=c.positionOffset[1])}r[0]+=Math.cos(a*Math.PI/180),r[1]+=Math.sin(a*Math.PI/180),void 0!==s&&(s.position=[Number(r[0].toFixed(8)),Number(r[1].toFixed(8))],s.extraProps.angle1=a,s.extraProps.angle2=u-180,s.extraProps.cangle=o===e.length?e[o-1]+180:e[o])}}},{key:"floorOperation",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{type:"append",direction:0};switch(t.type){case"append":this.appendFloor(t);break;case"insert":"number"==typeof t.id&&this.tiles.splice(t.id,0,{direction:t.direction||0,angle:0,actions:[],addDecorations:[],_lastdir:this.tiles[t.id-1].direction,twirl:this.tiles[t.id-1].twirl});break;case"delete":"number"==typeof t.id&&this.tiles.splice(t.id,1)}this._changeAngle()}},{key:"appendFloor",value:function(t){this.tiles.push({direction:t.direction,angle:0,actions:[],addDecorations:[],_lastdir:this.tiles[this.tiles.length-1].direction,twirl:this.tiles[this.tiles.length-1].twirl,extraProps:{}}),this._changeAngle()}},{key:"clearDeco",value:function(){return this.tiles=g.default.clearDecorations(this.tiles),!0}},{key:"clearEffect",value:function(t){this.clearEvent(m[t])}},{key:"clearEvent",value:function(t){switch(t.type){case"include":this.tiles=g.default.keepEvents(t.events,this.tiles);break;case"exclude":this.tiles=g.default.clearEvents(t.events,this.tiles)}}},{key:"export",value:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n={angleData:this._flattenAngleDatas(this.tiles),settings:this.settings,actions:this._flattenActionsWithFloor(this.tiles),decorations:this._flattenDecorationsWithFloor(this.tiles)};return"object"===t?n:(0,v.default)(n,e,r)}}],e&&a(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();e.Level=_},742:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=r(735);e.default=n.Level},773:function(t,e,r){function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function u(t,e,r){return e&&a(t.prototype,e),r&&a(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t){if("object"!=i(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:e+""}function c(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(c=function(){return!!t})()}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}var h=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var p=function(t){function e(){return o(this,e),t=this,n=arguments,r=l(r=e),function(t,e){if(e&&("object"==i(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,c()?Reflect.construct(r,n||[],l(t).constructor):r.apply(t,n));var t,r,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(e,t),u(e,[{key:"parse",value:function(t,r){if(null==t)return null;var n=new y(t).parseValue();return"function"==typeof r?e._applyReviver("",n,r):n}},{key:"stringify",value:function(t,e,r){return new d(e,r).serialize(t)}}],[{key:"_applyReviver",value:function(t,r,n){if(r&&"object"===i(r))if(Array.isArray(r))for(var o=0;o<r.length;o++)r[o]=e._applyReviver(o.toString(),r[o],n);else for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(r[a]=e._applyReviver(a,r[a],n));return n(t,r)}}])}(h(r(484)).default),y=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;o(this,t),this.json=e,this.position=0,this.endSection=r,65279===this.peek()&&this.read()}return u(t,[{key:"parseValue",value:function(){return this.parseByToken(this.nextToken)}},{key:"parseObject",value:function(){var e={};for(this.read();;){var r=void 0;do{if((r=this.nextToken)===t.TOKEN.NONE)return null;if(r===t.TOKEN.CURLY_CLOSE)return e}while(r===t.TOKEN.COMMA);var n=this.parseString();if(null===n)return null;if(this.nextToken!==t.TOKEN.COLON)return null;if(null!=this.endSection&&n===this.endSection)return e;this.read(),e[n]=this.parseValue()}}},{key:"parseArray",value:function(){var e=[];this.read();for(var r=!0;r;){var n=this.nextToken;switch(n){case t.TOKEN.NONE:return null;case t.TOKEN.SQUARED_CLOSE:r=!1;break;case t.TOKEN.COMMA:break;default:var i=this.parseByToken(n);e.push(i)}}return e}},{key:"parseByToken",value:function(e){switch(e){case t.TOKEN.CURLY_OPEN:return this.parseObject();case t.TOKEN.SQUARED_OPEN:return this.parseArray();case t.TOKEN.STRING:return this.parseString();case t.TOKEN.NUMBER:return this.parseNumber();case t.TOKEN.TRUE:return!0;case t.TOKEN.FALSE:return!1;case t.TOKEN.NULL:default:return null}}},{key:"parseString",value:function(){var t="";this.read();for(var e=!0;e&&-1!==this.peek();){var r=this.nextChar;switch(r){case'"':e=!1;break;case"\\":if(-1===this.peek()){e=!1;break}var n=this.nextChar;switch(n){case'"':case"/":case"\\":t+=n;break;case"b":t+="\b";break;case"f":t+="\f";break;case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"u":for(var i="",o=0;o<4;o++)i+=this.nextChar;t+=String.fromCharCode(Number.parseInt(i,16))}break;default:t+=r}}return t}},{key:"parseNumber",value:function(){var t=this.nextWord;return-1===t.indexOf(".")?Number.parseInt(t,10)||0:Number.parseFloat(t)||0}},{key:"eatWhitespace",value:function(){for(;-1!==t.WHITE_SPACE.indexOf(this.peekChar)&&(this.read(),-1!==this.peek()););}},{key:"peek",value:function(){return this.position>=this.json.length?-1:this.json.charCodeAt(this.position)}},{key:"read",value:function(){return this.position>=this.json.length?-1:this.json.charCodeAt(this.position++)}},{key:"peekChar",get:function(){var t=this.peek();return-1===t?"\0":String.fromCharCode(t)}},{key:"nextChar",get:function(){var t=this.read();return-1===t?"\0":String.fromCharCode(t)}},{key:"nextWord",get:function(){for(var e="";-1===t.WORD_BREAK.indexOf(this.peekChar)&&(e+=this.nextChar,-1!==this.peek()););return e}},{key:"nextToken",get:function(){if(this.eatWhitespace(),-1===this.peek())return t.TOKEN.NONE;switch(this.peekChar){case'"':return t.TOKEN.STRING;case",":return this.read(),t.TOKEN.COMMA;case"-":case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return t.TOKEN.NUMBER;case":":return t.TOKEN.COLON;case"[":return t.TOKEN.SQUARED_OPEN;case"]":return this.read(),t.TOKEN.SQUARED_CLOSE;case"{":return t.TOKEN.CURLY_OPEN;case"}":return this.read(),t.TOKEN.CURLY_CLOSE;default:switch(this.nextWord){case"false":return t.TOKEN.FALSE;case"true":return t.TOKEN.TRUE;case"null":return t.TOKEN.NULL;default:return t.TOKEN.NONE}}}}])}();y.WHITE_SPACE=" \t\n\r\ufeff",y.WORD_BREAK=' \t\n\r{}[],:"',y.TOKEN={NONE:0,CURLY_OPEN:1,CURLY_CLOSE:2,SQUARED_OPEN:3,SQUARED_CLOSE:4,COLON:5,COMMA:6,STRING:7,NUMBER:8,TRUE:9,FALSE:10,NULL:11};var d=function(){return u((function t(e,r){o(this,t),this.result="",this.indent=0,this.indentStr="",this.replacer=e||null,this.space=r||null,"number"==typeof r?this.indentStr=" ".repeat(Math.min(10,Math.max(0,r))):"string"==typeof r&&(this.indentStr=r.slice(0,10))}),[{key:"serialize",value:function(t){return this.result="",this.serializeValue(t,""),this.result}},{key:"serializeValue",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";"function"==typeof this.replacer&&(t=this.replacer(e,t)),null==t?this.result+="null":"string"==typeof t?this.serializeString(t):"boolean"==typeof t?this.result+=t.toString():Array.isArray(t)?this.serializeArray(t):"object"===i(t)?this.serializeObject(t):this.serializeOther(t)}},{key:"serializeObject",value:function(t){var e=!0;for(var r in this.result+="{",this.indentStr&&(this.result+="\n",this.indent++),t)if(Object.prototype.hasOwnProperty.call(t,r)){if(Array.isArray(this.replacer)&&!this.replacer.includes(r))continue;e||(this.result+=",",this.indentStr&&(this.result+="\n")),this.indentStr&&(this.result+=this.indentStr.repeat(this.indent)),this.serializeString(r.toString()),this.result+=":",this.indentStr&&(this.result+=" "),this.serializeValue(t[r],r),e=!1}this.indentStr&&(this.result+="\n",this.indent--,this.result+=this.indentStr.repeat(this.indent)),this.result+="}"}},{key:"serializeArray",value:function(t){this.result+="[",this.indentStr&&t.length>0&&(this.result+="\n",this.indent++);for(var e=!0,r=0;r<t.length;r++)e||(this.result+=",",this.indentStr&&(this.result+="\n")),this.indentStr&&(this.result+=this.indentStr.repeat(this.indent)),this.serializeValue(t[r],r.toString()),e=!1;this.indentStr&&t.length>0&&(this.result+="\n",this.indent--,this.result+=this.indentStr.repeat(this.indent)),this.result+="]"}},{key:"serializeString",value:function(t){this.result+='"';var e,r=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){s=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw a}}}}(t);try{for(r.s();!(e=r.n()).done;){var i=e.value;switch(i){case"\b":this.result+="\\b";break;case"\t":this.result+="\\t";break;case"\n":this.result+="\\n";break;case"\f":this.result+="\\f";break;case"\r":this.result+="\\r";break;case'"':this.result+='\\"';break;case"\\":this.result+="\\\\";break;default:var o=i.charCodeAt(0);this.result+=o>=32&&o<=126?i:"\\u"+o.toString(16).padStart(4,"0")}}}catch(t){r.e(t)}finally{r.f()}this.result+='"'}},{key:"serializeOther",value:function(t){"number"==typeof t?isFinite(t)?this.result+=t.toString():this.result+="null":this.serializeString(t.toString())}}])}();e.default=p},880:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ArrayBufferParser=e.BufferParser=e.StringParser=void 0;var i=n(r(279)),o=n(r(314));e.BufferParser=o.default;var a=n(r(15));e.ArrayBufferParser=a.default;var u=n(r(773));e.StringParser=u.default,e.default=i.default}},e={};return function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}(427)})()));
@@ -0,0 +1 @@
1
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "adofai",
3
- "version": "2.9.13",
4
- "main": "index.js",
3
+ "version": "2.9.15",
4
+ "main": "dist/src/index.js",
5
+ "types": "dist/src/index.d.ts",
5
6
  "scripts": {
6
- "build": "webpack",
7
+ "webpack": "webpack",
7
8
  "tsc": "tsc",
8
- "dev": "webpack --mode=development"
9
+ "build": "pnpm webpack && pnpm tsc"
9
10
  },
10
11
  "keywords": [
11
12
  "adofai",
@@ -13,6 +14,9 @@
13
14
  "adofai-ts",
14
15
  "adofai-ts-lib"
15
16
  ],
17
+ "files": [
18
+ "dist"
19
+ ],
16
20
  "author": "Xbodwf",
17
21
  "license": "BSD-3-Clause",
18
22
  "homepage": "https://xbodwf.github.io/packages/adofai-js/",
package/.babelrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "presets": [
3
- "@babel/preset-env"
4
- ]
5
- }
package/index.ts DELETED
@@ -1,12 +0,0 @@
1
- import pathData from './src/pathdata'
2
- import * as Parsers from './src/parser'
3
- import Level,* as Structure from './src/structure'
4
- import * as Presets from './src/presets'
5
-
6
- export {
7
- pathData,
8
- Parsers,
9
- Level,
10
- Structure,
11
- Presets
12
- }
@@ -1,82 +0,0 @@
1
- import * as presets from './presets'
2
-
3
- interface Tile {
4
- addDecorations?: any[];
5
- actions?: Action[];
6
- [key: string]: any;
7
- }
8
-
9
- interface Action {
10
- eventType: string;
11
- [key: string]: any;
12
- }
13
-
14
- /**
15
- * @param {Array} tiles ADOFAI Tiles from ADOFAI.Level
16
- * @returns {Array} new Tiles
17
- */
18
- function clearDecorations(tiles: Tile[]): Tile[] {
19
- if (!Array.isArray(tiles)) {
20
- throw new Error('Arguments are not supported.');
21
- }
22
-
23
- return tiles.map(tile => {
24
- const newTile = { ...tile };
25
-
26
- if (newTile.hasOwnProperty('addDecorations')) {
27
- newTile.addDecorations = [];
28
- }
29
-
30
- if (Array.isArray(newTile.actions)) {
31
- newTile.actions = newTile.actions.filter(action =>
32
- !presets.preset_inner_no_deco.events.includes(action.eventType)
33
- );
34
- }
35
-
36
- return newTile;
37
- });
38
- }
39
-
40
- /**
41
- * @param {Array} eventTypes Eventlist to remove
42
- * @param {Array} tiles ADOFAI Tiles from ADOFAI.Level
43
- * @returns {Array} new Tiles
44
- */
45
- function clearEvents(eventTypes: string[], tiles: Tile[]): Tile[] {
46
- return tiles.map(tile => {
47
- const newTile = { ...tile };
48
- if (Array.isArray(newTile.actions)) {
49
- newTile.actions = newTile.actions.filter(action =>
50
- !eventTypes.includes(action.eventType)
51
- );
52
- }
53
-
54
- return newTile;
55
- });
56
- }
57
-
58
- /**
59
- * @param {Array} eventTypes Eventlist to keep
60
- * @param {Array} tiles ADOFAI Tiles from ADOFAI.Level
61
- * @returns {Array} new Tiles
62
- */
63
- function keepEvents(eventTypes: string[], tiles: Tile[]): Tile[] {
64
- return tiles.map(tile => {
65
- const newTile = { ...tile };
66
- if (Array.isArray(newTile.actions)) {
67
- newTile.actions = newTile.actions.filter(action =>
68
- eventTypes.includes(action.eventType)
69
- );
70
- }
71
-
72
- return newTile;
73
- });
74
- }
75
-
76
-
77
- const effectProcessor = {
78
- clearDecorations,
79
- clearEvents,
80
- keepEvents
81
- }
82
- export default effectProcessor;
package/src/format.ts DELETED
@@ -1,69 +0,0 @@
1
- /**
2
- * @param {object} obj - JSON Object
3
- * @param {number} indent - No usage
4
- * @param {boolean} isRoot - Is JSON the Root?
5
- * @returns ADOFAI File Content or Object
6
- */
7
- function exportAsADOFAI(obj: any, indent: number = 0, isRoot: boolean = false): string {
8
-
9
- if (typeof obj !== 'object' || obj === null) {
10
- return JSON.stringify(obj);
11
- }
12
-
13
- if (Array.isArray(obj)) {
14
- const allPrimitives = obj.every(item =>
15
- typeof item !== 'object' || item === null
16
- );
17
-
18
- if (allPrimitives) {
19
- return '[' + obj.map(item => exportAsADOFAI(item)).join(',') + ']';
20
- }
21
-
22
- const spaces = ' '.repeat(indent);
23
- const arrayItems = obj.map(item =>
24
- spaces + ' ' + formatAsSingleLine(item)
25
- ).join(',\n');
26
-
27
- return '[\n' + arrayItems + '\n' + spaces + ']';
28
- }
29
-
30
- const spaces = ' '.repeat(indent);
31
- const keys = Object.keys(obj);
32
-
33
- if (isRoot) {
34
- const objectItems = keys.map(key =>
35
- ' ' + JSON.stringify(key) + ': ' + exportAsADOFAI((obj as Record<string, any>)[key], 2)
36
- ).join(',\n');
37
-
38
- return '{\n' + objectItems + '\n}';
39
- }
40
-
41
- const objectItems = keys.map(key =>
42
- spaces + ' ' + JSON.stringify(key) + ': ' + exportAsADOFAI((obj as Record<string, any>)[key], indent + 2)
43
- ).join(',\n');
44
-
45
- return '{\n' + objectItems + '\n' + spaces + '}';
46
- }
47
-
48
- /**
49
- * @param {Array} obj Eventlist to keep
50
- * @returns {string} JSON formated as singleline
51
- */
52
- function formatAsSingleLine(obj: any): string {
53
- if (typeof obj !== 'object' || obj === null) {
54
- return exportAsADOFAI(obj);
55
- }
56
-
57
- if (Array.isArray(obj)) {
58
- return '[' + obj.map(formatAsSingleLine).join(',') + ']';
59
- }
60
-
61
- const keys = Object.keys(obj);
62
- const entries = keys.map(key =>
63
- JSON.stringify(key) + ': ' + formatAsSingleLine((obj as Record<string, any>)[key])
64
- ).join(', ');
65
-
66
- return '{' + entries + '}';
67
- }
68
-
69
- export default exportAsADOFAI;
@@ -1,101 +0,0 @@
1
- import Parser from "./Parser";
2
- import StringParser from "./StringParser";
3
-
4
- const BOM = new Uint8Array([0xef, 0xbb, 0xbf]);
5
- const COMMA = new Uint8Array([44]); // ASCII for ','
6
-
7
- export class ArrayBufferParser extends Parser<ArrayBuffer | string, any> {
8
- parse(input: ArrayBuffer | string): any {
9
- if (typeof input === "string") {
10
- return StringParser.prototype.parse.call(StringParser.prototype, input);
11
- } else {
12
- return StringParser.prototype.parse.call(StringParser.prototype, decodeStringFromUTF8BOM(normalizeJsonArrayBuffer(stripBOM(input))));
13
- }
14
- }
15
- stringify(obj: any): string {
16
- return JSON.stringify(obj);
17
- }
18
- }
19
-
20
- export function stripBOM(buffer: ArrayBuffer): ArrayBuffer {
21
- const view = new Uint8Array(buffer);
22
- if (view.length >= 3 && view[0] === BOM[0] && view[1] === BOM[1] && view[2] === BOM[2]) {
23
- return buffer.slice(3);
24
- }
25
- return buffer;
26
- }
27
-
28
- export function normalizeJsonArrayBuffer(buffer: ArrayBuffer): ArrayBuffer {
29
- const view = new Uint8Array(buffer);
30
- let builder: Uint8Array[] = [];
31
- let last: "other" | "string" | "escape" | "comma" = "other";
32
- let from = 0;
33
-
34
- for (let i = 0; i < view.length; i++) {
35
- const charCode = view[i];
36
- if (last == "escape") {
37
- last = "string";
38
- } else {
39
- switch (charCode) {
40
- case 34: // "
41
- switch (last) {
42
- case "string":
43
- last = "other";
44
- break;
45
- case "comma":
46
- builder.push(COMMA);
47
- default:
48
- last = "string";
49
- break;
50
- }
51
- break;
52
- case 92: // \
53
- if (last === "string") last = "escape";
54
- break;
55
- case 44: // ,
56
- builder.push(view.subarray(from, i));
57
- from = i + 1;
58
- if (last === "other") last = "comma";
59
- break;
60
- case 93: // ]
61
- case 125: // }
62
- if (last === "comma") last = "other";
63
- break;
64
- case 9: // \t
65
- case 10: // \n
66
- case 11: // \v
67
- case 12: // \f
68
- case 13: // \r
69
- case 32: // space
70
- break;
71
- default:
72
- if (last === "comma") {
73
- builder.push(COMMA);
74
- last = "other";
75
- }
76
- break;
77
- }
78
- }
79
- }
80
- builder.push(view.subarray(from));
81
-
82
- let totalLength = 0;
83
- for (const arr of builder) {
84
- totalLength += arr.length;
85
- }
86
- const result = new Uint8Array(totalLength);
87
- let offset = 0;
88
- for (const arr of builder) {
89
- result.set(arr, offset);
90
- offset += arr.length;
91
- }
92
- return result.buffer;
93
- }
94
-
95
- export function decodeStringFromUTF8BOM(buffer: ArrayBuffer): string {
96
- const strippedBuffer = stripBOM(buffer);
97
- const decoder = new TextDecoder('utf-8');
98
- return decoder.decode(strippedBuffer);
99
- }
100
-
101
- export default ArrayBufferParser;
@@ -1,93 +0,0 @@
1
- import Parser from "./Parser";
2
- import StringParser from "./StringParser";
3
-
4
- let BOM: Buffer;
5
- let COMMA: Buffer;
6
-
7
- try {
8
- BOM = Buffer.of(0xef, 0xbb, 0xbf);
9
- COMMA = Buffer.from(",");
10
- } catch (e) {
11
- console.warn('Buffer is not available in current environment, try to use ArrayBufferParser');
12
- BOM = { equals: () => false, subarray: () => null } as any;
13
- COMMA = { equals: () => false, subarray: () => null } as any;
14
- }
15
-
16
- export class BufferParser extends Parser<Buffer | string, any> {
17
- parse(input: Buffer | string): any {
18
- if (typeof input === "string") {
19
- return StringParser.prototype.parse.call(StringParser.prototype, input);
20
- } else {
21
- return StringParser.prototype.parse.call(StringParser.prototype, decodeStringFromUTF8BOM(normalizeJsonBuffer(stripBOM(input))));
22
- }
23
- }
24
- stringify(obj: any): string {
25
- return JSON.stringify(obj);
26
- }
27
- }
28
-
29
- export function stripBOM(buffer: Buffer): Buffer {
30
- if (buffer.length >= 3 && BOM.equals(buffer.subarray(0, 3))) {
31
- return buffer.subarray(3)
32
- }
33
- return buffer
34
- }
35
-
36
- export function normalizeJsonBuffer(text: Buffer): Buffer {
37
- let builder: Buffer[] = []
38
- let last: "other" | "string" | "escape" | "comma" = "other"
39
- let from = 0
40
- text.forEach((charCode, i) => {
41
- if (last == "escape") {
42
- last = "string"
43
- } else {
44
- switch (charCode) {
45
- case 34:
46
- switch (last) {
47
- case "string":
48
- last = "other"
49
- break
50
- case "comma":
51
- builder.push(COMMA)
52
- default:
53
- last = "string"
54
- break
55
- }
56
- break
57
- case 92:
58
- if (last === "string") last = "escape"
59
- break
60
- case 44:
61
- builder.push(text.subarray(from, i))
62
- from = i + 1
63
- if (last === "other") last = "comma"
64
- break
65
- case 93:
66
- case 125:
67
- if (last === "comma") last = "other"
68
- break
69
- case 9:
70
- case 10:
71
- case 11:
72
- case 12:
73
- case 13:
74
- case 32:
75
- break
76
- default:
77
- if (last === "comma") {
78
- builder.push(COMMA)
79
- last = "other"
80
- }
81
- break
82
- }
83
- }
84
- })
85
- builder.push(text.subarray(from))
86
- return Buffer.concat(builder)
87
- }
88
-
89
- export function decodeStringFromUTF8BOM(buffer: Buffer): string {
90
- return stripBOM(buffer).toString("utf-8")
91
- }
92
-
93
- export default BufferParser;
@@ -1,28 +0,0 @@
1
- import StringParser from './StringParser';
2
- import { LevelOptions, ParseProvider } from '../structure';
3
-
4
- class BaseParser {
5
- static parseError(f: string) {
6
- return f;
7
- }
8
-
9
- /**
10
- * @param {string} t - Input Content
11
- * @param {object} provider - ParserProvider
12
- * @returns {LevelOptions} ADOFAI File Object
13
- */
14
- static parseAsObject(t: string, provider?: ParseProvider): LevelOptions {
15
- const parser = provider || new StringParser();
16
- return parser.parse(BaseParser.parseAsText(t)) as LevelOptions;
17
- }
18
-
19
- /**
20
- * @param {string} t - Input Content
21
- * @returns {string} ADOFAI File Content
22
- */
23
- static parseAsText(t: string) {
24
- return this.parseError(t);
25
- }
26
- }
27
-
28
- export default BaseParser;
package/src/pathdata.ts DELETED
@@ -1,20 +0,0 @@
1
- interface PathDataTable {
2
- [key: string]: number;
3
- }
4
-
5
- const pathDataTable: PathDataTable = { "R": 0, "p": 15, "J": 30, "E": 45, "T": 60, "o": 75, "U": 90, "q": 105, "G": 120, "Q": 135, "H": 150, "W": 165, "L": 180, "x": 195, "N": 210, "Z": 225, "F": 240, "V": 255, "D": 270, "Y": 285, "B": 300, "C": 315, "M": 330, "A": 345, "5": 555, "6": 666, "7": 777, "8": 888, "!": 999 };
6
-
7
- /**
8
- * @param {string} pathdata - PathData from ADOFAI
9
- * @returns {Array<number>} Converted AngleData
10
- */
11
- function parseToangleData(pathdata: string): number[] {
12
- let pt = Array.from(String(pathdata));
13
- let result: number[] = pt.map(t => (pathDataTable as Record<string, number>)[t]);
14
- return result;
15
- }
16
-
17
- export default {
18
- pathDataTable,
19
- parseToangleData
20
- }