{{template "repo/settings/layout_head" (dict "pageClass" "repository settings advanced")}}
	<div class="user-main-content twelve wide column">
		<h4 class="ui top attached header">
			{{ctx.Locale.Tr "repo.settings.advanced_settings"}}
		</h4>
		<div class="ui attached segment">
			<form class="ui form" method="post">
				<input type="hidden" name="action" value="advanced">

				{{/* ── Code ── */}}
				<h5 class="ui dividing header tw-flex tw-items-center tw-gap-2">{{svg "octicon-code" 16}} {{ctx.Locale.Tr "repo.code"}}</h5>
				{{$isCodeEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeCode}}
				{{$isCodeGlobalDisabled := ctx.Consts.RepoUnitTypeCode.UnitGlobalDisabled}}
				<div class="inline field">
					<div class="ui checkbox{{if $isCodeGlobalDisabled}} disabled{{end}}"{{if $isCodeGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
						<input class="enable-system" name="enable_code" type="checkbox"{{if $isCodeEnabled}} checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.code.desc"}}</label>
					</div>
				</div>

				{{/* ── Wiki ── */}}
				<h5 class="ui dividing header tw-flex tw-items-center tw-gap-2">{{svg "octicon-book" 16}} {{ctx.Locale.Tr "repo.wiki"}}</h5>
				{{$isInternalWikiEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeWiki}}
				{{$isExternalWikiEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeExternalWiki}}
				{{$isWikiEnabled := or $isInternalWikiEnabled $isExternalWikiEnabled}}
				{{$isWikiGlobalDisabled := ctx.Consts.RepoUnitTypeWiki.UnitGlobalDisabled}}
				{{$isExternalWikiGlobalDisabled := ctx.Consts.RepoUnitTypeExternalWiki.UnitGlobalDisabled}}
				{{$isBothWikiGlobalDisabled := and $isWikiGlobalDisabled $isExternalWikiGlobalDisabled}}
				<div class="inline field">
					<div class="ui checkbox{{if $isBothWikiGlobalDisabled}} disabled{{end}}"{{if $isBothWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
						<input class="enable-system" name="enable_wiki" type="checkbox" data-target="#wiki_box" {{if $isWikiEnabled}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.settings.wiki_desc"}}</label>
					</div>
				</div>
				<div class="field{{if not $isWikiEnabled}} disabled{{end}}" id="wiki_box">
					<div class="field">
						<div class="ui radio checkbox{{if $isWikiGlobalDisabled}} disabled{{end}}"{{if $isWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
							<input class="enable-system-radio" name="enable_external_wiki" type="radio" value="false" data-context="#internal_wiki_box" data-target="#external_wiki_box" {{if $isInternalWikiEnabled}}checked{{end}}>
							<label>{{ctx.Locale.Tr "repo.settings.use_internal_wiki"}}</label>
						</div>
					</div>
					<div id="internal_wiki_box" class="field tw-pl-4 {{if not $isInternalWikiEnabled}}disabled{{end}}">
						<div class="inline field">
							<label>{{ctx.Locale.Tr "repo.settings.default_wiki_branch_name"}}</label>
							<input name="default_wiki_branch" value="{{.Repository.DefaultWikiBranch}}">
						</div>
						<div class="inline field">
							<label>{{ctx.Locale.Tr "repo.settings.unit_visibility"}}</label>
							<select name="wiki_visibility" class="ui dropdown">
								<option value="not-set" {{if not (eq (.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeWiki).AnonymousAccessMode 1)}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.unit_visibility_private"}}</option>
								<option value="anonymous-read" {{if eq (.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeWiki).AnonymousAccessMode 1}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.unit_visibility_public"}}</option>
							</select>
						</div>
					</div>
					<div class="field">
						<div class="ui radio checkbox{{if $isExternalWikiGlobalDisabled}} disabled{{end}}"{{if $isExternalWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
							<input class="enable-system-radio" name="enable_external_wiki" type="radio" value="true" data-context="#internal_wiki_box" data-target="#external_wiki_box" {{if $isExternalWikiEnabled}}checked{{end}}>
							<label>{{ctx.Locale.Tr "repo.settings.use_external_wiki"}}</label>
						</div>
					</div>
					<div id="external_wiki_box" class="field tw-pl-4 {{if not $isExternalWikiEnabled}}disabled{{end}}">
						<label for="external_wiki_url">{{ctx.Locale.Tr "repo.settings.external_wiki_url"}}</label>
						<input id="external_wiki_url" name="external_wiki_url" type="url" value="{{(.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}">
						<p class="help">{{ctx.Locale.Tr "repo.settings.external_wiki_url_desc"}}</p>
					</div>
				</div>

				{{/* ── Issues ── */}}
				<h5 class="ui dividing header tw-flex tw-items-center tw-gap-2">{{svg "octicon-issue-opened" 16}} {{ctx.Locale.Tr "repo.issues"}}</h5>
				{{$isIssuesEnabled := or (.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeIssues) (.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeExternalTracker)}}
				{{$isIssuesGlobalDisabled := ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled}}
				{{$isExternalTrackerGlobalDisabled := ctx.Consts.RepoUnitTypeExternalTracker.UnitGlobalDisabled}}
				{{$isIssuesAndExternalGlobalDisabled := and $isIssuesGlobalDisabled $isExternalTrackerGlobalDisabled}}
				<div class="inline field">
					<div class="ui checkbox{{if $isIssuesAndExternalGlobalDisabled}} disabled{{end}}"{{if $isIssuesAndExternalGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
						<input class="enable-system" name="enable_issues" type="checkbox" data-target="#issue_box" {{if $isIssuesEnabled}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.settings.issues_desc"}}</label>
					</div>
				</div>
				<div class="field {{if not $isIssuesEnabled}}disabled{{end}}" id="issue_box">
					<div class="field">
						<div class="ui radio checkbox{{if $isIssuesGlobalDisabled}} disabled{{end}}"{{if $isIssuesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
							<input class="enable-system-radio" name="enable_external_tracker" type="radio" value="false" data-context="#internal_issue_box" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeExternalTracker)}}checked{{end}}>
							<label>{{ctx.Locale.Tr "repo.settings.use_internal_issue_tracker"}}</label>
						</div>
					</div>
					<div class="field tw-pl-4 {{if (.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeExternalTracker)}}disabled{{end}}" id="internal_issue_box">
						{{if .Repository.CanEnableTimetracker}}
							<div class="field">
								<div class="ui checkbox">
									<input name="enable_timetracker" class="enable-system" data-target="#only_contributors" type="checkbox" {{if .Repository.IsTimetrackerEnabled ctx}}checked{{end}}>
									<label>{{ctx.Locale.Tr "repo.settings.enable_timetracker"}}</label>
								</div>
							</div>
							<div class="field {{if not (.Repository.IsTimetrackerEnabled ctx)}}disabled{{end}}" id="only_contributors">
								<div class="ui checkbox">
									<input name="allow_only_contributors_to_track_time" type="checkbox" {{if .Repository.AllowOnlyContributorsToTrackTime ctx}}checked{{end}}>
									<label>{{ctx.Locale.Tr "repo.settings.allow_only_contributors_to_track_time"}}</label>
								</div>
							</div>
						{{end}}
						<div class="field">
							<div class="ui checkbox">
								<input name="enable_issue_dependencies" type="checkbox" {{if (.Repository.IsDependenciesEnabled ctx)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.issues.dependency.setting"}}</label>
							</div>
						</div>
						<div class="ui checkbox">
							<input name="enable_close_issues_via_commit_in_any_branch" type="checkbox" {{if .Repository.CloseIssuesViaCommitInAnyBranch}}checked{{end}}>
							<label>{{ctx.Locale.Tr "repo.settings.admin_enable_close_issues_via_commit_in_any_branch"}}</label>
						</div>
						<div class="inline field tw-mt-2">
							<label>{{ctx.Locale.Tr "repo.settings.unit_visibility"}}</label>
							<select name="issues_visibility" class="ui dropdown">
								<option value="not-set" {{if not (eq (.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeIssues).AnonymousAccessMode 1)}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.unit_visibility_private"}}</option>
								<option value="anonymous-read" {{if eq (.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeIssues).AnonymousAccessMode 1}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.unit_visibility_public"}}</option>
							</select>
						</div>
					</div>
					<div class="field">
						<div class="ui radio checkbox{{if $isExternalTrackerGlobalDisabled}} disabled{{end}}"{{if $isExternalTrackerGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
							<input class="enable-system-radio" name="enable_external_tracker" type="radio" value="true" data-context="#internal_issue_box" data-target="#external_issue_box" {{if .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeExternalTracker}}checked{{end}}>
							<label>{{ctx.Locale.Tr "repo.settings.use_external_issue_tracker"}}</label>
						</div>
					</div>
					<div class="field tw-pl-4 {{if not (.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeExternalTracker)}}disabled{{end}}" id="external_issue_box">
						<div class="field">
							<label for="external_tracker_url">{{ctx.Locale.Tr "repo.settings.external_tracker_url"}}</label>
							<input id="external_tracker_url" name="external_tracker_url" type="url" value="{{(.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerURL}}">
							<p class="help">{{ctx.Locale.Tr "repo.settings.external_tracker_url_desc"}}</p>
						</div>
						<div class="field">
							<label for="tracker_url_format">{{ctx.Locale.Tr "repo.settings.tracker_url_format"}}</label>
							<input id="tracker_url_format" name="tracker_url_format" type="url" value="{{(.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerFormat}}" placeholder="https://github.com/{user}/{repo}/issues/{index}">
							<p class="help">{{ctx.Locale.Tr "repo.settings.tracker_url_format_desc"}}</p>
						</div>
						<div class="inline fields">
							<label for="issue_style">{{ctx.Locale.Tr "repo.settings.tracker_issue_style"}}</label>
							<div class="field">
								<div class="ui radio checkbox">
								{{$externalTracker := (.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeExternalTracker)}}
								{{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}}
									<input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="numeric" {{if eq $externalTrackerStyle "numeric"}}checked{{end}}>
									<label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.numeric"}} <span class="ui light grey text">#1234</span></label>
								</div>
							</div>
							<div class="field">
								<div class="ui radio checkbox">
									<input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="alphanumeric" {{if eq $externalTrackerStyle "alphanumeric"}}checked{{end}}>
									<label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.alphanumeric"}} <span class="ui light grey text">ABC-123 , DEFG-234</span></label>
								</div>
							</div>
							<div class="field">
								<div class="ui radio checkbox">
									<input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="regexp" {{if eq $externalTrackerStyle "regexp"}}checked{{end}}>
									<label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp"}} <span class="ui light grey text">(ISSUE-\d+) , ISSUE-(\d+)</span></label>
								</div>
							</div>
						</div>
						<div class="field {{if ne $externalTrackerStyle "regexp"}}disabled{{end}}" id="tracker-issue-style-regex-box">
							<label for="external_tracker_regexp_pattern">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern"}}</label>
							<input id="external_tracker_regexp_pattern" name="external_tracker_regexp_pattern" value="{{(.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerRegexpPattern}}">
							<p class="help">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc"}}</p>
						</div>
					</div>
				</div>

				{{/* ── Projects ── */}}
				<h5 class="ui dividing header tw-flex tw-items-center tw-gap-2">{{svg "octicon-project" 16}} {{ctx.Locale.Tr "repo.projects"}}</h5>
				{{$isProjectsEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeProjects}}
				{{$isProjectsGlobalDisabled := ctx.Consts.RepoUnitTypeProjects.UnitGlobalDisabled}}
				{{$projectsUnit := .Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeProjects}}
				<div class="inline field">
					<div class="ui checkbox{{if $isProjectsGlobalDisabled}} disabled{{end}}"{{if $isProjectsGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
						<input class="enable-system" name="enable_projects" type="checkbox" data-target="#projects_box" {{if $isProjectsEnabled}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.settings.projects_desc"}}</label>
					</div>
				</div>
				<div class="field {{if not $isProjectsEnabled}} disabled{{end}} tw-pl-4" id="projects_box">
					<p>
						{{ctx.Locale.Tr "repo.settings.projects_mode_desc"}}
					</p>
					<div class="ui dropdown selection">
						<select name="projects_mode">
							<option value="repo" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.GetProjectsMode "repo")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_repo"}}</option>
							<option value="owner" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.GetProjectsMode "owner")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_owner"}}</option>
							<option value="all" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.GetProjectsMode "all")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_all"}}</option>
						</select>
						{{svg "octicon-triangle-down" 14 "dropdown icon"}}
						<div class="default text">
							{{if (eq $projectsUnit.ProjectsConfig.GetProjectsMode "repo")}}
								{{ctx.Locale.Tr "repo.settings.projects_mode_repo"}}
							{{end}}
							{{if (eq $projectsUnit.ProjectsConfig.GetProjectsMode "owner")}}
								{{ctx.Locale.Tr "repo.settings.projects_mode_owner"}}
							{{end}}
							{{if (eq $projectsUnit.ProjectsConfig.GetProjectsMode "all")}}
								{{ctx.Locale.Tr "repo.settings.projects_mode_all"}}
							{{end}}
						</div>
						<div class="menu">
							<div class="item" data-value="repo">{{ctx.Locale.Tr "repo.settings.projects_mode_repo"}}</div>
							<div class="item" data-value="owner">{{ctx.Locale.Tr "repo.settings.projects_mode_owner"}}</div>
							<div class="item" data-value="all">{{ctx.Locale.Tr "repo.settings.projects_mode_all"}}</div>
						</div>
					</div>
				</div>

				{{/* ── Releases ── */}}
				<h5 class="ui dividing header tw-flex tw-items-center tw-gap-2">{{svg "octicon-tag" 16}} {{ctx.Locale.Tr "repo.releases"}}</h5>
				{{$isReleasesEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeReleases}}
				{{$isReleasesGlobalDisabled := ctx.Consts.RepoUnitTypeReleases.UnitGlobalDisabled}}
				<div class="inline field">
					<div class="ui checkbox{{if $isReleasesGlobalDisabled}} disabled{{end}}"{{if $isReleasesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
						<input class="enable-system" name="enable_releases" type="checkbox" data-target="#releases_visibility_box" {{if $isReleasesEnabled}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.settings.releases_desc"}}</label>
					</div>
				</div>
				<div class="field tw-pl-4{{if not $isReleasesEnabled}} disabled{{end}}" id="releases_visibility_box">
					<div class="inline field">
						<label>{{ctx.Locale.Tr "repo.settings.unit_visibility"}}</label>
						<select name="releases_visibility" class="ui dropdown">
							<option value="not-set" {{if not (eq (.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeReleases).AnonymousAccessMode 1)}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.unit_visibility_private"}}</option>
							<option value="anonymous-read" {{if eq (.Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeReleases).AnonymousAccessMode 1}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.unit_visibility_public"}}</option>
						</select>
						<p class="help">{{ctx.Locale.Tr "repo.settings.unit_visibility_releases_help"}}</p>
					</div>
				</div>

				{{/* ── Licensing ── */}}
				<h5 class="ui dividing header tw-flex tw-items-center tw-gap-2">{{svg "octicon-broadcast" 16}} {{ctx.Locale.Tr "repo.settings.licensing_section"}}</h5>
				<div class="inline field">
					<div class="ui checkbox">
						<input name="enable_licensing" type="checkbox" {{if .LicensingEnabled}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.settings.enable_licensing"}}</label>
					</div>
				</div>
				<p class="help">{{ctx.Locale.Tr "repo.settings.enable_licensing_help"}}</p>

				{{/* ── Packages ── */}}
				<h5 class="ui dividing header tw-flex tw-items-center tw-gap-2">{{svg "octicon-package" 16}} {{ctx.Locale.Tr "repo.packages"}}</h5>
				{{$isPackagesEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypePackages}}
				{{$isPackagesGlobalDisabled := ctx.Consts.RepoUnitTypePackages.UnitGlobalDisabled}}
				<div class="inline field">
					<div class="ui checkbox{{if $isPackagesGlobalDisabled}} disabled{{end}}"{{if $isPackagesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
						<input class="enable-system" name="enable_packages" type="checkbox" {{if $isPackagesEnabled}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.settings.packages_desc"}}</label>
					</div>
				</div>

				{{if not .IsMirror}}
				{{/* ── Pull Requests ── */}}
				<h5 class="ui dividing header tw-flex tw-items-center tw-gap-2">{{svg "octicon-git-pull-request" 16}} {{ctx.Locale.Tr "repo.pulls"}}</h5>
					{{$pullRequestEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypePullRequests}}
					{{$pullRequestGlobalDisabled := ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled}}
					{{$prUnit := .Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypePullRequests}}
					<div class="inline field">
						<div class="ui checkbox{{if $pullRequestGlobalDisabled}} disabled{{end}}"{{if $pullRequestGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
							<input class="enable-system" name="enable_pulls" type="checkbox" data-target="#pull_box" {{if $pullRequestEnabled}}checked{{end}}>
							<label>{{ctx.Locale.Tr "repo.settings.pulls_desc"}}</label>
						</div>
					</div>
					<div class="field{{if not $pullRequestEnabled}} disabled{{end}}" id="pull_box">
						<div class="field">
							<p>
								{{ctx.Locale.Tr "repo.settings.merge_style_desc"}}
							</p>
						</div>
						<div class="field">
							<div class="ui checkbox">
								<input name="pulls_allow_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowMerge)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</label>
							</div>
						</div>
						<div class="field">
							<div class="ui checkbox">
								<input name="pulls_allow_rebase" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebase)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</label>
							</div>
						</div>
						<div class="field">
							<div class="ui checkbox">
								<input name="pulls_allow_rebase_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseMerge)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</label>
							</div>
						</div>
						<div class="field">
							<div class="ui checkbox">
								<input name="pulls_allow_squash" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowSquash)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</label>
							</div>
						</div>
						<div class="field">
							<div class="ui checkbox">
								<input name="pulls_allow_fast_forward_only" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowFastForwardOnly)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</label>
							</div>
						</div>
						<div class="field">
							<div class="ui checkbox">
								<input name="pulls_allow_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowManualMerge)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.pulls.merge_manually"}}</label>
							</div>
						</div>
						<div class="field">
							<p>
								{{ctx.Locale.Tr "repo.settings.default_merge_style_desc"}}
							</p>
							<div class="ui dropdown selection">
								<select name="pulls_default_merge_style">
									<option value="merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</option>
									<option value="rebase" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</option>
									<option value="rebase-merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</option>
									<option value="squash" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</option>
									<option value="fast-forward-only" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "fast-forward-only")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</option>
								</select>{{svg "octicon-triangle-down" 14 "dropdown icon"}}
								<div class="default text">
									{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}
										{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}
									{{end}}
									{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}
										{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}
									{{end}}
									{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}}
										{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}
									{{end}}
									{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}}
										{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}
									{{end}}
									{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "fast-forward-only")}}
										{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}
									{{end}}
								</div>
								<div class="menu">
									<div class="item" data-value="merge">{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</div>
									<div class="item" data-value="rebase">{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</div>
									<div class="item" data-value="rebase-merge">{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</div>
									<div class="item" data-value="squash">{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</div>
									<div class="item" data-value="fast-forward-only">{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</div>
								</div>
							</div>
						</div>
						<div class="field">
							<label>{{ctx.Locale.Tr "repo.settings.pulls.default_target_branch"}}</label>
							<div class="ui search selection dropdown">
								<input type="hidden" name="default_target_branch" value="{{$prUnit.PullRequestsConfig.DefaultTargetBranch}}">
								<div class="default text"></div>
								{{svg "octicon-triangle-down" 14 "dropdown icon"}}
								<div class="menu">
									<div class="item" data-value="">{{ctx.Locale.Tr "repo.settings.pulls.default_target_branch_default" $.Repository.DefaultBranch}}</div>
									{{range $branchName := $.Branches}}
										<div class="item" data-value="{{$branchName}}">{{$branchName}}</div>
									{{end}}
								</div>
							</div>
						</div>
						<div class="field">
							<div class="ui checkbox">
								<input name="default_allow_maintainer_edit" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultAllowMaintainerEdit)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.settings.pulls.default_allow_edits_from_maintainers"}}</label>
							</div>
						</div>
						<div class="field">
							<div class="ui checkbox">
								<input name="pulls_allow_rebase_update" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseUpdate)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.settings.pulls.allow_rebase_update"}}</label>
							</div>
						</div>
						<div class="field">
							<div class="ui checkbox">
								<input name="default_delete_branch_after_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.settings.pulls.default_delete_branch_after_merge"}}</label>
							</div>
						</div>
						<div class="field">
							<div class="ui checkbox">
								<input name="enable_autodetect_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AutodetectManualMerge)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.settings.pulls.enable_autodetect_manual_merge"}}</label>
							</div>
						</div>
						<div class="field">
							<div class="ui checkbox">
								<input name="pulls_ignore_whitespace" type="checkbox" {{if and $pullRequestEnabled ($prUnit.PullRequestsConfig.IgnoreWhitespaceConflicts)}}checked{{end}}>
								<label>{{ctx.Locale.Tr "repo.settings.pulls.ignore_whitespace"}}</label>
							</div>
						</div>
					</div>
				{{end}}

				<div class="field tw-mt-4">
					<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
				</div>
			</form>
		</div>
	</div>
{{template "repo/settings/layout_footer" .}}
