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,EAAK,SAAS,EAAI,MAAM,EAAK,SAAS,EAAI,OAC5F,CA1BA,KAAK,OAAO,iBAAiB,eAG7B,SAAuB,GACnB,EAAG,iBAEH,EAAK,SAAS,MAAQ,EAAK,SAAS,EACpC,EAAK,SAAS,MAAQ,EAAK,SAAS,EAEpC,EAAK,SAAS,MAAQ,EAAG,QACzB,EAAK,SAAS,MAAQ,EAAG,QAEzB,SAAS,iBAAiB,cAAe,EAC7C,IAZA,KAAK,OAAO,iBAAiB,aA2B7B,SAAqB,GACjB,SAAS,oBAAoB,cAAe,EAChD,GACJ,CAEA,WAAA,GACI,KAAK,QAAU,KAAK,OAEhB,KAAK,QACL,KAAK,oBAAsB,KAAK,QAAQ,UACxC,KAAK,QAAQ,SAAS,EAAE,IAExB,KAAK,QAAQ,SAAS,EAAE,KAAK,qBAGjC,KAAK,QAAQ,UAAU,OAAO,mBAClC,CAEA,IAAA,GACI,KAAK,QAAQ,QACjB,CAEA,UAAA,CAAY,EAAG,EAAI,EAAI,EAAI,GACvB,OAAO,GAAO,EAAI,IAAS,EAAK,IAAS,EAAK,EAClD,CAEA,cAAA,CAAe,GAEX,MAAM,EAAS,EAAI,WAGb,EAAe,EAAO,QAAQ,KAGpC,IAAsB,IAAlB,EACF,OAAO,EAMT,OAFsB,EAAO,OAAS,EAAe,CAGzD,CAEA,qBAAO,CAAe,GAClB,IAAK,IAAI,KAAK,EACV,IAAI,UAAU,GAAK,EAAO,EAElC","file":"/npm/perfect-gui@4.12.6/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/perfect-gui@4.12.6/src/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","import Button from './components/Button.js';\nimport Slider from './components/Slider.js';\nimport Image from './components/Image.js';\nimport Toggle from './components/Toggle.js';\nimport List from './components/List.js';\nimport Color from './components/Color.js';\nimport Vector2 from './components/Vector2.js';\nimport styles from './styles/styles.js';\n\nexport default class GUI {\n    constructor(options = {}) {\n        this.firstParent = this;\n\n        if ( options.container ) {\n            this.container = typeof options.container == \"string\" ? document.querySelector(options.container) : options.container;\n            this.position_type = 'absolute';\n        } else {\n            this.container = document.body;\n            this.position_type = 'fixed';\n        }\n\n        this.propReferences = [];\n        this.folders = [];\n\n        if ( options.isFolder ) {\n            this._folderConstructor(options.folderOptions);\n            return;\n        }\n\n        if ( typeof options.onUpdate == 'function' ) {\n            this.onUpdate = options.onUpdate;\n        }\n\n        this.label = (options != undefined && typeof options.label == \"string\") ? options.label : ''; \n        this.backgroundColor = options.color || null; \n        this.opacity = options.opacity || 1;\n\n        if (this.container == document.body) {\n            this.maxHeight = window.innerHeight;\n        } else {\n            this.maxHeight = Math.min(this.container.clientHeight, window.innerHeight)\n        }\n        if ( options.maxHeight ) {\n            this.initMaxHeight = options.maxHeight;\n            this.maxHeight = Math.min(this.initMaxHeight, this.maxHeight);\n        }\n\n        this.screenCorner = this._parseScreenCorner(options.position);\n\n        if (!window.perfectGUI) {\n            window.perfectGUI = {};\n        } \n        if ( window.perfectGUI.instanceCounter == undefined ) {\n            window.perfectGUI.instanceCounter = 0;\n        } else {\n            window.perfectGUI.instanceCounter++;\n        }\n        this.instanceId = window.perfectGUI.instanceCounter;\n        \n        this.wrapperWidth = options.width || 290;\n        this.stylesheet = document.createElement('style');\n        this.stylesheet.setAttribute('type', 'text/css');\n        this.stylesheet.setAttribute('id', 'lm-gui-stylesheet');\n        document.head.append(this.stylesheet);\n        \n        // Common styles\n        if (this.instanceId == 0) {\n            this._addStyles(`${styles(this.position_type)}`);\n        }        \n\n        // Instance specific styles\n        this._styleInstance();        \n                \n        this._addWrapper();\n        this.wrapper.setAttribute('data-corner-x', this.screenCorner.x);\n        this.wrapper.setAttribute('data-corner-y', this.screenCorner.y);\n\n        if (options.autoRepositioning != false) {\n            window.addEventListener('resize', this._handleResize.bind(this));\n        }\n        this._handleResize();\n    \n        this.hasBeenDragged = false;\n        if (options.draggable == true) this._makeDraggable();\n\n        this.closed = false;\n        if (options.closed) this.toggleClose();\n    }\n    \n    _styleInstance() {\n        let scrollbar_width = this._getScrollbarWidth(this.container);\n        if (this.screenCorner.x == 'left') {\n            this.xOffset = 0;\n        } else {\n            this.xOffset = this.container.clientWidth - this.wrapperWidth - scrollbar_width;\n        }\n\n        if (this.instanceId > 0) {\n            let existingDomInstances = this.container.querySelectorAll('.p-gui');\n            for (let i = 0; i < existingDomInstances.length; i++) {\n                if (this.screenCorner.y == existingDomInstances[i].dataset.cornerY) {\n                    if (this.screenCorner.x == 'left' && existingDomInstances[i].dataset.cornerX == 'left') {\n                        this.xOffset += existingDomInstances[i].offsetWidth;\n                    } \n                    else if (this.screenCorner.x == 'right' && existingDomInstances[i].dataset.cornerX == 'right') {\n                        this.xOffset -= existingDomInstances[i].offsetWidth;\n                    }\n                }\n            }\n        }\n        this.yOffset = 0;\n        this.position = {\n            prevX: this.xOffset, \n            prevY: this.yOffset, \n            x: this.xOffset, \n            y: this.yOffset\n        };\n\n        this._addStyles(`#p-gui-${this.instanceId} {\n            width: ${this.wrapperWidth}px;\n            max-height: ${this.maxHeight}px;\n            transform: translate3d(${this.xOffset}px,${this.yOffset}px,0);\n            ${ this.screenCorner.y == 'top' ? '' : 'top: auto; bottom: 0;' }\n            ${ this.backgroundColor ? 'background: ' + this.backgroundColor + ';' : '' }\n            opacity: ${this.opacity};\n        }`);\n    }\n\n    _folderConstructor(folderOptions) {\n        this.wrapper = folderOptions.wrapper;\n        this.isFolder = true;\n        this.parent = folderOptions.parent;\n        this.firstParent = folderOptions.firstParent;\n    }\n\n    _parseScreenCorner(position) {\n        let parsedPosition = {x: 'right', y: 'top'};\n\n        if (position == undefined) return parsedPosition;\n        else if (typeof position != 'string') console.error('[perfect-gui] Position must be a string.');\n\n        if (position.includes('left')) parsedPosition.x = 'left';\n        if (position.includes('bottom')) parsedPosition.y = 'bottom';\n\n        return parsedPosition;\n    }\n\n    _getScrollbarWidth(element) {\n        if (element === document.body) {\n            return window.innerWidth - document.documentElement.clientWidth;\n        } else {\n            return element.offsetWidth - element.clientWidth;\n        }\n    }\n\n    _handleResize() {\n        if (this.container == document.body) {\n            this.maxHeight = window.innerHeight;\n        } else {\n            this.maxHeight = Math.min(this.container.clientHeight, window.innerHeight)\n        }\n        if (this.initMaxHeight) {\n            this.maxHeight = Math.min(this.initMaxHeight, this.maxHeight);\n        }\n        this.wrapper.style.maxHeight = this.maxHeight + 'px';\n\n        if (this.hasBeenDragged) {\n            return;\n        }\n\n        let scrollbar_width = this._getScrollbarWidth(this.container);\n        this.xOffset = this.screenCorner.x == 'left' ? 0 : this.container.clientWidth - this.wrapperWidth - scrollbar_width;\n        if (this.instanceId > 0) {\n            let existingDomInstances = this.container.querySelectorAll(`.p-gui:not(#${this.wrapper.id}):not([data-dragged])`);\n            for (let i = 0; i < existingDomInstances.length; i++) {\n                let instanceId = parseInt(existingDomInstances[i].id.replace('p-gui-', ''));\n                if (instanceId > this.instanceId) break;\n                if (this.screenCorner.y == existingDomInstances[i].dataset.cornerY) {\n                    if (this.screenCorner.x == 'left' && existingDomInstances[i].dataset.cornerX == 'left') {\n                        this.xOffset += existingDomInstances[i].offsetWidth;\n                    } \n                    else if (this.screenCorner.x == 'right' && existingDomInstances[i].dataset.cornerX == 'right') {\n                        this.xOffset -= existingDomInstances[i].offsetWidth;\n                    }\n                }\n            }\n        }\n        this.position = {prevX:this.xOffset, prevY:this.yOffset, x:this.xOffset, y:this.yOffset};\n        this.wrapper.style.transform = `translate3d(${this.position.x}px, ${this.position.y}px, 0)`;\n    }\n    \n    _addStyles(styles) {\n        this.stylesheet.innerHTML += styles;\n    }\n    \n    _addWrapper() {\n        this.wrapper = document.createElement('div');\n        this.wrapper.id = 'p-gui-'+this.instanceId;\n        this.wrapper.className = 'p-gui';\n        this.wrapper.setAttribute('data-lenis-prevent', '');\n        this.container.append(this.wrapper);      \n    \n        this.header = document.createElement('div');\n        this.header.className = 'p-gui__header';\n        this.header.textContent = this.label;\n        this.header.style = `${ this.backgroundColor ? 'border-color: ' + this.backgroundColor + ';' : ''}`;\n        this.wrapper.append(this.header);\n    \n        const close_btn = document.createElement('div');\n        close_btn.className = 'p-gui__header-close';\n        close_btn.addEventListener('click', this.toggleClose.bind(this));\n        this.header.append(close_btn);\n    }\n\n    button(params = {}, callback) {\n        this.imageContainer = null;\n        const el = new Button(this, params, callback);\n        return el;\n    }\n    \n    image(params = {}, callback) {\n        if (!this.imageContainer) {\n            this.imageContainer = document.createElement('div');\n            this.imageContainer.className = 'p-gui__image-container';\n            this.wrapper.append(this.imageContainer);\n        }\n        const el = new Image(this, params, callback);\n        return el;\n    }\n\n    slider(params = {}, callback) {\n        this.imageContainer = null;\n        const el = new Slider(this, params, callback);\n        return el;\n    }\n\n    toggle(params = {}, callback) {\n        this.imageContainer = null;\n        const el = new Toggle(this, params, callback);\n        this.wrapper.append(el);\n        return el;\n    }\n\n    list(params = {}, callback) {  \n        this.imageContainer = null;\n        const el = new List(this, params, callback);\n        return el;\n    }\n\n    color(params = {}, callback) {\n        this.imageContainer = null;\n        const el = new Color(this, params, callback);\n        return el;\n    }\n\n    vector2(params = {}, callback) {\n        this.imageContainer = null;\n        const el = new Vector2(this, params, callback);\n        return el;\n    }\n\n    folder(options = {}) {\n        let closed = typeof options.closed == 'boolean' ? options.closed : false;\n        let label = options.label || '';\n        let color = options.color || null;\n        let maxHeight = options.maxHeight || null;\n\n        this.imageContainer = null;\n\n        let className = 'p-gui__folder';\n        \n        if (this.folders.length == 0) {\n            className += ' p-gui__folder--first';\n        }\n\n        if (closed) {\n            className += ' p-gui__folder--closed';\n        }\n\n        let container_style = color ? `background-color: ${color};` : '';\n        container_style += maxHeight ? `max-height: ${maxHeight}px;` : '';\n\n        const container = document.createElement('div');\n        container.className = className;\n        container.style = container_style;\n        this.wrapper.append(container);\n        \n        const folderHeader = document.createElement('div');\n        folderHeader.innerHTML = `<span class=\"p-gui__folder-arrow\"></span>${label}`;\n        folderHeader.className = 'p-gui__folder-header';\n        container.append(folderHeader);\n        folderHeader.addEventListener('click', () => {\n            container.classList.toggle('p-gui__folder--closed');\n        });\n\n        let folder = new GUI({isFolder: true, folderOptions: {\n            wrapper: container,\n            parent: this,\n            firstParent: this.firstParent\n        }});\n        this.folders.push(folder);\n        return folder;\n    }\n    \n    _makeDraggable() {\n        var that = this;\n        this.header.addEventListener('pointerdown', dragMouseDown);\n        this.header.addEventListener('pointerup', dragMouseUp);\n    \n        function dragMouseDown(ev) {             \n            ev.preventDefault();\n            \n            that.position.initX = that.position.x;\n            that.position.initY = that.position.y;  \n\n            that.position.prevX = ev.clientX;\n            that.position.prevY = ev.clientY;  \n\n            document.addEventListener('pointermove', dragElement);\n        }\n    \n        function dragElement(ev) {\n            ev.preventDefault();\n            if (!that.hasBeenDragged) {\n                that.hasBeenDragged = true;\n                that.wrapper.setAttribute('data-dragged', 'true')\n            }\n    \n            that.position.x = that.position.initX + ev.clientX - that.position.prevX;\n            that.position.y = that.position.initY + ev.clientY - that.position.prevY;\n    \n            that.wrapper.style.transform = \"translate3d(\"+that.position.x + \"px,\"+that.position.y + \"px,0)\";\n        }\n\n        function dragMouseUp(ev) {\n            document.removeEventListener('pointermove', dragElement);\n        }\n    }\n\n    toggleClose() {\n        this.closed = !this.closed;\n        \n        if (this.closed) {\n            this.previousInnerScroll = this.wrapper.scrollTop;\n            this.wrapper.scrollTo(0,0);\n        } else {\n            this.wrapper.scrollTo(0,this.previousInnerScroll);\n        }\n        \n        this.wrapper.classList.toggle('p-gui--collapsed');\n    }\n\n    kill() {\n        this.wrapper.remove();\n    }\n\n    _mapLinear( x, a1, a2, b1, b2 ) {\n        return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\n    }\n\n    _countDecimals(num) {\n        // Convert the number to a string\n        const numStr = num.toString();\n        \n        // Find the position of the decimal point\n        const decimalIndex = numStr.indexOf('.');\n        \n        // If there is no decimal point, return 0\n        if (decimalIndex === -1) {\n          return 0;\n        }\n        \n        // Calculate the number of digits after the decimal point\n        const decimalPlaces = numStr.length - decimalIndex - 1;\n        \n        return decimalPlaces;\n    }\n\n    static registerPlugin(plugin) {\n        for (let i in plugin) {\n            GUI.prototype[i] = plugin[i];\n        }\n    }\n}"]}