import {Input as $d8e7992b5f7739ce$export$f5b8910cec6cf069} from "./Input.js";
import {filterDOMProps as $8VH1F$filterDOMProps} from "react-aria/private/utils/filterDOMProps";
import {getEventTarget as $8VH1F$getEventTarget} from "react-aria/private/utils/shadowdom/DOMFunctions";
import {PressResponder as $8VH1F$PressResponder} from "react-aria/private/interactions/PressResponder";
import $8VH1F$react, {forwardRef as $8VH1F$forwardRef} from "react";
import {useObjectRef as $8VH1F$useObjectRef} from "react-aria/useObjectRef";

/*
 * Copyright 2023 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */ 





const $bc459eb335d0c829$export$6fb4a10d2c950550 = /*#__PURE__*/ (0, $8VH1F$forwardRef)(function FileTrigger(props, ref) {
    let { onSelect: onSelect, acceptedFileTypes: acceptedFileTypes, allowsMultiple: allowsMultiple, defaultCamera: defaultCamera, children: children, acceptDirectory: acceptDirectory, ...rest } = props;
    let inputRef = (0, $8VH1F$useObjectRef)(ref);
    let domProps = (0, $8VH1F$filterDOMProps)(rest, {
        global: true
    });
    return /*#__PURE__*/ (0, $8VH1F$react).createElement((0, $8VH1F$react).Fragment, null, /*#__PURE__*/ (0, $8VH1F$react).createElement((0, $8VH1F$PressResponder), {
        onPress: ()=>{
            var _inputRef_current, _inputRef_current1;
            if ((_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.value) inputRef.current.value = '';
            (_inputRef_current1 = inputRef.current) === null || _inputRef_current1 === void 0 ? void 0 : _inputRef_current1.click();
        }
    }, children), /*#__PURE__*/ (0, $8VH1F$react).createElement((0, $d8e7992b5f7739ce$export$f5b8910cec6cf069), {
        ...domProps,
        className: "",
        type: "file",
        ref: inputRef,
        style: {
            display: 'none'
        },
        accept: acceptedFileTypes === null || acceptedFileTypes === void 0 ? void 0 : acceptedFileTypes.toString(),
        onChange: (e)=>onSelect === null || onSelect === void 0 ? void 0 : onSelect((0, $8VH1F$getEventTarget)(e).files),
        capture: defaultCamera,
        multiple: allowsMultiple,
        // @ts-expect-error
        webkitdirectory: acceptDirectory ? '' : undefined
    }));
});


export {$bc459eb335d0c829$export$6fb4a10d2c950550 as FileTrigger};
//# sourceMappingURL=FileTrigger.js.map
