{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/yn0QdRX9hACBTQ8cRDof/M1RzyGK1WCeUfvdzgxdW/Scale.js"],
  "sourcesContent": ["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport * as React from \"react\";\nimport { useRef } from \"react\";\nimport { addPropertyControls, ControlType, motion } from \"framer\";\nimport { useMeasuredSize } from \"https://framer.com/m/framer/useMeasuredSize.js\";\nimport { emptyStateStyle, detectAutoSizingAxis, defaultEvents } from \"https://framer.com/m/framer/default-utils.js@0.42.0\";\nimport { useChild, hasChildren, childControl } from \"https://framer.com/m/framer/useChild.js@0.14.0\";\nfunction alignmentToPercent(alignment) {\n  switch (alignment.toLowerCase()) {\n    case \"left\":\n    case \"top\":\n      return \"0%\";\n    case \"center\":\n      return \"50%\";\n    case \"right\":\n    case \"bottom\":\n      return \"100%\";\n    default:\n      return \"0%\";\n  }\n}\nfunction getAbsPositionFromOrigin(origin, parentLength, contentLength) {\n  switch (origin) {\n    case \"0%\":\n      return origin;\n    case \"50%\":\n      return (parentLength - contentLength) / 2;\n    case \"100%\":\n      return parentLength - contentLength;\n    default:\n      return \"0%\";\n  }\n} /**\n  * SCALE\n  *\n  * @framerIntrinsicWidth 200\n  * @framerIntrinsicHeight 200\n  *\n  * @framerSupportedLayoutWidth any\n  * @framerSupportedLayoutHeight any\n  */\nexport function Scale(props) {\n  const {\n    children,\n    scale,\n    style,\n    isAutoScaling,\n    showOverflow,\n    options,\n    onClick,\n    onMouseEnter,\n    onMouseLeave,\n    onMouseDown,\n    onMouseUp\n  } = props;\n  const {\n    originX,\n    originY\n  } = options;\n  const hasChild = hasChildren(props); // Scale content sizing\n  const autoSizing = detectAutoSizingAxis(props); // Container size detection for auto-scaling\n  const container = useRef();\n  const containerSize = useMeasuredSize(container);\n  const width = (containerSize === null || containerSize === void 0 ? void 0 : containerSize.width) ? containerSize.width : 200;\n  const height = (containerSize === null || containerSize === void 0 ? void 0 : containerSize.height) ? containerSize.height : 200; // Override content props\n  const update = {\n    position: \"relative\",\n    right: undefined,\n    bottom: undefined,\n    top: undefined,\n    left: undefined,\n    // layoutId: \"inner-content\",\n    layout: false,\n    initial: false,\n    // style: { position: \"relative\" },\n    _constraints: {\n      enabled: false\n    }\n  }; // Do 2 copies of child, one with layout=False and layoutId=undefined, use that for the hidden measured contents.\n  const child = useChild(props);\n  const updatedChild = hasChild ? /*#__PURE__*/React.cloneElement(child, update) : null;\n  const contentContainer = useRef();\n  const size = useMeasuredSize(contentContainer);\n  const hasChildSize = hasChild && size;\n  const scaleX = isAutoScaling ? !autoSizing.width && size ? width / size.width : 1 : scale;\n  const scaleY = isAutoScaling ? !autoSizing.height && size ? height / size.height : 1 : scale;\n  return /*#__PURE__*/_jsxs(motion.div, {\n    onClick,\n    onMouseEnter,\n    onMouseLeave,\n    onMouseDown,\n    onMouseUp,\n    ref: container,\n    style: {\n      position: \"relative\",\n      overflow: showOverflow ? \"visible\" : \"hidden\",\n      height: \"auto\",\n      width: \"auto\",\n      ...(hasChildSize && {\n        width: isAutoScaling ? size.width : size.width * scale,\n        height: isAutoScaling ? size.height : size.height * scale\n      }),\n      ...style\n    },\n    children: [/*#__PURE__*/_jsx(\"div\", {\n      ref: contentContainer,\n      style: {\n        visibility: \"hidden\",\n        width: \"max-content\",\n        height: \"max-content\"\n      },\n      children: updatedChild\n    }), /*#__PURE__*/_jsx(motion.div, {\n      initial: false,\n      style: {\n        scaleX,\n        scaleY,\n        position: \"absolute\",\n        top: 0,\n        left: 0,\n        originX: autoSizing.width ? \"0%\" : originX,\n        originY: autoSizing.height ? \"0%\" : originY,\n        ...(hasChildSize && !autoSizing.width && {\n          left: getAbsPositionFromOrigin(alignmentToPercent(originX), width, size.width * scale)\n        }),\n        ...(hasChildSize && !autoSizing.height && {\n          top: getAbsPositionFromOrigin(alignmentToPercent(originY), height, size.height * scale)\n        })\n      },\n      children: updatedChild\n    }), !hasChild && /*#__PURE__*/_jsx(\"div\", {\n      style: {\n        ...emptyStateStyle,\n        width: 200,\n        height: 200,\n        ...style\n      },\n      children: \"Connect Content \u2192\"\n    })]\n  });\n}\nScale.defaultProps = {\n  height: 200,\n  width: 200,\n  scale: 1,\n  isAutoScaling: false,\n  showOverflow: false\n};\naddPropertyControls(Scale, {\n  ...childControl(\"Content\"),\n  showOverflow: {\n    title: \"Overflow\",\n    type: ControlType.Boolean,\n    enabledTitle: \"Show\",\n    disabledTitle: \"Hide\",\n    defaultValue: Scale.defaultProps.showOverflow\n  },\n  isAutoScaling: {\n    type: ControlType.Boolean,\n    enabledTitle: \"Auto\",\n    disabledTitle: \"Manual\",\n    title: \"Scaling\"\n  },\n  scale: {\n    title: \"Factor\",\n    type: ControlType.Number,\n    max: 10,\n    min: 0,\n    step: 0.01,\n    hidden: ({\n      isAutoScaling\n    }) => isAutoScaling\n  },\n  options: {\n    type: ControlType.Object,\n    title: \"Align\",\n    controls: {\n      originX: {\n        title: \"Align X\",\n        type: ControlType.Enum,\n        displaySegmentedControl: true,\n        options: [\"Left\", \"Center\", \"Right\"],\n        hidden: ({\n          isAutoScaling\n        }) => isAutoScaling,\n        defaultValue: \"Center\"\n      },\n      originY: {\n        title: \"Align Y\",\n        type: ControlType.Enum,\n        displaySegmentedControl: true,\n        options: [\"Top\", \"Center\", \"Bottom\"],\n        hidden: ({\n          isAutoScaling\n        }) => isAutoScaling,\n        defaultValue: \"Center\"\n      }\n    },\n    hidden: ({\n      isAutoScaling\n    }) => isAutoScaling\n  },\n  ...defaultEvents\n});\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"Scale\": {\n      \"type\": \"reactComponent\",\n      \"name\": \"Scale\",\n      \"slots\": [],\n      \"annotations\": {\n        \"framerIntrinsicWidth\": \"200\",\n        \"framerContractVersion\": \"1\",\n        \"framerSupportedLayoutWidth\": \"any\",\n        \"framerSupportedLayoutHeight\": \"any\",\n        \"framerIntrinsicHeight\": \"200\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n    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,aAAc,OACd,cAAe,OACf,aAAczC,EAAM,aAAa,YACnC,EACA,cAAe,CACb,KAAMyC,EAAY,QAClB,aAAc,OACd,cAAe,SACf,MAAO,SACT,EACA,MAAO,CACL,MAAO,SACP,KAAMA,EAAY,OAClB,IAAK,GACL,IAAK,EACL,KAAM,IACN,OAAQ,CAAC,CACP,cAAApC,CACF,IAAMA,CACR,EACA,QAAS,CACP,KAAMoC,EAAY,OAClB,MAAO,QACP,SAAU,CACR,QAAS,CACP,MAAO,UACP,KAAMA,EAAY,KAClB,wBAAyB,GACzB,QAAS,CAAC,OAAQ,SAAU,OAAO,EACnC,OAAQ,CAAC,CACP,cAAApC,CACF,IAAMA,EACN,aAAc,QAChB,EACA,QAAS,CACP,MAAO,UACP,KAAMoC,EAAY,KAClB,wBAAyB,GACzB,QAAS,CAAC,MAAO,SAAU,QAAQ,EACnC,OAAQ,CAAC,CACP,cAAApC,CACF,IAAMA,EACN,aAAc,QAChB,CACF,EACA,OAAQ,CAAC,CACP,cAAAA,CACF,IAAMA,CACR,EACA,GAAGqC,CACL,CAAC",
  "names": ["alignmentToPercent", "alignment", "getAbsPositionFromOrigin", "origin", "parentLength", "contentLength", "Scale", "props", "children", "scale", "style", "isAutoScaling", "showOverflow", "options", "onClick", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "originX", "originY", "hasChild", "hasChildren", "autoSizing", "detectAutoSizingAxis", "container", "pe", "containerSize", "useMeasuredSize", "width", "height", "update", "child", "useChild", "updatedChild", "q", "contentContainer", "size", "hasChildSize", "scaleX", "scaleY", "u", "motion", "p", "emptyStateStyle", "addPropertyControls", "childControl", "ControlType", "defaultEvents"]
}
