Guest User

Untitled

a guest
Jul 5th, 2025
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "use strict";
  2. var _, C, C, C, C, C, C, S = C.Sn,
  3.     H = C.Ip,
  4.     I = C.In,
  5.     aW = C.Teks.Write,
  6.     aX = C.Teks.WriteLn,
  7.     aY = C.Teks.Name,
  8.     aZ = C.Teks.Size,
  9.     bA = C.Teks.Align;
  10. (function(ha) {
  11.     (function(_a) {
  12.         class Cache {
  13.             constructor() {
  14.                 this.files = []
  15.             }
  16.             getGbr(_A) {
  17.                 for (let i = 0; i < this.files.length; i++)
  18.                     if (this.files[i].url == _A) return this.files[i].img;
  19.                 return null
  20.             }
  21.             setFile(bD, _b) {
  22.                 let _c;
  23.                 _c = this.getGbr(bD);
  24.                 if (_c) return;
  25.                 this.files.push({
  26.                     url: bD,
  27.                     img: _b
  28.                 })
  29.             }
  30.         }
  31.         _a.cache = new Cache
  32.     })()
  33. })(_ || (_ = {}));
  34. var C;
  35. (function(bE) {
  36.     class Camera {
  37.         static get x() {
  38.             return Camera._x
  39.         }
  40.         static set x(bF) {
  41.             Camera._x = bF
  42.         }
  43.         static get y() {
  44.             return Camera._y
  45.         }
  46.         static set y(bG) {
  47.             Camera._y = bG
  48.         }
  49.         static get img() {
  50.             return Camera._img
  51.         }
  52.         static set img(bH) {
  53.             Camera._img = bH
  54.         }
  55.         static init() {
  56.             function bI() {
  57.                 window.requestAnimationFrame(bI)
  58.             }
  59.             window.requestAnimationFrame(bI)
  60.         }
  61.     }
  62.     Camera._x = Camera._y = 0;
  63.     bE.Camera = Camera
  64. })(C || (C = {}));
  65. (function(bJ) {
  66.     (function(bK) {
  67.         bK['MOUSE_DOWN'] = 'mousedown';
  68.         bK['MOUSE_UP'] = 'mouseup';
  69.         bK['MOUSE_MOVE'] = 'mousemove';
  70.         bK['MOUSE_CLICK'] = 'mouseclick';
  71.         bK['MOUSE_START_DRAG'] = 'mousestartdrag';
  72.         bK['MOUSE_END_DRAG'] = 'mouseenddrag';
  73.         bK['KEYB_DOWN'] = 'keybdown';
  74.         bK['KEYB_UP'] = 'keybup';
  75.         bK['SOUND_LOADED'] = 'soundloaded';
  76.         bK['SOUND_ENDED'] = 'soundended'
  77.     })();
  78.     class Event {
  79.         constructor(bL, f) {
  80.             this._type = '';
  81.             this._type = bL;
  82.             this._f = f
  83.         }
  84.         get type() {
  85.             return this._type
  86.         }
  87.         get f() {
  88.             return this._f
  89.         }
  90.         static addEventListener(bM, f) {
  91.             let e = new Event(bM.toLowerCase(), f);
  92.             Event.list.push(e);
  93.             console.log('add listener: type ', bM);
  94.             return e
  95.         }
  96.         static dispatchEvent(bN) {
  97.             for (const bO of Event.list) bO.type === bN.toLowerCase() && bO.f()
  98.         }
  99.     }
  100.     Event.list = [];
  101.     bJ.Event = Event
  102. })(C || (C = {}));
  103. var C;
  104. (function(bP) {
  105.     class Graphic {
  106.         static handleWindowResize() {
  107.             if (!bP.G._autoScale) return;
  108.             let bQ = bP.G.drawCanvas;
  109.             let _B = bP.G.drawCanvas.width;
  110.             let _C = bP.G.drawCanvas.height;
  111.             let _d = window.innerWidth;
  112.             let _e = window.innerHeight;
  113.             let _f = Math.min((_d / _B), (_e / _C));
  114.             let _g = ~~_B * _f;
  115.             let _h = ~~_C * _f;
  116.             bQ.style.position = 'fixed';
  117.             bQ.style.zIndex = '1';
  118.             bQ.style.width = `${_g}px`;
  119.             bQ.style.height = `${_h}px`;
  120.             bQ.style.top = ((_e - _h) / 2) + 'px';
  121.             bQ.style.left = ((_d - _g) / 2) + 'px'
  122.         }
  123.         static buildCanvas(w, h) {
  124.             let bR;
  125.             bR = document.body.querySelector('canvas');
  126.             if (!bR) {
  127.                 bR = document.createElement('canvas');
  128.                 document.body.appendChild(bR);
  129.                 w && (bR.width = w);
  130.                 h && (bR.height = h)
  131.             }
  132.             return bR
  133.         }
  134.         static Canvas() {
  135.             return bP.G.drawCanvas
  136.         }
  137.         static SetCanvas(bS) {
  138.             bP.G.drawCanvas = bS
  139.         }
  140.         static initComp() {
  141.             bP.In.init(bP.G.drawCanvas);
  142.             bP.Keyboard.init();
  143.             bP.Camera.init();
  144.             bP.sprInt.init()
  145.         }
  146.         static initEvent() {
  147.             function bT(bU) {
  148.                 let w = window;
  149.                 (w[bU] && (typeof w[bU] == 'function')) && w[bU]()
  150.             }
  151.             bP.Event.addEventListener(bP.Evt.KEYB_DOWN, () => bT('KeyboardDown'));
  152.             bP.Event.addEventListener(bP.Evt.KEYB_UP, () => bT('KeyboardUp'));
  153.             bP.Event.addEventListener(bP.Evt.MOUSE_DOWN, () => bT('MouseDown'));
  154.             bP.Event.addEventListener(bP.Evt.MOUSE_END_DRAG, () => bT('MouseEndDrag'));
  155.             bP.Event.addEventListener(bP.Evt.MOUSE_MOVE, () => bT('MouseMove'));
  156.             bP.Event.addEventListener(bP.Evt.MOUSE_START_DRAG, () => bT('MouseStartDrag'));
  157.             bP.Event.addEventListener(bP.Evt.MOUSE_CLICK, () => bT('MouseClick'));
  158.             bP.Event.addEventListener(bP.Evt.MOUSE_UP, () => bT('MouseUp'));
  159.             bP.Event.addEventListener('update', () => bT('Update'));
  160.             bP.Event.addEventListener(bP.Evt.SOUND_ENDED, () => bT('SoundEnded'));
  161.             bP.Event.addEventListener(bP.Evt.SOUND_LOADED, () => bT('SoundLoaded'))
  162.         }
  163.         static Start(bV) {
  164.             bP.G.Graphics(0, 0, bV, 0)
  165.         }
  166.         static Graphics(w, h, bW = null, _D = 1) {
  167.             console.log('init');
  168.             !bW && (bW = bP.G.buildCanvas(w, h));
  169.             bP.G.drawCanvas = bW;
  170.             bP.G._autoScale = (_D == 1);
  171.             bP.G.setupMainCanvas(w, h, _D);
  172.             bP.G.initComp();
  173.             bP.G.initEvent();
  174.  
  175.             function _E() {
  176.                 bP.Event.dispatchEvent('update');
  177.                 window.requestAnimationFrame(_E)
  178.             }
  179.             window.requestAnimationFrame(_E);
  180.             setTimeout(() => bP.G.handleWindowResize(), 100);
  181.             bP.G.handleWindowResize();
  182.             N();
  183.             V(0, 0, 0, 0);
  184.             aV(0, 10);
  185.             aZ(10)
  186.         }
  187.         static setupMainCanvas(p, l, bX = 1) {
  188.             p && (bP.G.drawCanvas.width = p);
  189.             l && (bP.G.drawCanvas.height = l);
  190.             bX == 1 && (bP.G.drawCanvas.style.width = `${p}px`, bP.G.drawCanvas.style.padding = '0px', bP.G.drawCanvas.style.margin = '0px', window.addEventListener('resize', () => bP.G.handleWindowResize()))
  191.         }
  192.         static Cls(x = 0, y = 0, w = 0, h = 0) {
  193.             let bY = bP.G.drawCanvas.getContext('2d');
  194.             w = w || bP.G.drawCanvas.width;
  195.             h = h || bP.G.drawCanvas.height;
  196.             bY.clearRect(x, y, w, h)
  197.         }
  198.         static get red() {
  199.             return bP.G._red
  200.         }
  201.         static set red(bZ) {
  202.             bP.G._red = bZ
  203.         }
  204.         static get green() {
  205.             return bP.G._green
  206.         }
  207.         static set green(cA) {
  208.             bP.G._green = cA
  209.         }
  210.         static get blue() {
  211.             return bP.G._blue
  212.         }
  213.         static set blue(cB) {
  214.             bP.G._blue = cB
  215.         }
  216.         static get alpha() {
  217.             return bP.G._transparan
  218.         }
  219.         static set alpha(cC) {
  220.             bP.G._transparan = cC
  221.         }
  222.     }
  223.     Graphic._autoScale = !0;
  224.     Graphic._red = Graphic._green = Graphic._blue = Graphic._transparan = 0;
  225.     bP.Graphic = bP.G = Graphic
  226. })(C || (C = {}));
  227. (function(cD) {
  228.     let cE;
  229.     (function(cF) {
  230.         class EventHandler {
  231.             move(cG, cH, e) {
  232.                 let cI = Input.getPos(e.clientX, e.clientY, cH);
  233.                 cG.x = cI.x;
  234.                 cG.y = cI.y;
  235.                 cG.moveX = e.movementX;
  236.                 cG.moveY = e.movementY
  237.             }
  238.             down(cJ, cK) {
  239.                 cJ.xStart = cK.x;
  240.                 cJ.yStart = cK.y;
  241.                 cJ.xDrag = cJ.yDrag = 0;
  242.                 cJ.x = cK.x;
  243.                 cJ.y = cK.y;
  244.                 cJ.isDown = !0;
  245.                 cJ.isTap = cJ.isDrag = !1;
  246.                 cJ.timerStart = Date.now()
  247.             }
  248.             up(cL) {
  249.                 cL.isDown = cL.isDrag = !1;
  250.                 cL.timerEnd = Date.now()
  251.             }
  252.         }
  253.         cF.EventHandler = EventHandler;
  254.         class InpuObj {
  255.             constructor() {
  256.                 this.id = this.pointerType = '';
  257.                 this.xStart = this.yStart = this.xDrag = this.yDrag = this.moveX = this.moveY = this.x = this.y = 0;
  258.                 this._isDrag = this.isDown = this.isTap = !1;
  259.                 this.evt = null;
  260.                 this.button = -1;
  261.                 this.timerStart = this.timerEnd = this.pointerId = 0
  262.             }
  263.             get isDrag() {
  264.                 return this._isDrag
  265.             }
  266.             set isDrag(cM) {
  267.                 this._isDrag = cM
  268.             }
  269.         }
  270.         cF.InpuObj = InpuObj
  271.     })(cE || (cE = {}));
  272.     class Input {
  273.         constructor() {}
  274.         static get lastButton() {
  275.             return Input._lastButton
  276.         }
  277.         static get keyboardEvent() {
  278.             return Input._keyboardEvent
  279.         }
  280.         static set keyboardEvent(cN) {
  281.             Input._keyboardEvent = cN
  282.         }
  283.         static get pointerEvent() {
  284.             return Input._pointerEvent
  285.         }
  286.         static get debug() {
  287.             return Input._debug
  288.         }
  289.         static set debug(cO) {
  290.             Input._debug = cO
  291.         }
  292.         static getMouse() {
  293.             for (let i = 0; i < Input.lst.length; i++) {
  294.                 let cP = Input.lst[i];
  295.                 if (cP.pointerType == 'mouse') return cP
  296.             }
  297.             return null
  298.         }
  299.         static getByDraggedStatus(cQ) {
  300.             for (let i = 0; i < Input.lst.length; i++) {
  301.                 let cR = Input.lst[i];
  302.                 if (cR.isDrag && (cR.pointerType == 'mouse') && cR.button == cQ) return cR;
  303.                 if (cR.isDrag && (cR.pointerType == 'touch')) return cR
  304.             }
  305.             return null
  306.         }
  307.         static getByButton(cS) {
  308.             for (let i = 0; i < Input.lst.length; i++) {
  309.                 let cT = Input.lst[i];
  310.                 if (cT.pointerType == 'mouse')
  311.                     if (cT.button == cS) return cT
  312.             }
  313.             return null
  314.         }
  315.         static getById(id) {
  316.             for (let i = 0; i < Input.lst.length; i++) {
  317.                 let cU = Input.lst[i];
  318.                 if (cU.id == id) return cU
  319.             }
  320.             return null
  321.         }
  322.         static getId(e) {
  323.             return e.pointerType == 'mouse' ? e.pointerType + e.button : e.pointerType + e.pointerId
  324.         }
  325.         static getInput(e) {
  326.             let cV = Input.lst;
  327.             let cW = Input.getId(e);
  328.             for (let i = 0; i < cV.length; i++) {
  329.                 let o = cV[i];
  330.                 if (o.id == cW) return o
  331.             }
  332.             return this.reg(e)
  333.         }
  334.         static checkTap(cX) {
  335.             if (Math.abs(cX.xDrag) > 5) return 'drag x ' + cX.xDrag;
  336.             if (Math.abs(cX.yDrag) > 5) return 'drag y ' + cX.xDrag;
  337.             let cY = cX.timerEnd - cX.timerStart;
  338.             if ((cY) > 500) return `timer ${cY}`;
  339.             return ''
  340.         }
  341.         static init(cZ) {
  342.             console.log('Input init');
  343.             cZ.style.touchAction = 'none';
  344.             cZ.addEventListener('pointerdown', e => {
  345.                 e.stopPropagation();
  346.                 e.preventDefault();
  347.                 let dB = Input.getPos(e.clientX, e.clientY, cZ);
  348.                 let dC = Input.getInput(e);
  349.                 let dD = dC.isDown;
  350.                 Input.evt.down(dC, dB);
  351.                 Input.evt.down(Input.global, dB);
  352.                 Input._pointerEvent = e;
  353.                 Input._lastButton = e.button;
  354.                 dD == !1 && (console.log('dispatch mouse down event, id ' + dC.id), cD.Event.dispatchEvent(cD.Evt.MOUSE_DOWN))
  355.             });
  356.             cZ.addEventListener('pointermove', e => {
  357.                 e.stopPropagation();
  358.                 e.preventDefault();
  359.                 cD.Event.dispatchEvent(cD.Evt.MOUSE_MOVE);
  360.                 dE(Input.global);
  361.                 for (const dF of Input.lst) dE(dF);
  362.  
  363.                 function dE(dG) {
  364.                     Input.evt.move(dG, cZ, e);
  365.                     Input._pointerEvent = e;
  366.                     if (dG.isDown) {
  367.                         if (!dG.isDrag) {
  368.                             console.log('dispatch mouse drag, id ' + dG.id);
  369.                             dG.isDrag = !0;
  370.                             dG.xStart = dG.x;
  371.                             dG.yStart = dG.y;
  372.                             dG != Input.global && cD.Event.dispatchEvent(cD.Evt.MOUSE_START_DRAG)
  373.                         }
  374.                         dG.xDrag = dG.x - dG.xStart;
  375.                         dG.yDrag = dG.y - dG.yStart
  376.                     }
  377.                 }
  378.             });
  379.             cZ.addEventListener('pointerout', e => dA(e));
  380.             cZ.addEventListener('pointerup', e => {
  381.                 this._lastButton = e.button;
  382.                 dA(e)
  383.             });
  384.  
  385.             function dA(e) {
  386.                 e.stopPropagation();
  387.                 e.preventDefault();
  388.                 console.group('pointer up ' + Input.getId(e));
  389.                 let dH = Input.getInput(e);
  390.                 Input.evt.up(dH);
  391.                 Input.evt.up(Input.global);
  392.                 Input._pointerEvent = e;
  393.                 let dI = Input.checkTap(dH);
  394.                 dH.isTap = (dI == '');
  395.                 dH.isTap && cD.Event.dispatchEvent(cD.Evt.MOUSE_CLICK);
  396.                 for (const dJ of Input.lst) {
  397.                     dJ.isDrag && (console.log('dispatch mouse drag end id ' + dH.id), cD.Event.dispatchEvent(cD.Evt.MOUSE_END_DRAG));
  398.                     Input.evt.up(dJ)
  399.                 }
  400.                 cD.Event.dispatchEvent(cD.Evt.MOUSE_UP);
  401.                 console.groupEnd()
  402.             }
  403.         }
  404.         static reg(e) {
  405.             console.log('reg input type ' + e.pointerType + '/button ' + e.button + '/id ' + e.pointerId);
  406.             let dK = new cE.InpuObj;
  407.             dK.id = Input.getId(e);
  408.             dK.pointerType = e.pointerType;
  409.             dK.isDown = dK.isDrag = dK.isTap = !1;
  410.             dK.button = e.button;
  411.             dK.timerEnd = dK.timerStart = dK.x = dK.xDrag = dK.xStart = dK.y = dK.yDrag = dK.yStart = 0;
  412.             dK.evt = null;
  413.             dK.pointerId = e.pointerId;
  414.             dK.moveX = dK.moveY = 0;
  415.             Input.lst.push(dK);
  416.             return dK
  417.         }
  418.     }
  419.     Input._debug = !1;
  420.     Input.lst = [];
  421.     Input.global = new cE.InpuObj;
  422.     Input.evt = new cE.EventHandler;
  423.     Input.getPos = (dL, dM, c) => {
  424.         let r = c.getBoundingClientRect();
  425.         let dN = parseInt(window.getComputedStyle(c).width) / c.width;
  426.         let _F = parseInt(window.getComputedStyle(c).height) / c.height;
  427.         let _G = ~~(dL - r.x) / dN;
  428.         let _H = ~~(dM - r.y) / _F;
  429.         return {
  430.             x: _G,
  431.             y: _H
  432.         }
  433.     };
  434.     cD.Input = cD.In = Input
  435. })(C || (C = {}));
  436. var C;
  437. (function(dO) {
  438.     let dP;
  439.     (function(dQ) {
  440.         class KeybObj {
  441.             constructor(dR, dS) {
  442.                 this.key = '';
  443.                 this.isDown = !1;
  444.                 this.key = dR;
  445.                 this.isDown = dS
  446.             }
  447.         }
  448.         dQ.KeybObj = KeybObj
  449.     })(dP || (dP = {}));
  450.     class Keyboard {
  451.         static get lastKey() {
  452.             return Keyboard._lastKey
  453.         }
  454.         static get obj() {
  455.             return Keyboard._obj
  456.         }
  457.         static getByKey(dT) {
  458.             for (let i = 0; i < Keyboard.list.length; i++)
  459.                 if (Keyboard.list[i].key == dT) return Keyboard.list[i];
  460.             return Keyboard.reg(dT, !1)
  461.         }
  462.         static reg(dU, dV) {
  463.             console.log(`new key registered: ${dU}`);
  464.             let k = new dP.KeybObj(dU, dV);
  465.             Keyboard.list.push(k);
  466.             return k
  467.         }
  468.         static setDown(dW, dX) {
  469.             let dY = Keyboard.list;
  470.             for (let i = 0; i < dY.length; i++) {
  471.                 let o = dY[i];
  472.                 if (o.key == dW) {
  473.                     o.isDown = dX;
  474.                     return o
  475.                 }
  476.             }
  477.             return Keyboard.reg(dW, dX)
  478.         }
  479.         static IsDown(dZ = '') {
  480.             let eA = Keyboard.list;
  481.             for (let i = 0; i < eA.length; i++) {
  482.                 let o = eA[i];
  483.                 if (o.key == dZ) return o.isDown
  484.             }
  485.             this.reg(dZ, !1);
  486.             return !1
  487.         }
  488.         static init() {
  489.             window.addEventListener('keydown', e => {
  490.                 Keyboard.anyKey.isDown = !0;
  491.                 Keyboard._lastKey = e.key;
  492.                 Keyboard._obj = e;
  493.                 let k = Keyboard.getByKey(e.key);
  494.                 k.isDown == !1 && (Keyboard.setDown(e.key, !0), Keyboard.setDown('', !0), dO.Event.dispatchEvent(dO.Evt.KEYB_DOWN))
  495.             });
  496.             window.addEventListener('keyup', e => {
  497.                 Keyboard.anyKey.isDown = !1;
  498.                 Keyboard._lastKey = e.key;
  499.                 Keyboard._obj = e;
  500.                 Keyboard.setDown(e.key, !1);
  501.                 Keyboard.setDown('', !1);
  502.                 dO.Event.dispatchEvent(dO.Evt.KEYB_UP)
  503.             })
  504.         }
  505.     }
  506.     Keyboard.list = [];
  507.     Keyboard.anyKey = new dP.KeybObj('', !1);
  508.     Keyboard._lastKey = '';
  509.     dO.Keyboard = Keyboard
  510. })(C || (C = {}));
  511. (function(eB) {
  512.     class Pt {
  513.         constructor(x = 0, y = 0) {
  514.             this.x = x;
  515.             this.y = y
  516.         }
  517.         get x() {
  518.             return this._x
  519.         }
  520.         set x(eC) {
  521.             this._x = eC
  522.         }
  523.         get y() {
  524.             return this._y
  525.         }
  526.         set y(eD) {
  527.             this._y = eD
  528.         }
  529.         static create(x = 0, y = 0) {
  530.             return new Pt(x, y)
  531.         }
  532.         static copy(p1, p2) {
  533.             p2.x = p1.x;
  534.             p2.y = p1.y
  535.         }
  536.         static clone(p) {
  537.             return Pt.create(p.x, p.y)
  538.         }
  539.         static putarPoros(p, eE = 0, eF = 0, eG = 0) {
  540.             eB.Tf.rotateRel(p.x, p.y, eE, eF, eG);
  541.             p.x = eB.Tf.lastX;
  542.             p.y = eB.Tf.lastY
  543.         }
  544.     }
  545.     eB.Pt = Pt
  546. })(C || (C = {}));
  547. var C;
  548. (function(eH) {
  549.     class Seg {
  550.         constructor(A = new eH.Pt, B = new eH.Pt) {
  551.             this.A = A;
  552.             this.B = B
  553.         }
  554.         get A() {
  555.             return this._A
  556.         }
  557.         set A(eI) {
  558.             this._A = eI
  559.         }
  560.         get B() {
  561.             return this._B
  562.         }
  563.         set B(eJ) {
  564.             this._B = eJ
  565.         }
  566.         static create(eK = new eH.Pt, eL = new eH.Pt) {
  567.             return new eH.Sg(eK, eL)
  568.         }
  569.         static boundCollide(eM, eN) {
  570.             if (eH.Sg.maxX(eM) < eH.Sg.minX(eN)) return !1;
  571.             if (eH.Sg.minX(eM) > eH.Sg.maxX(eN)) return !1;
  572.             if (eH.Sg.maxY(eM) < eH.Sg.minY(eN)) return !1;
  573.             if (eH.Sg.minY(eM) > eH.Sg.maxY(eN)) return !1;
  574.             return !0
  575.         }
  576.         static collide(eO, eP) {
  577.             let eQ = eH.Sg.boundCollide(eO, eP);
  578.             if (!eQ) return !1;
  579.             let eR = eH.Sg.clone(eP);
  580.             let eS = eH.Sg.clone(eO);
  581.             let eT = eH.Sg.deg(eP);
  582.             eH.Sg.rotate(eR, -eT, eP.A.x, eP.A.y);
  583.             eH.Sg.rotate(eS, -eT, eP.A.x, eP.A.y);
  584.             if (!eH.Sg.boundCollide(eS, eR)) return !1;
  585.             eH.Sg.translate(eS, -eP.A.x, -eP.A.y);
  586.             eH.Sg.translate(eR, -eP.A.x, -eP.A.y);
  587.             if (!eH.Sg.crossHor(eS)) return !1;
  588.             let x = eH.Sg.getXAtIdx(eS, eH.Sg.xHorIdx(eS));
  589.             if (x > eH.Sg.maxX(eR)) return !1;
  590.             if (x < eH.Sg.minX(eR)) return !1;
  591.             return !0
  592.         }
  593.         static copy(eU, eV) {
  594.             eH.Pt.copy(eU.A, eV.B);
  595.             eH.Pt.copy(eU.B, eV.B)
  596.         }
  597.         static clone(eW) {
  598.             return new Seg(eH.Pt.clone(eW.A), eH.Pt.clone(eW.B))
  599.         }
  600.         static crossHor(eX) {
  601.             if (eH.Sg.maxY(eX) > 0)
  602.                 if (eH.Sg.minY(eX) < 0) return !0;
  603.             return !1
  604.         }
  605.         static deg(eY) {
  606.             return eH.Tf.sudut(eY.B.x - eY.A.x, eY.B.y - eY.A.y)
  607.         }
  608.         static getXAtIdx(eZ, fA) {
  609.             return eZ.A.x + (fA * eH.Sg.vecI(eZ))
  610.         }
  611.         static vecI(fB) {
  612.             return fB.B.x - fB.A.x
  613.         }
  614.         static rotate(fC, fD = 0, fE = 0, fF = 0) {
  615.             eH.Pt.putarPoros(fC.A, fE, fF, fD);
  616.             eH.Pt.putarPoros(fC.B, fE, fF, fD)
  617.         }
  618.         static minX(fG) {
  619.             return Math.min(fG.A.x, fG.B.x)
  620.         }
  621.         static maxX(fH) {
  622.             return Math.max(fH.A.x, fH.B.x)
  623.         }
  624.         static minY(fI) {
  625.             return Math.min(fI.A.y, fI.B.y)
  626.         }
  627.         static maxY(fJ) {
  628.             return Math.max(fJ.A.y, fJ.B.y)
  629.         }
  630.         static translate(fK, x = 0, y = 0) {
  631.             fK.A.x += x;
  632.             fK.A.y += y;
  633.             fK.B.x += x;
  634.             fK.B.y += y
  635.         }
  636.         static xHorIdx(fL) {
  637.             if (!Seg.crossHor(fL)) return NaN;
  638.             let fM = 0;
  639.             fM = (0 - fL.A.y) / (fL.B.y - fL.A.y);
  640.             return fM
  641.         }
  642.     }
  643.     eH.Seg = eH.Sg = Seg
  644. })(C || (C = {}));
  645. (function(fN) {
  646.     class Ktk {
  647.         constructor() {
  648.             this.vs = this.segs = []
  649.         }
  650.         static buat(fO = 0, fP = 0, fQ = 0, fR = 0) {
  651.             let r = new Ktk;
  652.             r.vs.push(fN.Pt.create(fO, fP));
  653.             r.vs.push(fN.Pt.create(fQ, fP));
  654.             r.vs.push(fN.Pt.create(fQ, fR));
  655.             r.vs.push(fN.Pt.create(fO, fR));
  656.             r.segs.push(fN.Seg.create(r.vs[0], r.vs[1]));
  657.             r.segs.push(fN.Seg.create(r.vs[1], r.vs[2]));
  658.             r.segs.push(fN.Seg.create(r.vs[2], r.vs[3]));
  659.             r.segs.push(fN.Seg.create(r.vs[3], r.vs[0]));
  660.             return r
  661.         }
  662.         static destroy(r) {
  663.             while (r.vs.length > 0) r.vs.pop();
  664.             while (r.segs.length > 0) {
  665.                 let s = r.segs.pop();
  666.                 s.A = s.B = null
  667.             }
  668.         }
  669.         static copy(r) {
  670.             let fS = Ktk.buat();
  671.             Ktk.copyInfo(r, fS);
  672.             return fS
  673.         }
  674.         static copyInfo(r1, r2) {
  675.             for (let i = 0; i < r1.segs.length; i++) fN.Seg.copy(r1.segs[i], r2.segs[i])
  676.         }
  677.         static collideBound(r1, r2) {
  678.             if (Ktk.maxX(r1) < Ktk.minX(r2)) return !1;
  679.             if (Ktk.minX(r1) > Ktk.maxX(r2)) return !1;
  680.             if (Ktk.maxY(r1) < Ktk.minY(r2)) return !1;
  681.             if (Ktk.minY(r1) > Ktk.maxY(r2)) return !1;
  682.             return !0
  683.         }
  684.         static collide(fT, fU) {
  685.             let fV = Ktk.collideBound(fT, fU);
  686.             if (!fV) return !1;
  687.             for (let i = 0; i < fT.segs.length; i++)
  688.                 for (let j = 0; j < fU.segs.length; j++)
  689.                     if (fN.Seg.collide(fT.segs[i], fU.segs[j])) return !0;
  690.             return !1
  691.         }
  692.         static collideDotBound(r, d) {
  693.             if (d.x < Ktk.minX(r)) return !1;
  694.             if (d.x > Ktk.maxX(r)) return !1;
  695.             if (d.y < Ktk.minY(r)) return !1;
  696.             if (d.y > Ktk.maxY(r)) return !1;
  697.             return !0
  698.         }
  699.         static collideDot(r, x, y) {
  700.             let fW = Ktk.copy(r);
  701.             let p = fN.Pt.create(x, y);
  702.             let d = fN.Seg.deg(fW.segs[0]);
  703.             let fX = fW.vs[0];
  704.             if (!Ktk.collideDotBound(r, p)) return !1;
  705.             Ktk.rotate(fW, -d, fX.x, fX.y, !1);
  706.             fN.Pt.putarPoros(p, fX.x, fX.y, -d);
  707.             if (!Ktk.collideDotBound(fW, p)) return !1;
  708.             return !0
  709.         }
  710.         static minX(r) {
  711.             let x = r.vs[0].x;
  712.             for (const item of r.vs) item.x < x && (x = item.x);
  713.             return x
  714.         }
  715.         static maxX(r) {
  716.             let x = r.vs[0].x;
  717.             for (const item of r.vs) item.x > x && (x = item.x);
  718.             return x
  719.         }
  720.         static minY(r) {
  721.             let y = r.vs[0].y;
  722.             for (const item of r.vs) item.y < y && (y = item.y);
  723.             return y
  724.         }
  725.         static maxY(r) {
  726.             let y = r.vs[0].y;
  727.             for (const item of r.vs) item.y > y && (y = item.y);
  728.             return y
  729.         }
  730.         static translate(fY, x, y) {
  731.             for (const v of fY.vs) {
  732.                 v.x += x;
  733.                 v.y += y
  734.             }
  735.         }
  736.         static rotate(r, fZ, gA = 0, gB, gC = !0) {
  737.             let gD;
  738.             gC ? gD = Ktk.copy(r) : gD = r;
  739.             for (const p of gD.vs) fN.Pt.putarPoros(p, gA, gB, fZ);
  740.             return gD
  741.         }
  742.     }
  743.     fN.Ktk = Ktk
  744. })(C || (C = {}));
  745. var C;
  746. (function(gE) {
  747.     class Transform {
  748.         static get lastX() {
  749.             return gE.Tf._lastX
  750.         }
  751.         static get lastY() {
  752.             return gE.Tf._lastY
  753.         }
  754.         static quadDeg2(x, y, gF) {
  755.             if (x == 0) {
  756.                 if (y == 0) return gF;
  757.                 if (y > 0) return gF;
  758.                 else if (y < 0) return 360 - Math.abs(gF)
  759.             } else if (x > 0) {
  760.                 if (y == 0) return gF;
  761.                 if (y > 0) return gF;
  762.                 else if (y < 0) return 360 - Math.abs(gF)
  763.             } else if (x < 0) {
  764.                 if (y == 0) return 180;
  765.                 if (y > 0) return 180 - Math.abs(gF);
  766.                 else if (y < 0) return 180 + Math.abs(gF)
  767.             }
  768.             throw Error()
  769.         }
  770.         static sudut(x, y) {
  771.             let l;
  772.             let gG;
  773.             l = Math.sqrt(x * x + y * y);
  774.             l == 0 && (l = .00001);
  775.             gG = y / l;
  776.             gG = Math.asin(gG);
  777.             gG *= gE.Tf.RAD2DEG;
  778.             gG = gE.Tf.quadDeg2(x, y, gG);
  779.             gG = gE.Tf.normalizeDeg(gG);
  780.             return gG
  781.         }
  782.         static normalizeDeg(gH) {
  783.             while (gH >= 360) gH -= 360;
  784.             while (gH <= -360) gH += 360;
  785.             gH < 0 && (gH = 360 + gH);
  786.             return gH
  787.         }
  788.         static degDist(gI = 0, gJ, gK = !0) {
  789.             if (gK) return Transform.degDistMin(gI, gJ);
  790.             return Transform.degDistMax(gI, gJ)
  791.         }
  792.         static degDistMax(gL = 0, gM) {
  793.             gL = gE.Tf.normalizeDeg(gL);
  794.             gM = gE.Tf.normalizeDeg(gM);
  795.             let gN = gE.Tf.degDistMin(gL, gM);
  796.             if (gN >= 0) return -(360 - gN);
  797.             return (360 - Math.abs(gN))
  798.         }
  799.         static degDistMin(gO = 0, gP) {
  800.             gO = gE.Tf.normalizeDeg(gO);
  801.             gP = gE.Tf.normalizeDeg(gP);
  802.             if (gP >= gO) {
  803.                 if (gP - gO > 180) return -(gO + 360 - gP);
  804.                 return gP - gO
  805.             } else {
  806.                 if (gO - gP >= 180) return 360 + gP - gO;
  807.                 return gP - gO
  808.             }
  809.         }
  810.         static rotateRel(x = 0, y = 0, gQ = 0, gR = 0, gS = 10) {
  811.             let gT = x - gQ;
  812.             let gU = y - gR;
  813.             let gV;
  814.             let _i;
  815.             gS *= gE.Tf.DEG2RAD;
  816.             gV = gT * Math.cos(gS) - gU * Math.sin(gS);
  817.             _i = gT * Math.sin(gS) + gU * Math.cos(gS);
  818.             gE.Tf._lastX = gV + gQ;
  819.             gE.Tf._lastY = _i + gR
  820.         }
  821.     }
  822.     Transform.RAD2DEG = 180.0 / Math.PI;
  823.     Transform.DEG2RAD = Math.PI / 180.0;
  824.     Transform._lastX = Transform._lastY = 0;
  825.     gE.Transform = gE.Tf = Transform
  826. })(C || (C = {}));
  827. (function(gW) {
  828.     class ImgImpl {
  829.         static CreateImage(gX, gY) {
  830.             let h = new gW.Image;
  831.             h.canvas = document.createElement('canvas');
  832.             h.canvas.width = gX;
  833.             h.canvas.height = h.frameH = gY;
  834.             h.frameW = h.width = gX;
  835.             h.height = gY;
  836.             h.load = !0;
  837.             h.img = document.createElement('img');
  838.             gW.Ip.register(h, h.url, h.dragType);
  839.             return h
  840.         }
  841.         static MuatAnimasi(gZ, hA, hB, hC = 0) {
  842.             let hD = document.createElement('canvas');
  843.             let hE = new gW.Image(gZ);
  844.             hE.isAnim = !0;
  845.             hE.frameW = hA;
  846.             hE.frameH = hB;
  847.             hE.width = hA;
  848.             hE.height = hB;
  849.             return hE
  850.         }
  851.         static register(hF, hG, hH) {
  852.             let hI;
  853.             hI = hF;
  854.             hI.dragType = hH;
  855.             hI.url = hG;
  856.             gW.Ip.daftar.push(hI);
  857.             return hI
  858.         }
  859.         static free(hJ) {
  860.             for (let i = 0; i < this.daftar.length; i++)
  861.                 if (this.daftar[i] == hJ) {
  862.                     hJ.canvas = hJ.img = null;
  863.                     gW.Ktk.destroy(hJ.rect);
  864.                     this.daftar.splice(i, 1);
  865.                     return
  866.                 }
  867.         }
  868.         static Muat(hK) {
  869.             return new gW.Image(hK)
  870.         }
  871.         static tabrakan(hL, hM, hN, hO, hP, hQ) {
  872.             gW.Ip.resetRect(hL);
  873.             gW.Ip.rectToImageTf(hL, hM, hN);
  874.             gW.Ip.resetRect(hO);
  875.             gW.Ip.rectToImageTf(hO, hP, hQ);
  876.             return gW.Ktk.collide(hL.rect, hO.rect)
  877.         }
  878.         static dotInsideImage(hR, hS, hT, hU, hV) {
  879.             gW.Ip.resetRect(hR);
  880.             gW.Ip.rectToImageTf(hR, hS, hT);
  881.             return gW.Ktk.collideDot(hR.rect, hU, hV)
  882.         }
  883.         static gambarUbin(hW, x = 0, y = 0, hX = 0) {
  884.             let hY = 0;
  885.             let hZ = 0;
  886.             if (hW.load == !1) return;
  887.             let iA = ~~hW.width;
  888.             let iB = ~~hW.height;
  889.             while (x < 0) x += iA;
  890.             while (x > 0) x -= iA;
  891.             while (y < 0) y += iB;
  892.             while (y > 0) y -= iB;
  893.             x -= iA;
  894.             y -= iB;
  895.             hX = ~~hX;
  896.             hY = Math.ceil((gW.G.Canvas().width + Math.abs(x)) / iA);
  897.             hZ = Math.ceil((gW.G.Canvas().height + Math.abs(y)) / iB);
  898.             for (let i = 0; i < hY; i++)
  899.                 for (let j = 0; j < hZ; j++) gW.Ip.DrawSingle(hW, x + (i * iA), y + (j * iB), hX)
  900.         }
  901.         static AmbilPiksel(x = 0, y = 0) {
  902.             try {
  903.                 let iC = gW.G.Canvas().getContext('2d').getImageData(x, y, 1, 1).data;
  904.                 let iD = [];
  905.                 iD.push(iC[0]);
  906.                 iD.push(iC[1]);
  907.                 iD.push(iC[2]);
  908.                 iD.push(iC[3]);
  909.                 gW.G.red = iC[0];
  910.                 gW.G.green = iC[1];
  911.                 gW.G.blue = iC[2];
  912.                 gW.G.alpha = iC[3]
  913.             } catch (e) {}
  914.         }
  915.         static SetPiksel(x = 0, y = 0) {
  916.             gW.G.Canvas().getContext('2d').fillRect(~~x, ~~y, 1, 1)
  917.         }
  918.         static Draw(iE) {
  919.             iE.tilable ? gW.Ip.gambarUbin(iE, iE.x, iE.y, iE.frame) : gW.Ip.DrawSingle(iE, iE.x, iE.y, iE.frame)
  920.         }
  921.         static DrawSingle(iF, x = 0, y = 0, iG = 0) {
  922.             let iH = gW.G.Canvas().getContext('2d');
  923.             let iI = 0;
  924.             let iJ = 0;
  925.             let iK = 0;
  926.             let _I = 0;
  927.             if (iF.load == !1) return;
  928.             !iF.url ? _I = iF.width : _I = iF.img.naturalWidth;
  929.             iF.ctrIdx = gW.Image.ctrDraw++;
  930.             iG = ~~iG;
  931.             iI = ~~_I / iF.frameW;
  932.             iJ = (iG % iI);
  933.             iK = ~~iG / iI;
  934.             iJ *= iF.frameW;
  935.             iK *= iF.frameH;
  936.             iJ = ~~iJ;
  937.             iK = ~~iK;
  938.             let _j = ~~x;
  939.             let _k = ~~y;
  940.             let _l = ~~iF.width;
  941.             let M = ~~iF.height;
  942.             _j -= iF.handleX;
  943.             _k -= iF.handleY;
  944.             iF.rotation != 0 ? (iH.save(), iH.translate(x, y), iH.rotate(iF.rotation * (Math.PI / 180)), _n(-iF.handleX, -iF.handleY), iH.restore()) : (iH.save(), _n(_j, _k), iH.restore());
  945.  
  946.             function _n(iL, iM) {
  947.                 iL -= gW.Camera.x;
  948.                 iM -= gW.Camera.y;
  949.                 iH.globalAlpha = iF.alpha / 100;
  950.                 iH.drawImage(iF.canvas, iJ, iK, iF.frameW, iF.frameH, ~~iL, ~~iM, _l, M)
  951.             }
  952.         }
  953.         static resetRect(iN) {
  954.             let iO = iN.rect;
  955.             let p;
  956.             p = iO.vs[0];
  957.             p.x = p.y = 0;
  958.             p = iO.vs[1];
  959.             p.x = iN.frameW - 1;
  960.             p.y = 0;
  961.             p = iO.vs[2];
  962.             p.x = iN.frameW - 1;
  963.             p.y = iN.frameH - 1;
  964.             p = iO.vs[3];
  965.             p.x = 0;
  966.             p.y = iN.frameH - 1
  967.         }
  968.         static rectToImageTf(iP, x, y) {
  969.             let iQ = iP.rect;
  970.             let p;
  971.             let iR = iP.width - 1;
  972.             let iS = iP.height - 1;
  973.             p = iQ.vs[1];
  974.             p.x = iR;
  975.             p.y = 0;
  976.             p = iQ.vs[2];
  977.             p.x = iR;
  978.             p.y = iS;
  979.             p = iQ.vs[3];
  980.             p.x = 0;
  981.             p.y = iS;
  982.             gW.Ktk.translate(iQ, x, y);
  983.             gW.Ktk.translate(iQ, -iP.handleX, -iP.handleY);
  984.             gW.Ktk.rotate(iQ, iP.rotation, x, y, !1)
  985.         }
  986.         static AllImageLoaded() {
  987.             for (let i = 0; i < gW.Ip.daftar.length; i++) {
  988.                 let iT = gW.Ip.daftar[i];
  989.                 if (!iT.load) return !1
  990.             }
  991.             return !0
  992.         }
  993.     }
  994.     ImgImpl.props = ImgImpl.daftar = [];
  995.     gW.ImgImpl = gW.Ip = ImgImpl
  996. })(C || (C = {}));
  997. var C;
  998. (function(iU) {
  999.     let iV;
  1000.     (function(iW) {
  1001.         iW[iW['drag'] = 1] = 'drag';
  1002.         iW[iW['rotasi'] = 2] = 'rotasi';
  1003.         iW[iW['remoteDrag'] = 3] = 'remoteDrag';
  1004.         iW[iW['remoteRotation'] = 4] = 'remoteRotation'
  1005.     })(iV || (iV = {}));
  1006.     class ImgIntHandler {
  1007.         init() {
  1008.             iU.Event.addEventListener(iU.Evt.MOUSE_DOWN, () => this.inputDown({
  1009.                 x: iU.Input.global.x,
  1010.                 y: iU.Input.global.y
  1011.             }, iU.Input.global.id));
  1012.             iU.Event.addEventListener(iU.Evt.MOUSE_MOVE, () => this.inputMove({
  1013.                 x: iU.Input.global.x,
  1014.                 y: iU.Input.global.y
  1015.             }, iU.Input.global.id));
  1016.             iU.Event.addEventListener(iU.Evt.MOUSE_UP, () => {
  1017.                 console.log('clear image mouse status');
  1018.                 for (const iX of iU.Ip.daftar) {
  1019.                     iX.down = iX.dragged = !1
  1020.                 }
  1021.             })
  1022.         }
  1023.         down(iY, iZ, jA) {
  1024.             let jB = {
  1025.                 x: iZ.x - iU.Camera.x,
  1026.                 y: iZ.y - iU.Camera.y
  1027.             };
  1028.             iY.down = !0;
  1029.             iY.dragStartX = jB.x - iY.x;
  1030.             iY.dragStartY = jB.y - iY.y;
  1031.             iY.inputId = jA;
  1032.             iY.initialMouseAngle = iU.Tf.sudut(jB.x - iY.x, jB.y - iY.y);
  1033.             iY.initialAngle = iY.rotation
  1034.         }
  1035.         inputDown(jC, jD) {
  1036.             console.group('input down');
  1037.             let jE = {
  1038.                 x: jC.x - iU.Camera.x,
  1039.                 y: jC.y - iU.Camera.y
  1040.             };
  1041.             let jF = -1;
  1042.             let jG = null;
  1043.             for (let i = iU.Ip.daftar.length - 1; i >= 0; i--) {
  1044.                 let jH;
  1045.                 jH = iU.Ip.daftar[i];
  1046.                 if (iU.Ip.dotInsideImage(jH, jH.x, jH.y, jE.x, jE.y)) jH.ctrIdx > jF && (jF = jH.ctrIdx, jG = jH);
  1047.                 else(jH.dragType == 3 || jH.dragType == 4) && this.down(jH, jC, jD)
  1048.             }
  1049.             jG ? (console.log(`img pressed, id: ${jD}`), this.down(jG, jC, jD)) : (console.log('no image pressed'));
  1050.             console.groupEnd()
  1051.         }
  1052.         inputMove(jI, jJ) {
  1053.             let jK = {
  1054.                 x: jI.x - iU.Camera.x,
  1055.                 y: jI.y - iU.Camera.y
  1056.             };
  1057.             for (const jL of iU.Ip.daftar)
  1058.                 if (jL.down && (jL.dragType != 0) && (jL.inputId == jJ)) {
  1059.                     jL.dragged = !0;
  1060.                     if (jL.dragType == iV.drag || (jL.dragType == iV.remoteDrag)) {
  1061.                         jL.x = jK.x - jL.dragStartX;
  1062.                         jL.y = jK.y - jL.dragStartY;
  1063.                         console.debug('item drag move')
  1064.                     } else if (jL.dragType == iV.rotasi || (jL.dragType == iV.remoteRotation)) {
  1065.                         let jM = iU.Tf.sudut(jK.x - jL.x, jK.y - jL.y);
  1066.                         let jN = jM - jL.initialMouseAngle;
  1067.                         jL.rotation = jL.initialAngle + jN
  1068.                     }
  1069.                 }
  1070.         }
  1071.     }
  1072.     iU.sprInt = new ImgIntHandler
  1073. })(C || (C = {}));
  1074. (function(jO) {
  1075.     class Teks {
  1076.         static get size() {
  1077.             return Teks._size
  1078.         }
  1079.         static set size(jP) {
  1080.             Teks._size = jP
  1081.         }
  1082.         static Goto(x, y) {
  1083.             Teks._x = x;
  1084.             Teks._y = y
  1085.         }
  1086.         static Name(jQ = 'cursive') {
  1087.             Teks._name = jQ
  1088.         }
  1089.         static Size(n = 12) {
  1090.             Teks.size = n
  1091.         }
  1092.         static Align(s = 'left') {
  1093.             jO.G.Canvas().getContext('2d').textAlign = s
  1094.         }
  1095.         static WriteLn(jR) {
  1096.             jO.G.Canvas().getContext('2d').font = Teks.size + 'px ' + Teks._name;
  1097.             jO.G.Canvas().getContext('2d').fillText(jR, Teks._x, Teks._y);
  1098.             jO.G.Canvas().getContext('2d').strokeText(jR, Teks._x, Teks._y);
  1099.             Teks._y += Teks.size + 2
  1100.         }
  1101.         static Write(jS) {
  1102.             jO.G.Canvas().getContext('2d').font = Teks.size + 'px ' + Teks._name;
  1103.             jO.G.Canvas().getContext('2d').fillText(jS, Teks._x, Teks._y);
  1104.             jO.G.Canvas().getContext('2d').strokeText(jS, Teks._x, Teks._y)
  1105.         }
  1106.     }
  1107.     Teks._name = 'Arial';
  1108.     Teks._size = 12;
  1109.     Teks._x = 120;
  1110.     Teks._y = 10;
  1111.     jO.Teks = jO.Tk = Teks
  1112. })(C || (C = {}));
  1113. var C;
  1114. (function(jT) {
  1115.     class Sound {
  1116.         constructor() {
  1117.             this._src = '';
  1118.             this._loaded = !1
  1119.         }
  1120.         static get lastSound() {
  1121.             return Sound._lastSound
  1122.         }
  1123.         static set lastSound(jU) {
  1124.             Sound._lastSound = jU
  1125.         }
  1126.         get playedCount() {
  1127.             return this._playedCount
  1128.         }
  1129.         set playedCount(jV) {
  1130.             this._playedCount = jV
  1131.         }
  1132.         get sound() {
  1133.             return this._sound
  1134.         }
  1135.         set sound(jW) {
  1136.             this._sound = jW
  1137.         }
  1138.         get loaded() {
  1139.             return this._loaded
  1140.         }
  1141.         set loaded(jX) {
  1142.             this._loaded = jX
  1143.         }
  1144.         get src() {
  1145.             return this._src
  1146.         }
  1147.         set src(jY) {
  1148.             this._src = jY
  1149.         }
  1150.     }
  1151.     Sound.list = [];
  1152.     jT.Sound = jT.Sn = Sound
  1153. })(C || (C = {}));
  1154.  
  1155. function D(jZ) {
  1156.     let kA = document.createElement('audio');
  1157.     kA.onload = () => {
  1158.         C.Sound.lastSound = kA;
  1159.         C.Event.dispatchEvent(C.Evt.SOUND_LOADED);
  1160.         console.log('sound loaded')
  1161.     };
  1162.     kA.onended = () => {
  1163.         try {
  1164.             C.Sound.lastSound = kA;
  1165.             C.Event.dispatchEvent(C.Evt.SOUND_ENDED);
  1166.             console.log('sound ended')
  1167.         } catch (e) {}
  1168.     };
  1169.     kA.src = jZ;
  1170.     return kA
  1171. }
  1172.  
  1173. function E(s) {
  1174.     s.play()
  1175. }
  1176.  
  1177. function F() {
  1178.     return C.Sound.lastSound
  1179. }
  1180. var G = C.G;
  1181.  
  1182. function J(c) {
  1183.     G.SetCanvas(c)
  1184. }
  1185.  
  1186. function K() {
  1187.     return G.Canvas()
  1188. }
  1189.  
  1190. function L(x, y, w, h) {
  1191.     G.Canvas().getContext('2d').clearRect(x, y, w, h)
  1192. }
  1193.  
  1194. function m(w = 320, h = 240, kB = null, kC = 1) {
  1195.     G.Graphics(w, h, kB, kC)
  1196. }
  1197.  
  1198. function N(x = 0, y = 0, w = 0, h = 0) {
  1199.     G.Cls(x, y, w, h)
  1200. }
  1201.  
  1202. function O() {
  1203.     return G.green
  1204. }
  1205.  
  1206. function P() {
  1207.     return G.red
  1208. }
  1209.  
  1210. function q() {
  1211.     return G.blue
  1212. }
  1213.  
  1214. function R() {
  1215.     return ~~G.alpha * 100
  1216. }
  1217.  
  1218. function _s(x = 0, y = 0) {
  1219.     H.AmbilPiksel(x, y)
  1220. }
  1221.  
  1222. function t(x = 0, y = 0) {
  1223.     H.SetPiksel(x, y)
  1224. }
  1225.  
  1226. function u(r = 0, g = 0, b = 0, a = 100) {
  1227.     G.Canvas().getContext('2d').fillStyle = `rgba( ${r}, ${g}, ${b}, ${a})`;
  1228.     G.red = r;
  1229.     G.green = g;
  1230.     G.blue = b;
  1231.     G.alpha = a
  1232. }
  1233.  
  1234. function V(r = 0, g = 0, b = 0, a = 1) {
  1235.     G.Canvas().getContext('2d').strokeStyle = `rgba( ${r}, ${g}, ${b}, ${a})`;
  1236.     G.red = r;
  1237.     G.green = g;
  1238.     G.blue = b;
  1239.     G.alpha = a
  1240. }
  1241.  
  1242. function W(kD, kE, kF, kG) {
  1243.     let kH = K().getContext('2d');
  1244.     kD = ~~kD;
  1245.     kE = ~~kE;
  1246.     kF = ~~kF;
  1247.     kG = ~~kG;
  1248.     kH.beginPath();
  1249.     kH.moveTo(kD, kE);
  1250.     kH.lineTo(kF, kG);
  1251.     kH.stroke()
  1252. }
  1253.  
  1254. function X(kI, kJ, kK, kL) {
  1255.     let kM = K().getContext('2d');
  1256.     kM.fillRect(kI, kJ, kK - kI, kL - kJ);
  1257.     kM.strokeRect(kI, kJ, kK - kI, kL - kJ)
  1258. }
  1259.  
  1260. function Y(x = 0, y = 0, kN) {
  1261.     let kO = K().getContext('2d');
  1262.     kO.save();
  1263.     kO.translate(x, y);
  1264.     kO.beginPath();
  1265.     kO.arc(0, 0, kN, 0, 2 * Math.PI, !1);
  1266.     kO.restore();
  1267.     kO.stroke()
  1268. }
  1269. window.addEventListener('load', () => {
  1270.     let w = window;
  1271.     w['Start'] && (typeof w['Start'] == 'function') ? w['Start']() : console.log('Start not found')
  1272. });
  1273.  
  1274. function z(kP = 0) {
  1275.     return I.getByButton(kP)?.isDown
  1276. }
  1277.  
  1278. function aA(kQ = 0) {
  1279.     return I.getByButton(kQ)?.isDrag
  1280. }
  1281.  
  1282. function aB(kR = 0) {
  1283.     return I.getByDraggedStatus(kR)?.xDrag
  1284. }
  1285.  
  1286. function aC(kS = 0) {
  1287.     return I.getByDraggedStatus(kS)?.yDrag
  1288. }
  1289.  
  1290. function aD() {
  1291.     return I.global?.x
  1292. }
  1293.  
  1294. function aE() {
  1295.     return I.global?.y
  1296. }
  1297.  
  1298. function aF(kT = 0) {
  1299.     return I.getByButton(kT)?.xStart
  1300. }
  1301.  
  1302. function aG(kU = 0) {
  1303.     return I.getByButton(kU)?.yStart
  1304. }
  1305.  
  1306. function aH() {
  1307.     return I.lastButton
  1308. }
  1309.  
  1310. function aI() {
  1311.     return I.global.moveX
  1312. }
  1313.  
  1314. function aJ() {
  1315.     return I.global.moveY
  1316. }
  1317.  
  1318. function aK(kV = 0, kW, kX = !0) {
  1319.     return C.Transform.degDist(kV, kW, kX)
  1320. }
  1321.  
  1322. function aL(x, y) {
  1323.     return C.Tf.sudut(x, y)
  1324. }
  1325.  
  1326. function aM(n, kY, kZ) {
  1327.     if (n < kY) return kY;
  1328.     if (n > kZ) return kZ;
  1329.     return n
  1330. }
  1331.  
  1332. function aN(lA) {
  1333.     return H.Muat(lA)
  1334. }
  1335.  
  1336. function aO(lB) {
  1337.     H.Draw(lB)
  1338. }
  1339.  
  1340. function aP(lC, lD) {
  1341.     return H.tabrakan(lC, lC.x, lC.y, lD, lD.x, lD.y)
  1342. }
  1343.  
  1344. function aQ(lE, x, y) {
  1345.     return H.dotInsideImage(lE, lE.x, lE.y, x, y)
  1346. }
  1347.  
  1348. function aR(lF, lG) {
  1349.     return H.CreateImage(lF, lG)
  1350. }
  1351.  
  1352. function aS() {
  1353.     return H.AllImageLoaded()
  1354. }
  1355.  
  1356. function aT(lH) {
  1357.     H.free(lH)
  1358. }
  1359.  
  1360. function aU(lI, x, y) {
  1361.     let lJ = lI.canvas.getContext('2d');
  1362.     lJ.clearRect(0, 0, lI.canvas.width, lI.canvas.height);
  1363.     lJ.drawImage(K(), -x, -y)
  1364. }
  1365. var aV = C.Teks.Goto;
  1366.  
  1367. function bB(lK = '') {
  1368.     return C.Keyboard.IsDown(lK)
  1369. }
  1370.  
  1371. function bC() {
  1372.     return C.Keyboard.lastKey
  1373. }
  1374. var C;
  1375. (function(lL) {
  1376.     class Image {
  1377.         constructor(lM = '') {
  1378.             this._x = this._y = 0;
  1379.             this._alpha = 100;
  1380.             this._handleX = this._handleY = this._panjang = this._lebar = this._rotasi = 0;
  1381.             this._tilable = !1;
  1382.             this._frameW = this._frameH = 0;
  1383.             this._dragged = this._down = !1;
  1384.             this._frame = 0;
  1385.             this.load = !1;
  1386.             this._ctrIdx = 0;
  1387.             this.isAnim = !1;
  1388.             this.rect = new lL.Ktk;
  1389.             this._tipeDrag = this._dragStartY = this._dragStartX = this._sudutTekanAwal = this._sudutAwal = 0;
  1390.             let lN = document.createElement('img');
  1391.             let lO = document.createElement('canvas');
  1392.             let lP = lO.getContext('2d');
  1393.             let lQ;
  1394.             lQ = this;
  1395.             lL.Ip.register(this, lM, 0);
  1396.             lQ.img = lN;
  1397.             lQ.canvas = lO;
  1398.             lQ.rect = lL.Ktk.buat(0, 0, lN.naturalWidth, lN.naturalHeight);
  1399.             lQ.load = !1;
  1400.             !lQ.url && (lQ.load = !0);
  1401.             lN.onload = () => lS(lN);
  1402.             lN.onerror = () => {
  1403.                 console.warn(`gagal load image, url ${lM}`);
  1404.                 lT()
  1405.             };
  1406.             let lR = _.be.cache.getGbr(lM);
  1407.             if (lR) lS(lR);
  1408.             else lM && (lN.src = lM);
  1409.  
  1410.             function lS(lU) {
  1411.                 lO.width = lU.naturalWidth;
  1412.                 lO.height = lU.naturalHeight;
  1413.                 lP.drawImage(lU, 0, 0);
  1414.                 lQ.rect = lL.Ktk.buat(0, 0, lU.naturalWidth, lU.naturalHeight);
  1415.                 lQ.load = !0;
  1416.                 lQ.img = lU;
  1417.                 !lQ.width && (lQ.width = lU.naturalWidth);
  1418.                 !lQ.height && (lQ.height = lU.naturalHeight);
  1419.                 !lQ._frameH && (lQ.frameH = lU.naturalHeight);
  1420.                 !lQ._frameW && (lQ.frameW = lU.naturalWidth);
  1421.                 _.be.cache.setFile(lM, lU)
  1422.             }
  1423.  
  1424.             function lT() {}
  1425.         }
  1426.         get inputId() {
  1427.             return this._inputId
  1428.         }
  1429.         set inputId(lV) {
  1430.             this._inputId = lV
  1431.         }
  1432.         get frame() {
  1433.             return this._frame
  1434.         }
  1435.         set frame(lW) {
  1436.             this._frame = lW
  1437.         }
  1438.         get canvas() {
  1439.             return this._canvas
  1440.         }
  1441.         set canvas(lX) {
  1442.             this._canvas = lX
  1443.         }
  1444.         get tilable() {
  1445.             return this._tilable
  1446.         }
  1447.         set tilable(lY) {
  1448.             this._tilable = lY
  1449.         }
  1450.         get frameW() {
  1451.             return this._frameW
  1452.         }
  1453.         set frameW(lZ) {
  1454.             this._frameW = lZ
  1455.         }
  1456.         get frameH() {
  1457.             return this._frameH
  1458.         }
  1459.         set frameH(mA) {
  1460.             this._frameH = mA
  1461.         }
  1462.         get x() {
  1463.             return this._x
  1464.         }
  1465.         set x(mB) {
  1466.             this._x = mB
  1467.         }
  1468.         get y() {
  1469.             return this._y
  1470.         }
  1471.         set y(mC) {
  1472.             this._y = mC
  1473.         }
  1474.         get alpha() {
  1475.             return this._alpha
  1476.         }
  1477.         set alpha(mD) {
  1478.             this._alpha = mD
  1479.         }
  1480.         get handleY() {
  1481.             return this._handleY
  1482.         }
  1483.         set handleY(mE) {
  1484.             this._handleY = mE
  1485.         }
  1486.         get handleX() {
  1487.             return this._handleX
  1488.         }
  1489.         set handleX(mF) {
  1490.             this._handleX = mF
  1491.         }
  1492.         get width() {
  1493.             if (this._panjang) return this._panjang;
  1494.             if (this.img) return this.img.naturalWidth;
  1495.             return 0
  1496.         }
  1497.         set width(mG) {
  1498.             this._panjang = mG
  1499.         }
  1500.         get height() {
  1501.             if (this._lebar) return this._lebar;
  1502.             if (this.img) return this.img.naturalHeight;
  1503.             return 0
  1504.         }
  1505.         set height(mH) {
  1506.             this._lebar = mH
  1507.         }
  1508.         get ctrIdx() {
  1509.             return this._ctrIdx
  1510.         }
  1511.         set ctrIdx(mI) {
  1512.             this._ctrIdx = mI
  1513.         }
  1514.         get rotation() {
  1515.             return this._rotasi
  1516.         }
  1517.         set rotation(mJ) {
  1518.             this._rotasi = mJ
  1519.         }
  1520.         get dragStartX() {
  1521.             return this._dragStartX
  1522.         }
  1523.         set dragStartX(mK) {
  1524.             this._dragStartX = mK
  1525.         }
  1526.         get dragStartY() {
  1527.             return this._dragStartY
  1528.         }
  1529.         set dragStartY(mL) {
  1530.             this._dragStartY = mL
  1531.         }
  1532.         get dragged() {
  1533.             return this._dragged
  1534.         }
  1535.         set dragged(mM) {
  1536.             this._dragged = mM
  1537.         }
  1538.         get down() {
  1539.             return this._down
  1540.         }
  1541.         set down(mN) {
  1542.             this._down = mN
  1543.         }
  1544.         get dragType() {
  1545.             return this._tipeDrag
  1546.         }
  1547.         set dragType(mO) {
  1548.             this._tipeDrag = mO
  1549.         }
  1550.         get url() {
  1551.             return this._url
  1552.         }
  1553.         set url(mP) {
  1554.             this._url = mP
  1555.         }
  1556.         static get ctrDraw() {
  1557.             return Image._ctrDraw
  1558.         }
  1559.         static set ctrDraw(mQ) {
  1560.             Image._ctrDraw = mQ
  1561.         }
  1562.         get initialMouseAngle() {
  1563.             return this._sudutTekanAwal
  1564.         }
  1565.         set initialMouseAngle(mR) {
  1566.             this._sudutTekanAwal = mR
  1567.         }
  1568.         get initialAngle() {
  1569.             return this._sudutAwal
  1570.         }
  1571.         set initialAngle(mS) {
  1572.             this._sudutAwal = mS
  1573.         }
  1574.     }
  1575.     Image._ctrDraw = 0;
  1576.     lL.Image = Image
  1577. })(C || (C = {}));
Add Comment
Please, Sign In to add comment