'use client';
import { createContext, use } from 'react';
/**
   * The URL that has finished loading in the iframe or popup.
   * For example, if you set the `url`, it will begin to load into the iframe,
   * but `loadedURL` will not be set until the iframe's `onLoad` event fires.
   */ /**
   * Sets the URL of the preview (either iframe or popup).
   * Will trigger a reload of the window.
   */ /**
   * The live preview url property can be either a string or a function that returns a string.
   * It is important to know which one it is, so that we can opt in/out of certain behaviors, e.g. calling the server to get the URL.
   */ export const LivePreviewContext = createContext({
    appIsReady: false,
    breakpoint: undefined,
    breakpoints: undefined,
    iframeRef: undefined,
    isLivePreviewEnabled: undefined,
    isLivePreviewing: false,
    isPopupOpen: false,
    isPreviewEnabled: undefined,
    measuredDeviceSize: {
        height: 0,
        width: 0
    },
    openPopupWindow: ()=>{},
    popupRef: undefined,
    previewURL: undefined,
    previewWindowType: 'iframe',
    setAppIsReady: ()=>{},
    setBreakpoint: ()=>{},
    setHeight: ()=>{},
    setIsLivePreviewing: ()=>{},
    setLoadedURL: ()=>{},
    setMeasuredDeviceSize: ()=>{},
    setPreviewURL: ()=>{},
    setPreviewWindowType: ()=>{},
    setSize: ()=>{},
    setToolbarPosition: ()=>{},
    setURL: ()=>{},
    setWidth: ()=>{},
    setZoom: ()=>{},
    size: {
        height: 0,
        width: 0
    },
    toolbarPosition: {
        x: 0,
        y: 0
    },
    typeofLivePreviewURL: undefined,
    url: undefined,
    zoom: 1
});
export const useLivePreviewContext = ()=>use(LivePreviewContext);
/**
 * Hook to access live preview context values. Separated to prevent breaking changes. In the future this hook can be removed in favour of just using the LivePreview one.
 */ export const usePreviewURL = ()=>{
    const { isPreviewEnabled, previewURL, setPreviewURL } = use(LivePreviewContext);
    return {
        isPreviewEnabled,
        previewURL,
        setPreviewURL
    };
};

//# sourceMappingURL=context.js.map