import _ from "lodash";
import React from "react";
import { ConvertersContext } from "./../../../pm-converters/context.js";
import { ContentQueryProvider } from "./../../../ricos-content-query/index.js";
import { Link_Target } from "./../../../ricos-schema/legacy/wix/rich_content/v1/index.js";
import {
  action,
  createRicosComponentStory
} from "./../../../wix-rich-content-common/create-ricos-component-story.js";
import { LinkModal } from "./link-modal.js";
const converters = {
  fromPm: _.identity,
  fromPmNode: _.identity,
  fromPmNodeChildren: _.identity,
  marksToDecorations: _.identity,
  toPm: _.identity,
  toPmNode: _.identity,
  toPmNodeChildren: _.identity,
  decorationsToMarks: _.identity
};
const template = ({
  initialData,
  linkTypes: enabledLinkTypes
}) => (storyProps) => {
  const editor = {
    getPublicCommands: () => ({
      getBlockComponentData: () => {
      },
      setBlock: () => {
      },
      getSelection: () => ({ anchor: 0, focus: 0, selectedNodes: [] }),
      insertDecoration: action("insertDecoration"),
      getContentExtractor: () => {
      }
    }),
    // Provide RichContent instead of PmJson to be passed through identity converters:
    getJSON: () => ricosDocumentWithAllSectionNodes,
    adapter: {}
  };
  return createRicosComponentStory({
    component: /* @__PURE__ */ React.createElement(ConvertersContext.Provider, { value: converters }, /* @__PURE__ */ React.createElement(ContentQueryProvider, { editor }, /* @__PURE__ */ React.createElement(
      LinkModal,
      {
        initialValue: initialData,
        onClose: () => {
        },
        onSave: action("onSave"),
        onUnlink: action("onRemove"),
        onSaveMultiple: action("onSaveMultiple"),
        enabledLinkTypes
      }
    ))),
    mock: { editor },
    storyProps
  });
};
const LINK_INITIAL_DATA = {
  initialData: { url: "https://www.wix.com", anchor: void 0, target: Link_Target.BLANK }
};
const LinkLiveSite = template(LINK_INITIAL_DATA);
LinkLiveSite.args = {
  environment: "liveSite"
};
const LinkLiveSiteMobile = template(LINK_INITIAL_DATA);
LinkLiveSiteMobile.args = {
  environment: "liveSite",
  isMobile: true
};
const WebLinkOnlyLiveSite = template({ ...LINK_INITIAL_DATA, linkTypes: ["web-address"] });
WebLinkOnlyLiveSite.args = {
  environment: "liveSite"
};
const WebLinkOnlyLiveSiteMobile = template({
  ...LINK_INITIAL_DATA,
  linkTypes: ["web-address"]
});
WebLinkOnlyLiveSiteMobile.args = {
  environment: "liveSite",
  isMobile: true
};
const LinkBusinessManager = template(LINK_INITIAL_DATA);
LinkBusinessManager.args = {
  environment: "businessManager"
};
const LinkBusinessManagerMobile = template(LINK_INITIAL_DATA);
LinkBusinessManagerMobile.args = {
  environment: "businessManager",
  isMobile: true
};
const WebLinkOnlyBusinessManager = template({
  ...LINK_INITIAL_DATA,
  linkTypes: ["web-address"]
});
WebLinkOnlyBusinessManager.args = {
  environment: "businessManager"
};
const WebLinkOnlyBusinessManagerMobile = template({
  ...LINK_INITIAL_DATA,
  linkTypes: ["web-address"]
});
WebLinkOnlyBusinessManagerMobile.args = {
  environment: "businessManager",
  isMobile: true
};
const ANCHOR_INITIAL_DATA = {
  initialData: { url: void 0, anchor: "foo2", target: Link_Target.SELF }
};
const AnchorLiveSite = template(ANCHOR_INITIAL_DATA);
AnchorLiveSite.args = {
  environment: "liveSite"
};
const AnchorLiveSiteMobile = template(ANCHOR_INITIAL_DATA);
AnchorLiveSiteMobile.args = {
  environment: "liveSite",
  isMobile: true
};
const AnchorBusinessManager = template(ANCHOR_INITIAL_DATA);
AnchorBusinessManager.args = {
  environment: "businessManager"
};
const AnchorBusinessManagerMobile = template(ANCHOR_INITIAL_DATA);
AnchorBusinessManagerMobile.args = {
  environment: "businessManager",
  isMobile: true
};
var link_modal_stories_default = {
  name: "LinkModal/LinkModal"
};
const ricosDocumentWithAllSectionNodes = {
  nodes: [
    {
      type: "BLOCKQUOTE",
      id: "4klxp13",
      nodes: [
        {
          type: "PARAGRAPH",
          id: "201mv55",
          nodes: [
            {
              type: "TEXT",
              id: "",
              textData: {
                text: "Quote"
              }
            }
          ]
        }
      ],
      blockquoteData: {
        indentation: 0
      }
    },
    {
      type: "BUTTON",
      id: "6buln117",
      buttonData: {
        containerData: {
          width: {
            size: "ORIGINAL"
          },
          alignment: "CENTER",
          spoiler: {},
          height: {},
          textWrap: true
        },
        type: "LINK",
        styles: {},
        text: "Click Me",
        link: {
          url: "wix.com",
          target: "BLANK",
          rel: {
            nofollow: true,
            sponsored: false
          }
        }
      }
    },
    {
      type: "CODE_BLOCK",
      id: "k2tko126",
      nodes: [
        {
          type: "TEXT",
          id: "",
          textData: {
            text: "code block "
          }
        }
      ],
      codeBlockData: {}
    },
    {
      type: "FILE",
      id: "s1fix404",
      fileData: {
        src: {
          url: "https://static.wixstatic.com/media/feac6b9cf32640d3ac325c905f2b3786.jpg",
          private: false
        },
        name: "image.jpg",
        type: "jpg",
        size: 15e4,
        sizeInKb: "150"
      }
    },
    {
      type: "IMAGE",
      id: "a083l12246",
      imageData: {
        containerData: {
          width: {
            size: "CONTENT"
          },
          alignment: "CENTER",
          textWrap: true
        },
        image: {
          src: {
            id: "8bb438_0ac4a971c0384ec7827d055c12d2c6c6.jpg"
          },
          width: 5070,
          height: 3499
        },
        link: {
          url: "wix.com",
          target: "BLANK",
          rel: {
            noreferrer: true
          }
        }
      }
    },
    {
      type: "GALLERY",
      id: "hpah3475",
      galleryData: {
        items: [
          {
            image: {
              media: {
                src: {
                  url: "8bb438_c69ce4f9e2a2474586da85b85bfac20b.jpg"
                },
                width: 1920,
                height: 1280
              },
              link: {
                url: "wix.com",
                target: "BLANK",
                rel: {
                  noreferrer: true
                }
              }
            }
          },
          {
            image: {
              media: {
                src: {
                  url: "8bb438_a2049532d1b7487ba542f55efbc55c7c.jpg"
                },
                width: 4500,
                height: 3e3
              }
            }
          },
          {
            image: {
              media: {
                src: {
                  url: "8bb438_f8233d1de49442169c3bd47e3dce2780.jpg"
                },
                width: 5600,
                height: 3737
              }
            }
          }
        ],
        options: {
          layout: {
            type: "GRID",
            horizontalScroll: false,
            orientation: "COLUMNS",
            numberOfColumns: 3
          },
          item: {
            ratio: 1,
            crop: "FILL"
          },
          thumbnails: {
            placement: "NONE"
          }
        }
      }
    },
    {
      type: "HEADING",
      id: "shdvu621",
      nodes: [
        {
          type: "TEXT",
          id: "",
          textData: {
            text: "Heading 1 "
          }
        }
      ],
      headingData: {
        level: 1
      }
    },
    {
      type: "HEADING",
      id: "f5ps2873",
      nodes: [
        {
          type: "TEXT",
          id: "",
          textData: {
            text: "Heading 2  "
          }
        }
      ],
      headingData: {
        level: 2
      }
    },
    {
      type: "HEADING",
      id: "9yqwc1280",
      nodes: [
        {
          type: "TEXT",
          id: "",
          textData: {
            text: "Heading 3 "
          }
        }
      ],
      headingData: {
        level: 3
      }
    },
    {
      type: "HEADING",
      id: "o0a3u524",
      nodes: [
        {
          type: "TEXT",
          id: "",
          textData: {
            text: "heading 4 "
          }
        }
      ],
      headingData: {
        level: 4
      }
    },
    {
      type: "HEADING",
      id: "gv4r31970",
      nodes: [
        {
          type: "TEXT",
          id: "",
          textData: {
            text: "heading 5"
          }
        }
      ],
      headingData: {
        level: 5
      }
    },
    {
      type: "HEADING",
      id: "3zry49601",
      nodes: [
        {
          type: "TEXT",
          id: "",
          textData: {
            text: "heading 6"
          }
        }
      ],
      headingData: {
        level: 6
      }
    },
    {
      type: "PARAGRAPH",
      id: "bb5u24830",
      nodes: [
        {
          type: "TEXT",
          id: "",
          textData: {
            text: "paragraph"
          }
        }
      ]
    },
    {
      type: "VIDEO",
      id: "4c6wp4828",
      videoData: {
        containerData: {
          width: {
            size: "CONTENT"
          },
          alignment: "CENTER",
          textWrap: true
        },
        video: {
          src: {
            id: "video/11062b_a552731f40854d16a91627687fb8d1a6/1080p/mp4/file.mp4"
          },
          duration: 14.08
        },
        thumbnail: {
          src: {
            id: "media/11062b_a552731f40854d16a91627687fb8d1a6f000.jpg"
          },
          width: 1920,
          height: 1080
        }
      }
    },
    {
      type: "GIF",
      id: "3pand2049",
      gifData: {
        containerData: {
          width: {
            size: "CONTENT"
          },
          alignment: "CENTER",
          textWrap: true
        },
        original: {
          gif: "https://media0.giphy.com/media/v1.Y2lkPTQ2NzJjZTUyenI2azdxaTB0ZXFramx6cjdveWNnZjgyZmFidmI5Z3JsdXYyZ3JiciZlcD12MV9naWZzX3RyZW5kaW5nJmN0PWc/s2qXK8wAvkHTO/giphy.gif",
          mp4: "https://media0.giphy.com/media/v1.Y2lkPTQ2NzJjZTUyenI2azdxaTB0ZXFramx6cjdveWNnZjgyZmFidmI5Z3JsdXYyZ3JiciZlcD12MV9naWZzX3RyZW5kaW5nJmN0PWc/s2qXK8wAvkHTO/giphy.mp4",
          still: "https://media0.giphy.com/media/v1.Y2lkPTQ2NzJjZTUyenI2azdxaTB0ZXFramx6cjdveWNnZjgyZmFidmI5Z3JsdXYyZ3JiciZlcD12MV9naWZzX3RyZW5kaW5nJmN0PWc/s2qXK8wAvkHTO/giphy_s.gif"
        },
        downsized: {
          gif: "https://media0.giphy.com/media/v1.Y2lkPTQ2NzJjZTUyenI2azdxaTB0ZXFramx6cjdveWNnZjgyZmFidmI5Z3JsdXYyZ3JiciZlcD12MV9naWZzX3RyZW5kaW5nJmN0PWc/s2qXK8wAvkHTO/giphy.gif",
          mp4: "https://media0.giphy.com/media/v1.Y2lkPTQ2NzJjZTUyenI2azdxaTB0ZXFramx6cjdveWNnZjgyZmFidmI5Z3JsdXYyZ3JiciZlcD12MV9naWZzX3RyZW5kaW5nJmN0PWc/s2qXK8wAvkHTO/giphy-downsized-small.mp4",
          still: "https://media0.giphy.com/media/v1.Y2lkPTQ2NzJjZTUyenI2azdxaTB0ZXFramx6cjdveWNnZjgyZmFidmI5Z3JsdXYyZ3JiciZlcD12MV9naWZzX3RyZW5kaW5nJmN0PWc/s2qXK8wAvkHTO/giphy_s.gif"
        },
        height: 166,
        width: 252,
        gifType: "NORMAL"
      }
    },
    {
      type: "PARAGRAPH",
      id: "iiojt2052"
    },
    {
      type: "PARAGRAPH",
      id: "93dea3645"
    },
    {
      type: "PARAGRAPH",
      id: "u1ysa119"
    },
    {
      type: "PARAGRAPH",
      id: "99yg6193"
    }
  ]
};
export {
  AnchorBusinessManager,
  AnchorBusinessManagerMobile,
  AnchorLiveSite,
  AnchorLiveSiteMobile,
  LinkBusinessManager,
  LinkBusinessManagerMobile,
  LinkLiveSite,
  LinkLiveSiteMobile,
  WebLinkOnlyBusinessManager,
  WebLinkOnlyBusinessManagerMobile,
  WebLinkOnlyLiveSite,
  WebLinkOnlyLiveSiteMobile,
  link_modal_stories_default as default
};
//# sourceMappingURL=link-modal.stories.js.map
