{"version":3,"sources":["jsdelivr-header.js","/npm/react-godot-new@1.0.1/dist/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,MCHO,yBACK,UAAW,eACd,UAAW,OAAQ,aAAgB,eACrC,iBAAkB,wBAClB,gBAAiB,gBACxB,IAAI,UAAY,SAAU,EAAK,GAC3B,WAAU,WACN,IAAI,EAAS,SAAS,cAAc,UAKpC,OAJA,EAAO,IAAM,EACb,EAAO,OAAQ,EACf,EAAO,OAAS,EAChB,SAAS,KAAK,YAAY,GACnB,WACH,SAAS,KAAK,YAAY,EAC9B,CACJ,GAAG,CAAC,GACR,EACI,WAAa,SAAU,GACvB,IAAI,EAAS,EAAM,OAAQ,EAAM,EAAM,IAAK,EAAK,EAAM,OAAQ,OAAgB,IAAP,GAAwB,EAAI,EAAQ,EAAM,MAAO,EAAS,EAAM,OAAQ,EAAS,EAAM,OAC3J,EAAW,OAAO,MAClB,EAAK,SAAS,MAAO,EAAS,EAAG,GAAI,EAAY,EAAG,GACpD,EAAK,SAAS,CAAC,EAAO,IAAU,EAAa,EAAG,GAAI,EAAgB,EAAG,GAa3E,OAZA,UAAU,GAAQ,WACd,IAAI,EAAQ,OACZ,GAAU,WAAc,OAAO,EAAM,MAAQ,GACjD,IACA,WAAU,WACF,GAAU,EAAS,SACnB,EAAc,CACV,EAAS,QAAQ,YACjB,EAAS,QAAQ,cAG7B,GAAG,CAAC,EAAQ,EAAS,UACb,MAAM,cAAc,MAAO,CAAE,GAAI,OAAQ,IAAK,GAClD,MAAM,cAAc,aAAc,KAAM,GAAW,MAAM,cAAc,YAAa,CAAE,IAAK,EAAK,OAAQ,EAAQ,MAAO,EAAW,GAAI,OAAQ,EAAW,GAAI,OAAQ,KAC7K,iBACe","file":"/npm/react-godot-new@1.0.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-godot-new@1.0.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\r\n * @function ReactGodot\r\n */\r\nimport \"./styles.css\";\r\nimport * as React from \"react\";\r\nimport { useEffect, useRef, useState } from \"react\";\r\nimport AsyncLoading from \"./AsyncLoading\";\r\nimport ReactCanvas from \"./ReactCanvas\";\r\nvar useScript = function (url, onLoad) {\r\n    useEffect(function () {\r\n        var script = document.createElement(\"script\");\r\n        script.src = url;\r\n        script.async = true;\r\n        script.onload = onLoad;\r\n        document.body.appendChild(script);\r\n        return function () {\r\n            document.body.removeChild(script);\r\n        };\r\n    }, [url]);\r\n};\r\nvar ReactGodot = function (props) {\r\n    var script = props.script, pck = props.pck, _a = props.resize, resize = _a === void 0 ? false : _a, width = props.width, height = props.height, params = props.params;\r\n    var outerRef = useRef(null);\r\n    var _b = useState(null), engine = _b[0], setEngine = _b[1];\r\n    var _c = useState([width, height]), dimensions = _c[0], setDimensions = _c[1];\r\n    useScript(script, function () {\r\n        var scope = window;\r\n        setEngine(function () { return scope.Engine; });\r\n    });\r\n    useEffect(function () {\r\n        if (resize && outerRef.current) {\r\n            setDimensions([\r\n                outerRef.current.clientWidth,\r\n                outerRef.current.clientHeight\r\n            ]);\r\n        }\r\n    }, [resize, outerRef.current]);\r\n    return (React.createElement(\"div\", { id: \"wrap\", ref: outerRef },\r\n        React.createElement(AsyncLoading, null, engine && (React.createElement(ReactCanvas, { pck: pck, engine: engine, width: dimensions[0], height: dimensions[1], params: params })))));\r\n};\r\nexport default ReactGodot;\r\n"]}