<defs>
  <linearGradient id="mcmBlue" x1="0" y1="1" x2="0" y2="0">
    <stop stop-color="#93C5FD"/>
    <stop offset="1" stop-color="#2563EB"/>
  </linearGradient>
  <linearGradient id="mcmGray" x1="0" y1="1" x2="0" y2="0">
    <stop stop-color="#E2E8F0"/>
    <stop offset="1" stop-color="#94A3B8"/>
  </linearGradient>
  <linearGradient id="mcmYellow" x1="0" y1="1" x2="0" y2="0">
    <stop stop-color="#FEF08A"/>
    <stop offset="1" stop-color="#EAB308"/>
  </linearGradient>
  <linearGradient id="mcmOrange" x1="0" y1="1" x2="0" y2="0">
    <stop stop-color="#FDBA74"/>
    <stop offset="1" stop-color="#EA580C"/>
  </linearGradient>
  <linearGradient id="mcmRose" x1="0" y1="1" x2="0" y2="0">
    <stop stop-color="#FDA4AF"/>
    <stop offset="1" stop-color="#E11D48"/>
  </linearGradient>
  <filter id="mcmMainBaselineModifying" x="134" y="461" width="74" height="7" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
    <feFlood flood-opacity="0" result="BackgroundImageFix"/>
    <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
    <feOffset dx="1"/>
    <feGaussianBlur stdDeviation="1.5"/>
    <feComposite in2="hardAlpha" operator="out"/>
    <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"/>
    <feBlend mode="normal" in2="BackgroundImageFix" result="effect1"/>
    <feBlend mode="normal" in="SourceGraphic" in2="effect1" result="shape"/>
  </filter>
  <filter id="mcmMainBaselinePersonality" x="266" y="461" width="330" height="7" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
    <feFlood flood-opacity="0" result="BackgroundImageFix"/>
    <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
    <feOffset dx="1"/>
    <feGaussianBlur stdDeviation="1.5"/>
    <feComposite in2="hardAlpha" operator="out"/>
    <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"/>
    <feBlend mode="normal" in2="BackgroundImageFix" result="effect1"/>
    <feBlend mode="normal" in="SourceGraphic" in2="effect1" result="shape"/>
  </filter>
  <filter id="mcmMainBaselineClinical" x="662" y="461" width="230" height="7" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
    <feFlood flood-opacity="0" result="BackgroundImageFix"/>
    <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
    <feOffset dx="1"/>
    <feGaussianBlur stdDeviation="1.5"/>
    <feComposite in2="hardAlpha" operator="out"/>
    <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"/>
    <feBlend mode="normal" in2="BackgroundImageFix" result="effect1"/>
    <feBlend mode="normal" in="SourceGraphic" in2="effect1" result="shape"/>
  </filter>
</defs>

