{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "instagram-post-mockup",
  "title": "Instagram Post Mockup",
  "description": "A realistic Instagram post, avatar ring, swipeable multi-photo carousel, double-tap-to-like heart burst, like/comment/repost/share/save actions, and light/dark theme.",
  "dependencies": [
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/instagram-post-mockup/instagram-post-mockup.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type InstagramPostMockupTheme = \"light\" | \"dark\";\n\nexport interface InstagramPostMockupProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  theme?: InstagramPostMockupTheme;\n  borderRadius?: number;\n  username?: string;\n  userAvatar?: string;\n  showVerified?: boolean;\n  location?: string;\n  showLocation?: boolean;\n  postDescription?: string;\n  timePosted?: string;\n  media?: string[];\n  maxMedia?: number;\n  likesCount?: number;\n  showLikes?: boolean;\n  likedByUsername?: string;\n  showLikedBy?: boolean;\n  showLikeCount?: boolean;\n  commentsCount?: number;\n  showComments?: boolean;\n  showCounter?: boolean;\n  allowLike?: boolean;\n  doubleTapLike?: boolean;\n  allowBookmark?: boolean;\n  showCommentIcon?: boolean;\n  showRepost?: boolean;\n  showShare?: boolean;\n}\n\nfunction fmt(n: number): string {\n  if (n >= 1_000_000) return (n / 1_000_000).toFixed(1).replace(\".0\", \"\") + \"M\";\n  if (n >= 1_000) return (n / 1_000).toFixed(1).replace(\".0\", \"\") + \"K\";\n  return n.toLocaleString();\n}\n\nconst HEART_BURST_CSS = `@keyframes ig-heart-burst {\n  0% { transform: scale(0); opacity: 0; }\n  15% { transform: scale(1.2); opacity: 1; }\n  35% { transform: scale(0.95); opacity: 1; }\n  80% { transform: scale(1); opacity: 1; }\n  100% { transform: scale(1); opacity: 0; }\n}`;\n\nconst IgHeart = ({ filled, size = 26, dark = false }: { filled: boolean; size?: number; dark?: boolean }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill={filled ? \"#ed4956\" : \"none\"} stroke={filled ? \"#ed4956\" : dark ? \"#fff\" : \"#262626\"} strokeWidth=\"2\" strokeLinejoin=\"round\">\n    <path d=\"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z\" />\n  </svg>\n);\nconst IgComment = ({ size = 26, dark = false }: { size?: number; dark?: boolean }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={dark ? \"#fff\" : \"#262626\"} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n    <path d=\"M20.656 17.008a9.993 9.993 0 1 0-3.59 3.615L22 22Z\" />\n  </svg>\n);\nconst IgRepost = ({ size = 26, dark = false }: { size?: number; dark?: boolean }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={dark ? \"#fff\" : \"#262626\"} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n    <path d=\"M17 1l4 4-4 4\" />\n    <path d=\"M3 11V9a4 4 0 0 1 4-4h14\" />\n    <path d=\"M7 23l-4-4 4-4\" />\n    <path d=\"M21 13v2a4 4 0 0 1-4 4H3\" />\n  </svg>\n);\nconst IgSend = ({ size = 26, dark = false }: { size?: number; dark?: boolean }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={dark ? \"#fff\" : \"#262626\"} strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n    <path d=\"M4.36 8.175 L19.64 2.825 Q22 2 21.175 4.36 L15.825 19.64 Q15 22 13.985 19.715 L12.015 15.285 Q11 13 8.715 11.985 L4.285 10.015 Q2 9 4.36 8.175 Z\" />\n    <line x1=\"22\" y1=\"2\" x2=\"11\" y2=\"13\" />\n  </svg>\n);\nconst IgBookmark = ({ filled, size = 26, dark = false }: { filled: boolean; size?: number; dark?: boolean }) => (\n  <svg width={size} height={size} viewBox=\"0 0 24 24\" fill={filled ? (dark ? \"#fff\" : \"#262626\") : \"none\"} stroke={dark ? \"#fff\" : \"#262626\"} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n    <path d=\"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z\" />\n  </svg>\n);\nconst IgDots = ({ dark = false }: { dark?: boolean }) => (\n  <svg width={20} height={20} viewBox=\"0 0 24 24\" fill={dark ? \"#fff\" : \"#262626\"}>\n    <circle cx=\"5\" cy=\"12\" r=\"1.8\" />\n    <circle cx=\"12\" cy=\"12\" r=\"1.8\" />\n    <circle cx=\"19\" cy=\"12\" r=\"1.8\" />\n  </svg>\n);\nconst IgVerified = () => (\n  <svg width={14} height={14} viewBox=\"0 0 24 24\" fill=\"#0095f6\">\n    <path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\" />\n  </svg>\n);\n\nexport function InstagramPostMockup({\n  theme = \"light\",\n  borderRadius = 12,\n  username = \"rensato\",\n  userAvatar,\n  showVerified = false,\n  location = \"Tokyo, Japan\",\n  showLocation = true,\n  postDescription = \"dream architecture\",\n  timePosted = \"September 19\",\n  media = [],\n  maxMedia = 8,\n  likesCount = 44686,\n  showLikes = true,\n  likedByUsername = \"kaitowatanabe\",\n  showLikedBy = true,\n  showLikeCount = true,\n  commentsCount = 9,\n  showComments = true,\n  showCounter = true,\n  allowLike = true,\n  doubleTapLike = true,\n  allowBookmark = true,\n  showCommentIcon = true,\n  showRepost = true,\n  showShare = true,\n  className,\n  ...props\n}: InstagramPostMockupProps) {\n  const [liked, setLiked] = React.useState(false);\n  const [bookmarked, setBookmarked] = React.useState(false);\n  const [idx, setIdx] = React.useState(0);\n  const [dragOffset, setDragOffset] = React.useState(0);\n  const [dragging, setDragging] = React.useState(false);\n  const [burst, setBurst] = React.useState(false);\n  const dragStartX = React.useRef<number | null>(null);\n  const mediaRef = React.useRef<HTMLDivElement>(null);\n  const burstTimer = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n  const dark = theme === \"dark\";\n  const bg = dark ? \"#000\" : \"#fff\";\n  const text = dark ? \"#fff\" : \"#262626\";\n  const sub = dark ? \"#a8a8a8\" : \"#737373\";\n  const border = dark ? \"#262626\" : \"#dbdbdb\";\n\n  const items = media.slice(0, maxMedia);\n  const total = items.length;\n  const multi = total > 1;\n  const likes = liked ? likesCount + 1 : likesCount;\n\n  const onDragStart = (e: React.PointerEvent) => {\n    if (!multi) return;\n    if ((e.target as HTMLElement)?.closest?.(\"button, [data-no-drag]\")) {\n      dragStartX.current = null;\n      return;\n    }\n    dragStartX.current = e.clientX;\n  };\n  const onDragMove = (e: React.PointerEvent) => {\n    if (dragStartX.current === null) return;\n    const delta = e.clientX - dragStartX.current;\n    if (!dragging) {\n      if (Math.abs(delta) < 6) return;\n      setDragging(true);\n      e.currentTarget.setPointerCapture(e.pointerId);\n    }\n    setDragOffset(delta);\n  };\n  const onDragEnd = () => {\n    if (dragStartX.current === null) return;\n    if (dragging) {\n      const width = mediaRef.current?.offsetWidth ?? 1;\n      const threshold = width * 0.18;\n      if (dragOffset < -threshold && idx < total - 1) setIdx((i) => i + 1);\n      else if (dragOffset > threshold && idx > 0) setIdx((i) => i - 1);\n    }\n    dragStartX.current = null;\n    setDragOffset(0);\n    setDragging(false);\n  };\n  const onDoubleTapLike = () => {\n    if (!doubleTapLike || !allowLike) return;\n    setLiked(true);\n    setBurst(false);\n    requestAnimationFrame(() => setBurst(true));\n    if (burstTimer.current) clearTimeout(burstTimer.current);\n    burstTimer.current = setTimeout(() => setBurst(false), 1000);\n  };\n\n  React.useEffect(() => {\n    return () => {\n      if (burstTimer.current) clearTimeout(burstTimer.current);\n    };\n  }, []);\n\n  return (\n    <>\n      <style>{HEART_BURST_CSS}</style>\n      <div\n        className={cn(\"box-border w-full overflow-hidden font-[-apple-system,BlinkMacSystemFont,'Segoe_UI',sans-serif]\", className)}\n        style={{ background: bg, borderRadius, border: `1px solid ${border}` }}\n        {...props}\n      >\n        <div className=\"flex items-center gap-2.5 px-3.5 py-2.5\">\n          <div className=\"box-border h-10 w-10 shrink-0 rounded-full p-0.5\" style={{ background: \"linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888)\" }}>\n            {userAvatar ? (\n              <img src={userAvatar} alt={username} className=\"block h-full w-full rounded-full object-cover\" />\n            ) : (\n              <div className=\"h-full w-full rounded-full\" style={{ background: dark ? \"#333\" : \"#ddd\" }} />\n            )}\n          </div>\n          <div className=\"min-w-0 flex-1\">\n            <div className=\"flex min-w-0 items-center gap-1\">\n              <span className=\"overflow-hidden text-sm font-semibold text-ellipsis whitespace-nowrap\" style={{ color: text }}>\n                {username}\n              </span>\n              {showVerified && <IgVerified />}\n            </div>\n            {showLocation && location && (\n              <div className=\"overflow-hidden text-[11px] text-ellipsis whitespace-nowrap\" style={{ color: sub }}>\n                {location}\n              </div>\n            )}\n          </div>\n          <IgDots dark={dark} />\n        </div>\n\n        {total > 0 ? (\n          <div\n            ref={mediaRef}\n            onPointerDown={onDragStart}\n            onPointerMove={onDragMove}\n            onPointerUp={onDragEnd}\n            onPointerCancel={onDragEnd}\n            onPointerLeave={onDragEnd}\n            onDoubleClick={onDoubleTapLike}\n            className=\"relative w-full overflow-hidden bg-black select-none\"\n            style={{ aspectRatio: \"1 / 1\", touchAction: multi ? \"pan-y\" : undefined, cursor: multi ? (dragging ? \"grabbing\" : \"grab\") : \"default\" }}\n          >\n            <div className=\"flex h-full\" style={{ width: `${total * 100}%`, transform: `translateX(calc(-${(idx / total) * 100}% + ${dragOffset}px))`, transition: dragging ? \"none\" : \"transform 0.3s cubic-bezier(.4,0,.2,1)\" }}>\n              {items.map((src, i) => (\n                <div key={i} className=\"h-full shrink-0\" style={{ width: `${100 / total}%` }}>\n                  <img src={src} alt={`${username} post photo ${i + 1} of ${total}`} draggable={false} className=\"pointer-events-none block h-full w-full object-cover\" />\n                </div>\n              ))}\n            </div>\n            {multi && showCounter && (\n              <div className=\"absolute top-3 right-3 rounded-full bg-black/60 px-2.5 py-[3px] text-xs font-semibold text-white\">\n                {idx + 1}/{total}\n              </div>\n            )}\n            {multi && idx > 0 && (\n              <button\n                onClick={() => setIdx((i) => i - 1)}\n                aria-label=\"Previous photo\"\n                className=\"absolute top-1/2 left-2 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border-0 bg-white/90 p-0\"\n              >\n                <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#262626\" strokeWidth=\"2.5\">\n                  <polyline points=\"15 18 9 12 15 6\" />\n                </svg>\n              </button>\n            )}\n            {multi && idx < total - 1 && (\n              <button\n                onClick={() => setIdx((i) => i + 1)}\n                aria-label=\"Next photo\"\n                className=\"absolute top-1/2 right-2 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border-0 bg-white/90 p-0\"\n              >\n                <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#262626\" strokeWidth=\"2.5\">\n                  <polyline points=\"9 18 15 12 9 6\" />\n                </svg>\n              </button>\n            )}\n            {multi && (\n              <div data-no-drag className=\"absolute right-0 bottom-2.5 left-0 flex justify-center gap-1\">\n                {items.map((_, i) => (\n                  <button\n                    key={i}\n                    onClick={() => setIdx(i)}\n                    aria-label={`Go to photo ${i + 1}`}\n                    aria-current={i === idx}\n                    className=\"cursor-pointer rounded-full border-0 p-0 transition-all duration-200 ease-[ease]\"\n                    style={{ width: i === idx ? 6 : 5, height: i === idx ? 6 : 5, background: i === idx ? \"#0095f6\" : \"rgba(255,255,255,0.7)\" }}\n                  />\n                ))}\n              </div>\n            )}\n            {burst && (\n              <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n                <svg width=\"90\" height=\"90\" viewBox=\"0 0 24 24\" fill=\"#fff\" style={{ filter: \"drop-shadow(0 2px 10px rgba(0,0,0,0.25))\", animation: \"ig-heart-burst 0.9s ease-out forwards\" }}>\n                  <path d=\"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z\" />\n                </svg>\n              </div>\n            )}\n          </div>\n        ) : (\n          <div className=\"flex w-full items-center justify-center\" style={{ aspectRatio: \"1 / 1\", background: dark ? \"#1a1a1a\" : \"#efefef\" }}>\n            <span className=\"text-[13px]\" style={{ color: sub }}>\n              Add images via Media Items\n            </span>\n          </div>\n        )}\n\n        <div className=\"flex items-center gap-3.5 px-3.5 pt-2.5 pb-0.5\">\n          <button\n            onClick={() => allowLike && setLiked((v) => !v)}\n            aria-label={liked ? \"Unlike\" : \"Like\"}\n            aria-pressed={liked}\n            className=\"flex border-0 bg-transparent p-0 transition-transform duration-[120ms] ease-[ease]\"\n            style={{ cursor: allowLike ? \"pointer\" : \"default\", transform: liked ? \"scale(1.15)\" : \"scale(1)\" }}\n          >\n            <IgHeart filled={liked} size={23} dark={dark} />\n          </button>\n          {showCommentIcon && (\n            <button aria-label=\"Comment\" className=\"flex cursor-pointer border-0 bg-transparent p-0\">\n              <IgComment size={23} dark={dark} />\n            </button>\n          )}\n          {showRepost && (\n            <button aria-label=\"Repost\" className=\"flex cursor-pointer border-0 bg-transparent p-0\">\n              <IgRepost size={23} dark={dark} />\n            </button>\n          )}\n          {showShare && (\n            <button aria-label=\"Share\" className=\"flex cursor-pointer border-0 bg-transparent p-0\">\n              <IgSend size={23} dark={dark} />\n            </button>\n          )}\n          <div className=\"flex-1\" />\n          <button\n            onClick={() => allowBookmark && setBookmarked((v) => !v)}\n            aria-label={bookmarked ? \"Remove from saved\" : \"Save\"}\n            aria-pressed={bookmarked}\n            className=\"flex border-0 bg-transparent p-0\"\n            style={{ cursor: allowBookmark ? \"pointer\" : \"default\" }}\n          >\n            <IgBookmark filled={bookmarked} size={23} dark={dark} />\n          </button>\n        </div>\n\n        {showLikes && (\n          <div className=\"px-3.5 py-0.5 text-sm font-semibold\" style={{ color: text }}>\n            {showLikedBy && showLikeCount ? (\n              <span>\n                Liked by <strong>{likedByUsername}</strong> and <strong>{fmt(likes)} others</strong>\n              </span>\n            ) : showLikedBy ? (\n              <span>\n                Liked by <strong>{likedByUsername}</strong>\n              </span>\n            ) : showLikeCount ? (\n              <strong>{fmt(likes)} likes</strong>\n            ) : null}\n          </div>\n        )}\n\n        {postDescription && (\n          <div className=\"px-3.5 py-1 text-sm leading-[1.5]\" style={{ color: text }}>\n            <strong>{username}</strong> {postDescription}\n          </div>\n        )}\n\n        {showComments && commentsCount > 0 && (\n          <div className=\"cursor-pointer px-3.5 py-0.5 text-sm\" style={{ color: sub }}>\n            View all {fmt(commentsCount)} comments\n          </div>\n        )}\n\n        <div className=\"px-3.5 pt-1 pb-3.5 text-[11px] tracking-[0.3px] uppercase\" style={{ color: sub }}>\n          {timePosted}\n        </div>\n      </div>\n    </>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}