{
  "version": 3,
  "sources": ["../../../../src/lib/shapes/embed/EmbedShapeUtil.tsx"],
  "sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\n\nimport {\n\tBaseBoxShapeUtil,\n\tHTMLContainer,\n\tTLEmbedShape,\n\tTLEmbedShapeProps,\n\tTLResizeInfo,\n\tembedShapeMigrations,\n\tembedShapeProps,\n\tlerp,\n\tresizeBox,\n\ttoDomPrecision,\n\tuseColorMode,\n\tuseIsEditing,\n\tuseSvgExportContext,\n\tuseValue,\n} from '@tldraw/editor'\nimport {\n\tDEFAULT_EMBED_DEFINITIONS,\n\tDefaultEmbedConfig,\n\tTLEmbedDefinition,\n\tTLEmbedShapePermissions,\n\tembedShapePermissionDefaults,\n\tunknownEmbedShapePermissionOverrides,\n} from '../../defaultEmbedDefinitions'\nimport { TLEmbedResult, getCorrectedEmbedSize, getEmbedInfo } from '../../utils/embeds/embeds'\nimport { BookmarkShapeComponent } from '../bookmark/BookmarkShapeUtil'\nimport { ShapeOptionsWithDisplayValues, getDisplayValues } from '../shared/getDisplayValues'\nimport { getRotatedBoxShadow } from '../shared/rotated-box-shadow'\n\n/** @public */\nexport interface EmbedShapeUtilDisplayValues {\n\tshowShadow: boolean\n}\n\n/** @public */\nexport interface EmbedShapeOptions extends ShapeOptionsWithDisplayValues<\n\tTLEmbedShape,\n\tEmbedShapeUtilDisplayValues\n> {\n\t/** The embed definitions to use for this shape util. */\n\treadonly embedDefinitions: readonly TLEmbedDefinition[]\n\t/**\n\t * Per-embed configuration, keyed by embed type. Passed to each definition's `toEmbedUrl` when\n\t * building its embed URL \u2014 for example, an API key for the default Google Maps embed:\n\t *\n\t * ```ts\n\t * EmbedShapeUtil.configure({ embedConfig: { google_maps: { apiKey: '...' } } })\n\t * ```\n\t */\n\treadonly embedConfig?: DefaultEmbedConfig & Record<string, unknown>\n}\n\nconst getSandboxPermissions = (permissions: TLEmbedShapePermissions) => {\n\treturn Object.entries(permissions)\n\t\t.filter(([_perm, isEnabled]) => isEnabled)\n\t\t.map(([perm]) => perm)\n\t\t.join(' ')\n}\n\n/** @public */\nexport class EmbedShapeUtil extends BaseBoxShapeUtil<TLEmbedShape> {\n\tstatic override type = 'embed' as const\n\tstatic override props = embedShapeProps\n\tstatic override migrations = embedShapeMigrations\n\n\toverride options: EmbedShapeOptions = {\n\t\tembedDefinitions: DEFAULT_EMBED_DEFINITIONS,\n\t\tembedConfig: {},\n\t\tgetDefaultDisplayValues(): EmbedShapeUtilDisplayValues {\n\t\t\treturn {\n\t\t\t\tshowShadow: true,\n\t\t\t}\n\t\t},\n\t\tgetCustomDisplayValues(): Partial<EmbedShapeUtilDisplayValues> {\n\t\t\treturn {}\n\t\t},\n\t}\n\n\toverride canEditWhileLocked(shape: TLEmbedShape) {\n\t\tconst result = this.getEmbedDefinition(shape.props.url)\n\t\tif (!result) return true\n\t\treturn result.definition.canEditWhileLocked ?? true\n\t}\n\n\tprivate static legacyEmbedDefinitions: readonly TLEmbedDefinition[] | null = null\n\n\t/** @deprecated - Use `EmbedShapeUtil.configure({ embedDefinitions: [...] })` instead. */\n\tstatic setEmbedDefinitions(embedDefinitions: readonly TLEmbedDefinition[]) {\n\t\tEmbedShapeUtil.legacyEmbedDefinitions = embedDefinitions\n\t}\n\n\tprivate getEmbedDefs(): readonly TLEmbedDefinition[] {\n\t\treturn EmbedShapeUtil.legacyEmbedDefinitions ?? this.options.embedDefinitions\n\t}\n\n\tgetEmbedDefinitions(): readonly TLEmbedDefinition[] {\n\t\treturn this.getEmbedDefs()\n\t}\n\n\tgetEmbedDefinition(url: string): TLEmbedResult {\n\t\treturn getEmbedInfo(this.getEmbedDefs(), url, this.options.embedConfig)\n\t}\n\n\t/**\n\t * Resolve the embed's true aspect ratio (for definitions with `sizeToContentAspectRatio`) and\n\t * correct the shape's size to match. The dimensions come from the URL's OpenGraph metadata via\n\t * the editor's url asset handler (the same \"unfurl\" path bookmarks use). The correction is\n\t * applied without adding to the undo history.\n\t */\n\tasync resolveAspectRatio(shape: TLEmbedShape) {\n\t\tconst { url } = shape.props\n\t\tconst definition = this.getEmbedDefinition(url)?.definition\n\t\tif (!definition?.sizeToContentAspectRatio || !url) return\n\n\t\tconst resolvedRatio = await this.getContentAspectRatio(url)\n\n\t\t// The editor may have been torn down while the metadata was in flight.\n\t\tif (this.editor.isDisposed) return\n\n\t\tconst latest = this.editor.getShape<TLEmbedShape>(shape.id)\n\t\t// Bail if the shape is gone or its url changed while we were awaiting: a later run for the\n\t\t// new url will handle it, and we must not apply this url's ratio to a different video.\n\t\tif (!latest || latest.props.url !== url) return\n\n\t\tconst corrected = getCorrectedEmbedSize({\n\t\t\tw: latest.props.w,\n\t\t\th: latest.props.h,\n\t\t\tresolvedRatio,\n\t\t})\n\t\tif (!corrected) return\n\n\t\t// `onResize` enforces a per-axis minimum (inflated by the aspect ratio when locked), so a very\n\t\t// tall/narrow target could have one axis clamped while the other isn't \u2014 that would break the\n\t\t// ratio and re-letterboxes the very content we're correcting. Scale the whole target up so it\n\t\t// clears both floors, which preserves the ratio at the cost of a slightly larger box only in\n\t\t// the extreme (still far smaller than leaving one axis un-corrected).\n\t\tconst { minWidth, minHeight } = this.getResizeMinBounds(latest)\n\t\tconst clearFloor = Math.max(1, minWidth / corrected.w, minHeight / corrected.h)\n\t\tconst targetW = corrected.w * clearFloor\n\t\tconst targetH = corrected.h * clearFloor\n\n\t\t// Let the editor resize the shape: by default it scales around the shape's page-space center\n\t\t// and along its own rotation axis, so the center stays fixed even if the embed was rotated\n\t\t// before the ratio resolved. No need to compute x/y by hand.\n\t\t//\n\t\t// We pass `isAspectRatioLocked: false` because embeds like Vimeo lock their aspect ratio,\n\t\t// which would otherwise make the editor merge our non-uniform scale into a single uniform\n\t\t// factor \u2014 leaving the wrong ratio and defeating the whole correction.\n\t\tthis.editor.run(\n\t\t\t() => {\n\t\t\t\tthis.editor.resizeShape(\n\t\t\t\t\tlatest.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tx: targetW / latest.props.w,\n\t\t\t\t\t\ty: targetH / latest.props.h,\n\t\t\t\t\t},\n\t\t\t\t\t{ isAspectRatioLocked: false }\n\t\t\t\t)\n\t\t\t},\n\t\t\t{ history: 'ignore' }\n\t\t)\n\t}\n\n\t/**\n\t * Resolve the content's aspect ratio from the URL's OpenGraph metadata, fetched through the\n\t * editor's url asset handler (the \"unfurl\" service). Returns `undefined` if no usable dimensions\n\t * are available (e.g. no unfurl service is configured, or the page reports no image size).\n\t */\n\tprivate async getContentAspectRatio(url: string): Promise<number | undefined> {\n\t\ttry {\n\t\t\tconst asset = await this.editor.getAssetForExternalContent({ type: 'url', url })\n\t\t\tif (!asset || asset.type !== 'bookmark') return undefined\n\t\t\tconst width = asset.meta.imageWidth\n\t\t\tconst height = asset.meta.imageHeight\n\t\t\tif (typeof width === 'number' && typeof height === 'number' && width > 0 && height > 0) {\n\t\t\t\treturn width / height\n\t\t\t}\n\t\t} catch {\n\t\t\t// Resolving the aspect ratio is best-effort: never let a metadata fetch failure surface.\n\t\t}\n\t\treturn undefined\n\t}\n\n\toverride getText(shape: TLEmbedShape) {\n\t\treturn shape.props.url\n\t}\n\n\toverride getAriaDescriptor(shape: TLEmbedShape) {\n\t\tconst embedInfo = this.getEmbedDefinition(shape.props.url)\n\t\treturn embedInfo?.definition.title\n\t}\n\n\toverride hideSelectionBoundsFg(shape: TLEmbedShape) {\n\t\treturn !this.canResize(shape)\n\t}\n\toverride canEdit(shape: TLEmbedShape) {\n\t\treturn true\n\t}\n\toverride canResize(shape: TLEmbedShape) {\n\t\treturn this.getEmbedDefinition(shape.props.url)?.definition?.doesResize ?? true\n\t}\n\toverride canEditInReadonly(shape: TLEmbedShape) {\n\t\treturn true\n\t}\n\n\toverride getDefaultProps(): TLEmbedShape['props'] {\n\t\treturn {\n\t\t\tw: 300,\n\t\t\th: 300,\n\t\t\turl: '',\n\t\t}\n\t}\n\n\toverride getGeometry(shape: TLEmbedShape) {\n\t\treturn super.getGeometry(shape)\n\t}\n\n\toverride isAspectRatioLocked(shape: TLEmbedShape) {\n\t\tconst embedInfo = this.getEmbedDefinition(shape.props.url)\n\t\treturn embedInfo?.definition.isAspectRatioLocked ?? false\n\t}\n\n\t/**\n\t * The minimum width/height a resize of `shape` is allowed to reach. When the embed's aspect ratio\n\t * is locked, the longer axis's minimum is inflated by the current aspect ratio so that shrinking\n\t * to the floor keeps the shorter axis at or above the base minimum.\n\t */\n\tprivate getResizeMinBounds(shape: TLEmbedShape) {\n\t\tconst embedInfo = this.getEmbedDefinition(shape.props.url)\n\t\tlet minWidth = embedInfo?.definition.minWidth ?? 200\n\t\tlet minHeight = embedInfo?.definition.minHeight ?? 200\n\t\tif (this.isAspectRatioLocked(shape)) {\n\t\t\t// Neither the width nor the height can be less than the base minimum.\n\t\t\tconst aspectRatio = shape.props.w / shape.props.h\n\t\t\tif (aspectRatio > 1) {\n\t\t\t\t// Landscape\n\t\t\t\tminWidth *= aspectRatio\n\t\t\t} else {\n\t\t\t\t// Portrait\n\t\t\t\tminHeight /= aspectRatio\n\t\t\t}\n\t\t}\n\t\treturn { minWidth, minHeight }\n\t}\n\n\toverride onResize(shape: TLEmbedShape, info: TLResizeInfo<TLEmbedShape>) {\n\t\treturn resizeBox(shape, info, this.getResizeMinBounds(shape))\n\t}\n\n\toverride component(shape: TLEmbedShape) {\n\t\tconst svgExport = useSvgExportContext()\n\t\tconst { w, h, url } = shape.props\n\t\tconst isEditing = useIsEditing(shape.id)\n\t\tconst colorMode = useColorMode()\n\t\tconst dv = getDisplayValues(this, shape, colorMode)\n\n\t\tconst embedInfo = this.getEmbedDefinition(url)\n\n\t\tconst isHoveringWhileEditingSameShape = useValue(\n\t\t\t'is hovering',\n\t\t\t() => {\n\t\t\t\tconst { editingShapeId, hoveredShapeId } = this.editor.getCurrentPageState()\n\n\t\t\t\tif (editingShapeId && hoveredShapeId !== editingShapeId) {\n\t\t\t\t\tconst editingShape = this.editor.getShape(editingShapeId)\n\t\t\t\t\tif (editingShape && this.editor.isShapeOfType(editingShape, 'embed')) {\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn false\n\t\t\t},\n\t\t\t[]\n\t\t)\n\n\t\tconst pageRotation = this.editor.getShapePageTransform(shape)!.rotation()\n\n\t\tif (svgExport) {\n\t\t\t// for SVG exports, we show a blank embed\n\t\t\treturn (\n\t\t\t\t<HTMLContainer className=\"tl-embed-container\" id={shape.id}>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"tl-embed\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tborder: 0,\n\t\t\t\t\t\t\tboxShadow: dv.showShadow ? getRotatedBoxShadow(pageRotation) : 'none',\n\t\t\t\t\t\t\tborderRadius: embedInfo?.definition.overrideOutlineRadius ?? 8,\n\t\t\t\t\t\t\tbackground: embedInfo?.definition.backgroundColor ?? 'var(--tl-color-background)',\n\t\t\t\t\t\t\twidth: w,\n\t\t\t\t\t\t\theight: h,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</HTMLContainer>\n\t\t\t)\n\t\t}\n\n\t\tconst isInteractive = isEditing || isHoveringWhileEditingSameShape\n\n\t\t// Prevent nested embedding of tldraw\n\t\tconst isIframe =\n\t\t\ttypeof window !== 'undefined' && (window !== window.top || window.self !== window.parent)\n\t\tif (isIframe && embedInfo?.definition.type === 'tldraw') return null\n\n\t\tconst sandbox = getSandboxPermissions({\n\t\t\t...embedShapePermissionDefaults,\n\t\t\t...(embedInfo\n\t\t\t\t? (embedInfo.definition.overridePermissions ?? {})\n\t\t\t\t: unknownEmbedShapePermissionOverrides),\n\t\t})\n\n\t\tif (embedInfo?.definition.type === 'github_gist') {\n\t\t\tconst idFromGistUrl = embedInfo.url.split('/').pop()\n\t\t\tif (!idFromGistUrl) throw Error('No gist id!')\n\n\t\t\t// Gist embeds use srcDoc, so we must disable allow-same-origin. Otherwise\n\t\t\t// the embedded script shares the parent's origin and can escape the sandbox.\n\t\t\tconst gistSandbox = getSandboxPermissions({\n\t\t\t\t...embedShapePermissionDefaults,\n\t\t\t\t...(embedInfo?.definition?.overridePermissions ?? {}),\n\t\t\t\t'allow-same-origin': false,\n\t\t\t})\n\n\t\t\treturn (\n\t\t\t\t<HTMLContainer className=\"tl-embed-container\" id={shape.id}>\n\t\t\t\t\t<Gist\n\t\t\t\t\t\tid={idFromGistUrl}\n\t\t\t\t\t\tsandbox={gistSandbox}\n\t\t\t\t\t\twidth={toDomPrecision(w)!}\n\t\t\t\t\t\theight={toDomPrecision(h)!}\n\t\t\t\t\t\tisInteractive={isInteractive}\n\t\t\t\t\t\tpageRotation={pageRotation}\n\t\t\t\t\t\tshowShadow={dv.showShadow}\n\t\t\t\t\t/>\n\t\t\t\t</HTMLContainer>\n\t\t\t)\n\t\t}\n\n\t\tconst iframeSrc = embedInfo?.embedUrl ?? url\n\n\t\treturn (\n\t\t\t<HTMLContainer className=\"tl-embed-container\" id={shape.id}>\n\t\t\t\t{iframeSrc ? (\n\t\t\t\t\t<iframe\n\t\t\t\t\t\tclassName=\"tl-embed\"\n\t\t\t\t\t\tsandbox={sandbox}\n\t\t\t\t\t\tsrc={iframeSrc}\n\t\t\t\t\t\twidth={toDomPrecision(w)}\n\t\t\t\t\t\theight={toDomPrecision(h)}\n\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\t\t\t\t\t\tframeBorder=\"0\"\n\t\t\t\t\t\treferrerPolicy=\"strict-origin-when-cross-origin\"\n\t\t\t\t\t\ttabIndex={isEditing ? 0 : -1}\n\t\t\t\t\t\tallowFullScreen\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tborder: 0,\n\t\t\t\t\t\t\t// Fill the container exactly. Relying on the fixed pixel width/height causes\n\t\t\t\t\t\t\t// the flex-centered iframe to be rounded independently from its box at\n\t\t\t\t\t\t\t// fractional sizes/zooms, leaving a 1-2px background sliver on one edge.\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\tpointerEvents: isInteractive ? 'auto' : 'none',\n\t\t\t\t\t\t\t// Fix for safari <https://stackoverflow.com/a/49150908>\n\t\t\t\t\t\t\tzIndex: isInteractive ? '' : '-1',\n\t\t\t\t\t\t\tboxShadow: dv.showShadow ? getRotatedBoxShadow(pageRotation) : 'none',\n\t\t\t\t\t\t\tborderRadius: embedInfo?.definition?.overrideOutlineRadius ?? 8,\n\t\t\t\t\t\t\tbackground: embedInfo?.definition?.backgroundColor,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BookmarkShapeComponent\n\t\t\t\t\t\turl={url}\n\t\t\t\t\t\th={h}\n\t\t\t\t\t\trotation={pageRotation}\n\t\t\t\t\t\tassetId={null}\n\t\t\t\t\t\tshowImageContainer={false}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</HTMLContainer>\n\t\t)\n\t}\n\n\toverride getIndicatorPath(shape: TLEmbedShape): Path2D {\n\t\tconst path = new Path2D()\n\t\tpath.rect(0, 0, shape.props.w, shape.props.h)\n\t\treturn path\n\t}\n\n\toverride getInterpolatedProps(\n\t\tstartShape: TLEmbedShape,\n\t\tendShape: TLEmbedShape,\n\t\tt: number\n\t): TLEmbedShapeProps {\n\t\treturn {\n\t\t\t...(t > 0.5 ? endShape.props : startShape.props),\n\t\t\tw: lerp(startShape.props.w, endShape.props.w, t),\n\t\t\th: lerp(startShape.props.h, endShape.props.h, t),\n\t\t}\n\t}\n}\n\nfunction Gist({\n\tid,\n\tsandbox,\n\tisInteractive,\n\twidth,\n\theight,\n\tstyle,\n\tpageRotation,\n\tshowShadow,\n}: {\n\tid: string\n\tsandbox: string\n\tisInteractive: boolean\n\twidth: number\n\theight: number\n\tpageRotation: number\n\tshowShadow: boolean\n\tstyle?: React.CSSProperties\n}) {\n\t// Security warning:\n\t// Gists allow adding .json extensions to the URL which return JSONP.\n\t// Furthermore, the JSONP can include callbacks that execute arbitrary JavaScript.\n\t// It _is_ sandboxed by the iframe but we still want to disable it nonetheless.\n\t// We restrict the id to only allow hexdecimal characters to prevent this.\n\t// Read more:\n\t//   https://github.com/bhaveshk90/Content-Security-Policy-CSP-Bypass-Techniques\n\t//   https://github.com/renniepak/CSPBypass\n\tif (!id.match(/^[0-9a-f]+$/)) throw Error('No gist id!')\n\n\treturn (\n\t\t<iframe\n\t\t\tclassName=\"tl-embed\"\n\t\t\tsandbox={sandbox}\n\t\t\tdraggable={false}\n\t\t\twidth={toDomPrecision(width)}\n\t\t\theight={toDomPrecision(height)}\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\t\t\tframeBorder=\"0\"\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\t\t\tscrolling=\"no\"\n\t\t\treferrerPolicy=\"strict-origin-when-cross-origin\"\n\t\t\ttabIndex={isInteractive ? 0 : -1}\n\t\t\tstyle={{\n\t\t\t\t...style,\n\t\t\t\tpointerEvents: isInteractive ? 'all' : 'none',\n\t\t\t\t// Fix for safari <https://stackoverflow.com/a/49150908>\n\t\t\t\tzIndex: isInteractive ? '' : '-1',\n\t\t\t\tboxShadow: showShadow ? getRotatedBoxShadow(pageRotation) : 'none',\n\t\t\t}}\n\t\t\tsrcDoc={`\n\t\t\t<html>\n\t\t\t\t<head>\n\t\t\t\t\t<base target=\"_blank\">\n\t\t\t\t</head>\n\t\t\t\t<body>\n\t\t\t\t\t<script src=${`https://gist.github.com/${id}.js`}></script>\n\t\t\t\t\t<style type=\"text/css\">\n\t\t\t\t\t\t* { margin: 0px; }\n\t\t\t\t\t\ttable { height: 100%; background-color: red; }\n\t\t\t\t\t\t.gist { background-color: none; height: 100%;  }\n\t\t\t\t\t\t.gist .gist-file { height: calc(100vh - 2px); padding: 0px; display: grid; grid-template-rows: 1fr auto; }\n\t\t\t\t\t</style>\n\t\t\t\t</body>\n\t\t\t</html>`}\n\t\t/>\n\t)\n}\n"],
  "mappings": "AA2RK;AAzRL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