<g transform="translate({{spec.profile.padding.[0].x}}, {{spec.profile.padding.[0].y}})">
  <g>
    {{bar 32 120 (object tl=4 bl=0 tr=4 br=0) (toRad 0) fill="#F1F5F9"}}
    <path d="M0.5 120V4A3.5 3.5 0 0 1 4 0.5H28A3.5 3.5 0 0 1 31.5 4V120" fill="none" stroke="#E2E8F0"/>
    <text x="16" y="60" transform="rotate(-90 16 60)" font-size="12" fill="#334155" text-anchor="middle" dy=".35em">کدهای برافراشته</text>
    {{#each highPoints as |code index|}}
      <g transform="translate(0, {{math 124 '+' (math index '*' 36)}})">
        <rect width="32" height="32" rx="2" fill="#EFF6FF"/>
        <text class="eng-font" x="16" y="16" transform="rotate(-90 16 16)" direction="ltr" font-size="12" fill="#1E40AF" text-anchor="middle" dy=".3em">{{code}}</text>
      </g>
    {{/each}}

    <g transform="translate(40, 0)">
      {{bar 32 120 (object tl=4 bl=0 tr=4 br=0) (toRad 0) fill="#F1F5F9"}}
      <path d="M0.5 120V4A3.5 3.5 0 0 1 4 0.5H28A3.5 3.5 0 0 1 31.5 4V120" fill="none" stroke="#E2E8F0"/>
      <text x="16" y="60" transform="rotate(-90 16 60)" font-size="12" fill="#334155" text-anchor="middle" dy=".35em">تعدیل نمرات BR</text>
      <g transform="translate(0, 124)">
        <rect width="32" height="{{correction.bodyHeight}}" rx="2" fill="{{correction.background}}"/>
        {{#if correction.valid}}
          <path d="M8 12.667L11.333 9.334L4.667 2.667" transform="translate(8, 16)" fill="none" stroke="{{correction.color}}" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
        {{else}}
          <path d="M12 20L20 28M20 20L12 28" fill="none" stroke="{{correction.color}}" stroke-width="1.4" stroke-linecap="round"/>
        {{/if}}
        <text x="16" y="36" transform="rotate(-90 16 36)" font-size="12" fill="{{correction.color}}" text-anchor="start" dy=".35em">{{correction.text}}</text>
      </g>
    </g>

    <g transform="translate(0, 392)">
      {{bar 32 150 (object tl=4 bl=0 tr=4 br=0) (toRad 0) fill="#F1F5F9"}}
      <path d="M0.5 150V4A3.5 3.5 0 0 1 4 0.5H28A3.5 3.5 0 0 1 31.5 4V150" fill="none" stroke="#E2E8F0"/>
      <text x="16" y="75" transform="rotate(-90 16 75)" font-size="12" fill="#334155" text-anchor="middle" dy=".35em">شاخص عدم اعتبار ( V )</text>
      <g transform="translate(0, 154)">
        <rect width="32" height="160" rx="2" fill="{{validityV.background}}"/>
        <text x="16" y="{{validityV.rawY}}" transform="rotate(-90 16 {{validityV.rawY}})" font-size="18" font-weight="500" fill="{{validityV.color}}" text-anchor="middle" dy=".35em">{{validityV.raw}}</text>
        <text x="16" y="{{validityV.equalsY}}" transform="rotate(-90 16 {{validityV.equalsY}})" font-size="14" fill="{{validityV.color}}" text-anchor="middle" dy=".35em">=</text>
        <text x="16" y="{{validityV.reportY}}" transform="rotate(-90 16 {{validityV.reportY}})" font-size="13" fill="{{validityV.color}}" text-anchor="middle" dy=".35em">{{validityV.text}}</text>
      </g>
    </g>

    <g transform="translate(40, 392)">
      {{bar 32 150 (object tl=4 bl=0 tr=4 br=0) (toRad 0) fill="#F1F5F9"}}
      <path d="M0.5 150V4A3.5 3.5 0 0 1 4 0.5H28A3.5 3.5 0 0 1 31.5 4V150" fill="none" stroke="#E2E8F0"/>
      <text x="16" y="75" transform="rotate(-90 16 75)" font-size="12" fill="#334155" text-anchor="middle" dy=".35em">شاخص ناهمسانی ( W )</text>
      <g transform="translate(0, 154)">
        <rect width="32" height="160" rx="2" fill="{{validityW.background}}"/>
        <text x="16" y="{{validityW.rawY}}" transform="rotate(-90 16 {{validityW.rawY}})" font-size="18" font-weight="500" fill="{{validityW.color}}" text-anchor="middle" dy=".35em">{{validityW.raw}}</text>
        <text x="16" y="{{validityW.equalsY}}" transform="rotate(-90 16 {{validityW.equalsY}})" font-size="14" fill="{{validityW.color}}" text-anchor="middle" dy=".35em">=</text>
        <text x="16" y="{{validityW.reportY}}" transform="rotate(-90 16 {{validityW.reportY}})" font-size="13" fill="{{validityW.color}}" text-anchor="middle" dy=".35em">{{validityW.text}}</text>
      </g>
    </g>
  </g>

  <rect x="96" width="1" height="706" fill="#E2E8F0"/>

  <g>
    {{#each modifying as |item|}}
      <g transform="translate({{item.x}}, 64)">
        {{bar 12 400 (object tl=2 bl=0 tr=2 br=0) (toRad 0) fill=item.theme.track}}
      </g>
    {{/each}}
    <line x1="136.5" y1="64.5" x2="203.5" y2="64.5" stroke="#E5E7EB" stroke-linecap="round" stroke-dasharray="6 6"/>
    <line x1="136.5" y1="164.5" x2="203.5" y2="164.5" stroke="#E5E7EB" stroke-linecap="round" stroke-dasharray="6 6"/>
    <line x1="136.5" y1="324.5" x2="203.5" y2="324.5" stroke="#E5E7EB" stroke-linecap="round" stroke-dasharray="6 6"/>

    <text x="129" y="65" transform="rotate(-90 129 65)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="end">100</text>
    <text x="129" y="165" transform="rotate(-90 129 165)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="middle">75</text>
    <text x="129" y="325" transform="rotate(-90 129 325)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="middle">35</text>
    <text x="129" y="456" transform="rotate(-90 129 456)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="middle">BR</text>
    <text x="129" y="115" transform="rotate(-90 129 115)" font-size="10" fill="#6B7280" text-anchor="middle">بالا</text>
    <text x="129" y="244" transform="rotate(-90 129 244)" font-size="10" fill="#6B7280" text-anchor="middle">متوسط</text>
    <text x="129" y="384" transform="rotate(-90 129 384)" font-size="10" fill="#6B7280" text-anchor="middle">پایین</text>
    <text x="129" y="0" transform="rotate(-90 129 0)" font-size="12" fill="#9CA3AF" text-anchor="start">نمره خام</text>
    <path d="M122.5 51H129.5M126.5 54L129.5 51L126.5 48" fill="none" stroke="#9CA3AF" stroke-width="0.75" stroke-linecap="round" stroke-linejoin="round"/>
    {{#if showDisclosureAlert}}
      <path d="M148.99 6.49986H151.291M153.016 6.49986V6.49408M145.879 7.44568L153.663 12.1291C153.83 12.2257 154.018 12.2768 154.211 12.2773C154.403 12.2779 154.592 12.2279 154.759 12.1323C154.926 12.0367 155.065 11.8989 155.162 11.7325C155.26 11.5661 155.312 11.377 155.315 11.1839V1.81581C155.312 1.62284 155.26 1.4338 155.162 1.2675C155.065 1.10119 154.926 0.963405 154.759 0.867832C154.592 0.772258 154.403 0.722225 154.211 0.722705C154.019 0.723185 153.83 0.774162 153.664 0.870569L145.878 5.55403C145.717 5.65257 145.583 5.79138 145.49 5.95706C145.397 6.12274 145.348 6.30969 145.348 6.49986C145.348 6.69002 145.397 6.87697 145.49 7.04265C145.583 7.20833 145.717 7.34714 145.878 7.44568H145.879Z" fill="none" stroke="#B91C1C" stroke-linecap="round" stroke-linejoin="round"/>
    {{/if}}

    {{#each modifying as |item|}}
      {{#if item.barHeight}}
        <g transform="translate({{item.x}}, {{item.barTop}})" fill="url(#{{item.theme.gradient}})">
          {{bar 12 item.barHeight (object tl=2 bl=0 tr=2 br=0) (toRad 0)}}
        </g>
      {{/if}}
      <text x="{{item.center}}" y="{{item.scoreY}}" transform="rotate(-90 {{item.center}} {{item.scoreY}})" direction="ltr" font-size="12" font-weight="500" fill="{{ternary item.inside 'white' item.theme.dark}}" text-anchor="{{item.scoreAnchor}}" dy=".35em">{{item.br}}</text>
      <rect x="{{item.x}}" y="19" width="12" height="36" rx="2" fill="{{item.theme.track}}"/>
      <text x="{{item.center}}" y="37" transform="rotate(-90 {{item.center}} 37)" direction="ltr" font-size="12" fill="{{item.theme.dark}}" text-anchor="middle" dy=".35em">{{item.raw}}</text>
      {{> MCMI9A_vertical_label center=item.center code=item.code fa=item.fa}}
    {{/each}}
    <g opacity="0.5" filter="url(#mcmMainBaselineModifying)">
      <line x1="136.5" y1="464.5" x2="203.5" y2="464.5" stroke="white" stroke-linecap="round"/>
    </g>
  </g>

  <g>
    {{#each personality as |item|}}
      <g transform="translate({{item.x}}, 64)">
        {{bar 12 400 (object tl=2 bl=0 tr=2 br=0) (toRad 0) fill=item.theme.track}}
      </g>
    {{/each}}
    <line x1="268.5" y1="64.5" x2="591.5" y2="64.5" stroke="#E5E7EB" stroke-linecap="round" stroke-dasharray="6 6"/>
    <line x1="268.5" y1="169.5" x2="591.5" y2="169.5" stroke="#E5E7EB" stroke-linecap="round" stroke-dasharray="6 6"/>
    <line x1="268.5" y1="269.5" x2="591.5" y2="269.5" stroke="#E5E7EB" stroke-linecap="round" stroke-dasharray="6 6"/>
    <line x1="268.5" y1="374.5" x2="591.5" y2="374.5" stroke="#E5E7EB" stroke-linecap="round" stroke-dasharray="6 6"/>

    <text x="261" y="65" transform="rotate(-90 261 65)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="end">115</text>
    <text x="261" y="170" transform="rotate(-90 261 170)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="middle">85</text>
    <text x="261" y="270" transform="rotate(-90 261 270)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="middle">75</text>
    <text x="261" y="375" transform="rotate(-90 261 375)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="middle">60</text>
    <text x="261" y="456" transform="rotate(-90 261 456)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="middle">BR</text>
    <text x="261" y="0" transform="rotate(-90 261 0)" font-size="12" fill="#9CA3AF" text-anchor="start">نمره خام</text>
    <path d="M254.5 51H261.5M258.5 54L261.5 51L258.5 48" fill="none" stroke="#9CA3AF" stroke-width="0.75" stroke-linecap="round" stroke-linejoin="round"/>
    <g transform="translate(250, 116) rotate(-90)">
      <text x="0" y="-6" font-size="10" fill="#E11D48" text-anchor="middle">اختلال</text>
      <text x="0" y="8" font-size="10" fill="#E11D48" text-anchor="middle">شخصیت</text>
    </g>
    <g transform="translate(250, 220) rotate(-90)">
      <text x="0" y="-6" font-size="10" fill="#EA580C" text-anchor="middle">تیپ</text>
      <text x="0" y="8" font-size="10" fill="#EA580C" text-anchor="middle">شخصیتی</text>
    </g>
    <g transform="translate(250, 321) rotate(-90)">
      <text x="0" y="-6" font-size="10" fill="#EAB308" text-anchor="middle">سبک</text>
      <text x="0" y="8" font-size="10" fill="#EAB308" text-anchor="middle">شخصیتی</text>
    </g>

    {{#each personality as |item|}}
      {{#if item.barHeight}}
        <g transform="translate({{item.x}}, {{item.barTop}})" fill="url(#{{item.theme.gradient}})">
          {{bar 12 item.barHeight (object tl=2 bl=0 tr=2 br=0) (toRad 0)}}
        </g>
      {{/if}}
      <text x="{{item.center}}" y="{{item.scoreY}}" transform="rotate(-90 {{item.center}} {{item.scoreY}})" direction="ltr" font-size="12" font-weight="500" fill="{{ternary item.inside 'white' item.theme.dark}}" text-anchor="{{item.scoreAnchor}}" dy=".35em">{{item.br}}</text>
      <rect x="{{item.x}}" y="19" width="12" height="36" rx="2" fill="{{item.theme.track}}"/>
      <text x="{{item.center}}" y="37" transform="rotate(-90 {{item.center}} 37)" direction="ltr" font-size="12" fill="{{item.theme.dark}}" text-anchor="middle" dy=".35em">{{item.raw}}</text>
      {{> MCMI9A_vertical_label center=item.center code=item.code fa=item.fa}}
    {{/each}}
    <g opacity="0.5" filter="url(#mcmMainBaselinePersonality)">
      <line x1="268.5" y1="464.5" x2="591.5" y2="464.5" stroke="white" stroke-linecap="round"/>
    </g>
  </g>

  <g>
    {{#each clinical as |item|}}
      <g transform="translate({{item.x}}, 64)">
        {{bar 12 400 (object tl=2 bl=0 tr=2 br=0) (toRad 0) fill=item.theme.track}}
      </g>
    {{/each}}
    <line x1="664.5" y1="64.5" x2="887.5" y2="64.5" stroke="#E5E7EB" stroke-linecap="round" stroke-dasharray="6 6"/>
    <line x1="664.5" y1="169.5" x2="887.5" y2="169.5" stroke="#E5E7EB" stroke-linecap="round" stroke-dasharray="6 6"/>
    <line x1="664.5" y1="269.5" x2="887.5" y2="269.5" stroke="#E5E7EB" stroke-linecap="round" stroke-dasharray="6 6"/>

    <text x="657" y="65" transform="rotate(-90 657 65)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="end">115</text>
    <text x="657" y="170" transform="rotate(-90 657 170)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="middle">85</text>
    <text x="657" y="270" transform="rotate(-90 657 270)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="middle">75</text>
    <text x="657" y="456" transform="rotate(-90 657 456)" direction="ltr" font-size="12" fill="#9CA3AF" text-anchor="middle">BR</text>
    <text x="657" y="0" transform="rotate(-90 657 0)" font-size="12" fill="#9CA3AF" text-anchor="start">نمره خام</text>
    <path d="M650.5 51H657.5M654.5 54L657.5 51L654.5 48" fill="none" stroke="#9CA3AF" stroke-width="0.75" stroke-linecap="round" stroke-linejoin="round"/>
    <g transform="translate(646, 115) rotate(-90)">
      <text x="0" y="-6" font-size="10" fill="#E11D48" text-anchor="middle">غالب بودن</text>
      <text x="0" y="8" font-size="10" fill="#E11D48" text-anchor="middle">مشکل</text>
    </g>
    <g transform="translate(646, 220) rotate(-90)">
      <text x="0" y="-6" font-size="10" fill="#EA580C" text-anchor="middle">وجود</text>
      <text x="0" y="8" font-size="10" fill="#EA580C" text-anchor="middle">مشکل</text>
    </g>

    {{#each clinical as |item|}}
      {{#if item.barHeight}}
        <g transform="translate({{item.x}}, {{item.barTop}})" fill="url(#{{item.theme.gradient}})">
          {{bar 12 item.barHeight (object tl=2 bl=0 tr=2 br=0) (toRad 0)}}
        </g>
      {{/if}}
      <text x="{{item.center}}" y="{{item.scoreY}}" transform="rotate(-90 {{item.center}} {{item.scoreY}})" direction="ltr" font-size="12" font-weight="500" fill="{{ternary item.inside 'white' item.theme.dark}}" text-anchor="{{item.scoreAnchor}}" dy=".35em">{{item.br}}</text>
      <rect x="{{item.x}}" y="19" width="12" height="36" rx="2" fill="{{item.theme.track}}"/>
      <text x="{{item.center}}" y="37" transform="rotate(-90 {{item.center}} 37)" direction="ltr" font-size="12" fill="{{item.theme.dark}}" text-anchor="middle" dy=".35em">{{item.raw}}</text>
      {{> MCMI9A_vertical_label center=item.center code=item.code fa=item.fa}}
    {{/each}}
    <g opacity="0.5" filter="url(#mcmMainBaselineClinical)">
      <line x1="664.5" y1="464.5" x2="887.5" y2="464.5" stroke="white" stroke-linecap="round"/>
    </g>
  </g>

  <g>
    <rect x="130.5" y="658.5" width="79" height="47" rx="4" fill="#F9FAFB" stroke="#F3F4F6"/>
    <g transform="rotate(180 170 682)">
      <text x="170" y="674.2" dy=".3em" font-size="13" fill="#4B5563" text-anchor="middle">شاخص‌های</text>
      <text x="170" y="689.8" dy=".3em" font-size="13" fill="#4B5563" text-anchor="middle">اصلاح</text>
    </g>

    <rect x="268.5" y="620.5" width="247" height="31" rx="4" fill="none" stroke="#E5E7EB"/>
    <text x="392" y="636" transform="rotate(180 392 636)" dy=".3em" font-size="10" fill="#4B5563" text-anchor="middle">الگوهای بالینی شخصیت</text>
    <rect x="522.5" y="620.5" width="69" height="31" rx="4" fill="none" stroke="#E5E7EB"/>
    <g transform="rotate(180 557 636)">
      <text x="557" y="630.5" dy=".3em" font-size="10" fill="#4B5563" text-anchor="middle">آسیب‌شناسی</text>
      <text x="557" y="641.5" dy=".3em" font-size="10" fill="#4B5563" text-anchor="middle">شدید شخصیت</text>
    </g>
    <rect x="268.5" y="658.5" width="323" height="47" rx="4" fill="#F9FAFB" stroke="#F3F4F6"/>
    <text x="430" y="682" transform="rotate(180 430 682)" dy=".3em" font-size="13" fill="#4B5563" text-anchor="middle">مقیاس‌های شخصیت</text>

    <rect x="664.5" y="620.5" width="148" height="31" rx="4" fill="none" stroke="#E5E7EB"/>
    <text x="738.5" y="636" transform="rotate(180 738.5 636)" dy=".3em" font-size="10" fill="#4B5563" text-anchor="middle">مجموعه نشانگان بالینی</text>
    <rect x="819.5" y="620.5" width="68" height="31" rx="4" fill="none" stroke="#E5E7EB"/>
    <g transform="rotate(180 853.5 636)">
      <text x="853.5" y="630.5" dy=".3em" font-size="10" fill="#4B5563" text-anchor="middle">نشانگان</text>
      <text x="853.5" y="641.5" dy=".3em" font-size="10" fill="#4B5563" text-anchor="middle">شدید بالینی</text>
    </g>
    <rect x="664.5" y="658.5" width="223" height="47" rx="4" fill="#F9FAFB" stroke="#F3F4F6"/>
    <text x="776" y="682" transform="rotate(180 776 682)" dy=".3em" font-size="13" fill="#4B5563" text-anchor="middle">مقیاس‌های آسیب‌شناسی</text>
  </g>
</g>
