Files
javier 2b01ec14bf Overall improvements and data update (#22)
This PR contains the work done to update the live tests to the latest data plus lots of QoL improvements to the library, including:

* added test cases to test the ``AmiiboService` locally;
* conformed the models to the `Hashable` protocol;
* documented the use of caching with the `AmiiboService` service;
* updated the reference to the new AmiiboAPI url;
* updated the year on the copyrights and header files;
* updated the overall documentation of the source code and the package.

Reviewed-on: #22
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2026-03-22 23:39:48 +00:00

10 lines
59 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*!
* This source file is part of the Swift.org open source project
*
* Copyright (c) 2021 Apple Inc. and the Swift project authors
* Licensed under Apache License v2.0 with Runtime Library Exception
*
* See https://swift.org/LICENSE.txt for license information
* See https://swift.org/CONTRIBUTORS.txt for Swift project authors
*/
"use strict";(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[52],{734:function(e,t,n){n.d(t,{A:function(){return c}});var s=function(){var e=this,t=e._self._c;return t("router-link",{staticClass:"nav-title-content",attrs:{to:e.to}},[t("span",{staticClass:"title"},[e._t("default")],2),t("span",{staticClass:"subhead"},[e._v(" "),e._t("subhead")],2)])},i=[],r={name:"NavTitleContainer",props:{to:{type:[String,Object],required:!0}}},o=r,a=n(1656),l=(0,a.A)(o,s,i,!1,null,"854b4dd6",null),c=l.exports},1168:function(e,t,n){n.d(t,{A:function(){return u}});var s=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"download-icon",attrs:{viewBox:"0 0 14 14",themeId:"download"}},[t("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5s2.91-6.5 6.5-6.5zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5s-2.462-5.5-5.5-5.5z"}}),t("path",{attrs:{d:"M7.51 2.964l-0.001 5.431 1.308-2.041 0.842 0.539-2.664 4.162-2.633-4.164 0.845-0.534 1.303 2.059 0.001-5.452z"}})])},i=[],r=n(6515),o={name:"DownloadIcon",components:{SVGIcon:r.A}},a=o,l=n(1656),c=(0,l.A)(a,s,i,!1,null,null,null),u=c.exports},8730:function(e,t,n){n.r(t),n.d(t,{default:function(){return Zi}});var s=function(){var e=this,t=e._self._c;return t("div",[e.topicData?t(e.componentFor(e.topicData),e._b({key:e.topicKey,tag:"component",attrs:{hierarchy:e.hierarchy}},"component",e.propsFor(e.topicData),!1)):e._e()],1)},i=[],r=n(8213),o=n(1836),a=(n(4114),n(8111),n(1701),n(7633));const{BreakpointName:l}=a.A.constants;var c,u,d={state:{linkableSections:[],breakpoint:l.large,references:{}},addLinkableSection(e){const t={...e,visibility:0};t.sectionNumber=this.state.linkableSections.length,this.state.linkableSections.push(t)},reset(){this.state.linkableSections=[],this.state.breakpoint=l.large,this.state.references={}},updateLinkableSection(e){this.state.linkableSections=this.state.linkableSections.map(t=>e.anchor===t.anchor?{...t,visibility:e.visibility}:t)},updateBreakpoint(e){this.state.breakpoint=e},setReferences(e){this.state.references=e}},p=function(){var e=this,t=e._self._c;return t("div",{staticClass:"article"},[e.isTargetIDE?e._e():t("NavigationBar",{attrs:{chapters:e.hierarchy.modules,technology:e.metadata.category,topic:e.heroTitle||"",rootReference:e.hierarchy.reference,identifierUrl:e.identifierUrl}}),t("main",{attrs:{id:"app-main",tabindex:"0"}},[e._t("above-hero"),e._l(e.sections,function(n,s){return t(e.componentFor(n),e._b({key:s,tag:"component"},"component",e.propsFor(n),!1))})],2),t("PortalTarget",{attrs:{name:"modal-destination",multiple:""}})],1)},h=[],m=(n(1148),n(116),n(2197)),v=n(8964),f=function(){var e=this,t=e._self._c;return t("NavBase",{attrs:{id:"nav","aria-label":e.technology,hasSolidBackground:""},scopedSlots:e._u([{key:"default",fn:function(){return[t("ReferenceUrlProvider",{attrs:{reference:e.rootReference},scopedSlots:e._u([{key:"default",fn:function({urlWithParams:n}){return[t("NavTitleContainer",{attrs:{to:n},scopedSlots:e._u([{key:"default",fn:function(){return[e._v(e._s(e.technology))]},proxy:!0},{key:"subhead",fn:function(){return[e._v(e._s(e.$tc("tutorials.title",2)))]},proxy:!0}],null,!0)})]}}])})]},proxy:!0},{key:"after-title",fn:function(){return[t("div",{staticClass:"separator"})]},proxy:!0},{key:"tray",fn:function(){return[t("div",{staticClass:"mobile-dropdown-container"},[t("MobileDropdown",{attrs:{options:e.chapters,sections:e.optionsForSections,currentOption:e.currentSection?e.currentSection.title:""},on:{"select-section":e.onSelectSection}})],1),t("div",{staticClass:"dropdown-container"},[t("PrimaryDropdown",{staticClass:"primary-dropdown",attrs:{options:e.chapters,currentOption:e.topic}}),t("ChevronIcon",{staticClass:"icon-inline"}),e.currentSection?t("SecondaryDropdown",{staticClass:"secondary-dropdown",attrs:{options:e.optionsForSections,currentOption:e.currentSection.title,sectionTracker:e.sectionIndicatorText},on:{"select-section":e.onSelectSection}}):e._e()],1),e._t("tray",null,{siblings:e.chapters.length+e.optionsForSections.length})]},proxy:!0}],null,!0)})},g=[],y=(n(8237),function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"chevron-icon",attrs:{viewBox:"0 0 14 14",themeId:"chevron"}},[t("path",{attrs:{d:"M3.22 1.184l0.325-0.38 7.235 6.201-7.235 6.19-0.325-0.38 6.792-5.811-6.792-5.82z"}})])}),C=[],b=n(6515),_={name:"ChevronIcon",components:{SVGIcon:b.A}},w=_,A=n(1656),k=(0,A.A)(w,y,C,!1,null,null,null),S=k.exports,x=n(1074),T=n(4783),I={name:"ReferenceUrlProvider",mixins:[T.A],props:{reference:{type:String,required:!0}},computed:{resolvedReference:({references:e,reference:t})=>e[t]||{},url:({resolvedReference:e})=>e.url,title:({resolvedReference:e})=>e.title},render(){return this.$scopedSlots.default({url:this.url,urlWithParams:(0,x.c$)(this.url,this.$route.query),title:this.title,reference:this.resolvedReference})}},$=I,N=(0,A.A)($,c,u,!1,null,null,null),q=N.exports,P=n(9514),D=n(9065),R=n(734),L=function(){var e=this,t=e._self._c;return t("NavMenuItems",{staticClass:"mobile-dropdown"},e._l(e.options,function(n){return t("ReferenceUrlProvider",{key:n.reference,attrs:{reference:n.reference},scopedSlots:e._u([{key:"default",fn:function({title:s}){return[t("NavMenuItemBase",{staticClass:"chapter-list",attrs:{role:"group"}},[t("p",{staticClass:"chapter-name"},[e._v(e._s(s))]),t("ul",{staticClass:"tutorial-list"},e._l(n.projects,function(n){return t("ReferenceUrlProvider",{key:n.reference,attrs:{reference:n.reference},scopedSlots:e._u([{key:"default",fn:function({url:n,urlWithParams:s,title:i}){return[t("li",{staticClass:"tutorial-list-item"},[t("router-link",{staticClass:"option tutorial",attrs:{to:s,value:i}},[e._v(" "+e._s(i)+" ")]),n===e.$route.path?t("ul",{staticClass:"section-list",attrs:{role:"listbox"}},e._l(e.sections,function(n){return t("li",{key:n.title},[t("router-link",{class:e.classesFor(n),attrs:{to:{path:n.path,query:e.$route.query},value:n.title},nativeOn:{click:function(t){return e.onClick(n)}}},[e._v(" "+e._s(n.title)+" ")])],1)}),0):e._e()],1)]}}],null,!0)})}),1)])]}}],null,!0)})}),1)},O=[],B=n(5273),M=n(4654),F={name:"MobileDropdown",components:{NavMenuItems:M.A,NavMenuItemBase:B.A,ReferenceUrlProvider:q},props:{options:{type:Array,required:!0},currentOption:{type:String,required:!0},sections:{type:Array,required:!1,default:()=>[]}},methods:{classesFor(e){return["option","section",{active:this.currentOption===e.title},this.depthClass(e)]},depthClass(e){const{depth:t=0}=e;return`depth${t}`},onClick(e){this.$emit("select-section",e.path)}}},V=F,j=(0,A.A)(V,L,O,!1,null,"2c27d339",null),E=j.exports,U=function(){var e=this,t=e._self._c;return t("DropdownCustom",{staticClass:"tutorial-dropdown",attrs:{value:e.currentOption,"aria-label":e.$t("tutorials.nav.current",{thing:e.$t("sections.title")}),isSmall:""},scopedSlots:e._u([{key:"toggle-post-content",fn:function(){return[t("span",{staticClass:"section-tracker"},[e._v(e._s(e.sectionTracker))])]},proxy:!0},{key:"default",fn:function({closeAndFocusToggler:n,contentClasses:s,navigateOverOptions:i,OptionClass:r,ActiveOptionClass:o}){return[t("ul",{staticClass:"options",class:s,attrs:{role:"listbox",tabindex:"0"}},e._l(e.options,function(s){return t("router-link",{key:s.title,attrs:{to:{path:s.path,query:e.$route.query},custom:""},scopedSlots:e._u([{key:"default",fn:function({navigate:a}){return[t("li",{class:[r,{[o]:e.currentOption===s.title}],attrs:{value:s.title,"aria-selected":e.currentOption===s.title,"aria-current":e.ariaCurrent(s.title),tabindex:-1},on:{click:function(t){return e.setActive(s,a,n,t)},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.setActive(s,a,n,t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:n.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:n.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),i(t,1))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),i(t,-1))}]}},[e._v(" "+e._s(s.title)+" ")])]}}],null,!0)})}),1)]}}])})},H=[],z=function(){var e=this,t=e._self._c;return t("BaseDropdown",{staticClass:"dropdown-custom",class:{[e.OpenedClass]:e.isOpen,"dropdown-small":e.isSmall},attrs:{value:e.value},scopedSlots:e._u([{key:"dropdown",fn:function({dropdownClasses:n}){return[t("span",{staticClass:"visuallyhidden",attrs:{id:`DropdownLabel_${e._uid}`}},[e._v(e._s(e.ariaLabel))]),t("button",{ref:"dropdownToggle",staticClass:"form-dropdown-toggle",class:n,attrs:{id:`DropdownToggle_${e._uid}`,"aria-labelledby":`DropdownLabel_${e._uid} DropdownToggle_${e._uid}`,"aria-expanded":e.isOpen?"true":"false","aria-haspopup":"true"},on:{click:e.toggleDropdown,keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.preventDefault(),e.openDropdown.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:e.closeAndFocusToggler.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),e.openDropdown.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),e.openDropdown.apply(null,arguments))}]}},[t("span",{staticClass:"form-dropdown-title"},[e._v(e._s(e.value))]),e._t("toggle-post-content")],2)]}},{key:"eyebrow",fn:function(){return[e._t("eyebrow")]},proxy:!0},{key:"after",fn:function(){return[e._t("default",null,null,{value:e.value,isOpen:e.isOpen,contentClasses:["form-dropdown-content",{"is-open":e.isOpen}],closeDropdown:e.closeDropdown,onChangeAction:e.onChangeAction,closeAndFocusToggler:e.closeAndFocusToggler,navigateOverOptions:e.navigateOverOptions,OptionClass:e.OptionClass,ActiveOptionClass:e.ActiveOptionClass})]},proxy:!0}],null,!0)})},G=[],W=function(){var e=this,t=e._self._c;return t("div",{staticClass:"form-element"},[e._t("dropdown",function(){return[t("select",e._b({directives:[{name:"model",rawName:"v-model",value:e.modelValue,expression:"modelValue"}],class:e.dropdownClasses,on:{change:function(t){var n=Array.prototype.filter.call(t.target.options,function(e){return e.selected}).map(function(e){var t="_value"in e?e._value:e.value;return t});e.modelValue=t.target.multiple?n:n[0]}}},"select",e.$attrs,!1),[e._t("default")],2)]},{dropdownClasses:e.dropdownClasses,value:e.value}),t("InlineChevronDownIcon",{staticClass:"form-icon",attrs:{"aria-hidden":"true"}}),e.$slots.eyebrow?t("span",{staticClass:"form-label",attrs:{"aria-hidden":"true"}},[e._t("eyebrow")],2):e._e(),e._t("after")],2)},Q=[],K=n(620),X={name:"BaseDropdown",inheritAttrs:!1,props:{value:{type:String,default:""}},components:{InlineChevronDownIcon:K.A},computed:{modelValue:{get:({value:e})=>e,set(e){this.$emit("input",e)}},dropdownClasses({value:e}){return["form-dropdown",{"form-dropdown-selectnone":""===e,"no-eyebrow":!this.$slots.eyebrow}]}}},J=X,Y=(0,A.A)(J,W,Q,!1,null,"f934959a",null),Z=Y.exports;const ee="is-open",te="option",ne="option-active";var se={name:"DropdownCustom",components:{BaseDropdown:Z},constants:{OpenedClass:ee,OptionClass:te,ActiveOptionClass:ne},props:{value:{type:String,default:""},ariaLabel:{type:String,default:""},isSmall:{type:Boolean,default:!1}},data(){return{isOpen:!1,OpenedClass:ee,OptionClass:te,ActiveOptionClass:ne}},mounted(){document.addEventListener("click",this.closeOnLoseFocus)},beforeDestroy(){document.removeEventListener("click",this.closeOnLoseFocus)},methods:{onChangeAction(e){this.$emit("input",e)},toggleDropdown(){this.isOpen?this.closeDropdown():this.openDropdown()},async closeAndFocusToggler(){this.closeDropdown(),await this.$nextTick(),this.$refs.dropdownToggle.focus({preventScroll:!0})},closeDropdown(){this.isOpen=!1,this.$emit("close")},openDropdown(){this.isOpen=!0,this.$emit("open"),this.focusActiveLink()},closeOnLoseFocus(e){!this.$el.contains(e.target)&&this.isOpen&&this.closeDropdown()},navigateOverOptions({target:e},t){const n=this.$el.querySelectorAll(`.${te}`),s=Array.from(n),i=s.indexOf(e),r=s[i+t];r&&r.focus({preventScroll:!0})},async focusActiveLink(){const e=this.$el.querySelector(`.${ne}`);e&&(await this.$nextTick(),e.focus({preventScroll:!0}))}}},ie=se,re=(0,A.A)(ie,z,G,!1,null,"6adda760",null),oe=re.exports,ae={name:"SecondaryDropdown",components:{DropdownCustom:oe},props:{options:{type:Array,required:!0},currentOption:{type:String,required:!0},sectionTracker:{type:String,required:!1}},methods:{ariaCurrent(e){return this.currentOption===e&&"section"},setActive(e,t,n,s){t(s),this.$emit("select-section",e.path),n()}}},le=ae,ce=(0,A.A)(le,U,H,!1,null,"618ff780",null),ue=ce.exports,de=function(){var e=this,t=e._self._c;return t("DropdownCustom",{staticClass:"tutorial-dropdown",attrs:{value:e.currentOption,"aria-label":e.$t("tutorials.nav.current",{thing:e.$tc("tutorials.title",1)}),isSmall:""},scopedSlots:e._u([{key:"default",fn:function({closeAndFocusToggler:n,contentClasses:s,closeDropdown:i,navigateOverOptions:r,OptionClass:o,ActiveOptionClass:a}){return[t("ul",{staticClass:"options",class:s,attrs:{tabindex:"0"}},e._l(e.options,function(s){return t("ReferenceUrlProvider",{key:s.reference,attrs:{reference:s.reference},scopedSlots:e._u([{key:"default",fn:function({title:l}){return[t("li",{staticClass:"chapter-list",attrs:{role:"group"}},[t("p",{staticClass:"chapter-name"},[e._v(e._s(l))]),t("ul",{attrs:{role:"listbox"}},e._l(s.projects,function(s){return t("ReferenceUrlProvider",{key:s.reference,attrs:{reference:s.reference},scopedSlots:e._u([{key:"default",fn:function({urlWithParams:s,title:l}){return[t("router-link",{attrs:{to:s,custom:""},scopedSlots:e._u([{key:"default",fn:function({navigate:s,isActive:c}){return[t("li",{class:{[o]:!0,[a]:c},attrs:{value:l,"aria-selected":c,"aria-current":!!c&&"tutorial",tabindex:-1},on:{click:function(t){return e.setActive(s,i,t)},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.setActive(s,i,t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:n.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:n.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),r(t,1))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),r(t,-1))}]}},[e._v(" "+e._s(l)+" ")])]}}],null,!0)})]}}],null,!0)})}),1)])]}}],null,!0)})}),1)]}}])})},pe=[],he={name:"PrimaryDropdown",components:{DropdownCustom:oe,ReferenceUrlProvider:q},props:{options:{type:Array,required:!0},currentOption:{type:String,required:!0}},methods:{setActive(e,t,n){e(n),t()}}},me=he,ve=(0,A.A)(me,de,pe,!1,null,"03cbd7f7",null),fe=ve.exports;const ge={title:"Introduction",url:"#introduction",reference:"introduction",sectionNumber:0,depth:0};var ye={name:"NavigationBar",components:{NavTitleContainer:R.A,NavBase:D.A,ReferenceUrlProvider:q,PrimaryDropdown:fe,SecondaryDropdown:ue,MobileDropdown:E,ChevronIcon:S},mixins:[P.A,T.A],props:{chapters:{type:Array,required:!0},technology:{type:String,required:!0},topic:{type:String,required:!0},rootReference:{type:String,required:!0},identifierUrl:{type:String,required:!0}},data(){return{currentSection:ge,tutorialState:this.store.state}},watch:{pageSectionWithHighestVisibility(e){e&&(this.currentSection=e)}},computed:{currentProject(){return this.chapters.reduce((e,{projects:t})=>e.concat(t),[]).find(e=>e.reference===this.identifierUrl)},pageSections(){if(!this.currentProject)return[];const e=[ge].concat(this.currentProject.sections);return this.tutorialState.linkableSections.map((t,n)=>{const s=e[n],i=this.references[s.reference],{url:r,title:o}=i||s;return{...t,title:o,path:r}})},optionsForSections(){return this.pageSections.map(({depth:e,path:t,title:n})=>({depth:e,path:t,title:n}))},pageSectionWithHighestVisibility(){return[...this.pageSections].sort((e,t)=>t.visibility-e.visibility).find(e=>e.visibility>0)},sectionIndicatorText(){const e=this.tutorialState.linkableSections.length-1,{sectionNumber:t}=this.currentSection||{};if(0!==t)return this.$t("tutorials.section-of",{number:t,total:e})}},methods:{onSelectSection(e){const t=e.split("#")[1];this.handleFocusAndScroll(t)}}},Ce=ye,be=(0,A.A)(Ce,f,g,!1,null,"367fa5fc",null),_e=be.exports,we=n(1897),Ae=function(){var e=this,t=e._self._c;return t("div",{staticClass:"body"},[t("BodyContent",{attrs:{content:e.content}})],1)},ke=[],Se=function(){var e=this,t=e._self._c;return t("article",{staticClass:"body-content"},e._l(e.content,function(n,s){return t(e.componentFor(n),e._b({key:s,tag:"component",staticClass:"layout"},"component",e.propsFor(n),!1))}),1)},xe=[],Te=function(){var e=this,t=e._self._c;return t("div",{staticClass:"columns",class:e.classes},[e._l(e.columns,function(n,s){return[t("Asset",{key:n.media,attrs:{identifier:n.media,videoAutoplays:!1}}),n.content?t("ContentNode",{key:s,attrs:{content:n.content}}):e._e()]})],2)},Ie=[],$e=n(8486),Ne=function(){var e=this,t=e._self._c;return t("BaseContentNode",{attrs:{content:e.articleContent}})},qe=[],Pe=n(3213),De={name:"ContentNode",components:{BaseContentNode:Pe["default"]},props:Pe["default"].props,computed:{articleContent(){return this.map(e=>{switch(e.type){case Pe["default"].BlockType.codeListing:return{...e,showLineNumbers:!0};case Pe["default"].BlockType.heading:{const{anchor:t,...n}=e;return n}default:return e}})}},methods:Pe["default"].methods,BlockType:Pe["default"].BlockType,InlineType:Pe["default"].InlineType},Re=De,Le=(0,A.A)(Re,Ne,qe,!1,null,"0861b5be",null),Oe=Le.exports,Be={name:"Columns",components:{Asset:$e.A,ContentNode:Oe},props:{columns:{type:Array,required:!0}},computed:{classes(){return{"cols-2":2===this.columns.length,"cols-3":3===this.columns.length}}}},Me=Be,Fe=(0,A.A)(Me,Te,Ie,!1,null,"30edf911",null),Ve=Fe.exports,je=function(){var e=this,t=e._self._c;return t("div",{staticClass:"content-and-media",class:e.classes},[t("ContentNode",{attrs:{content:e.content}}),t("Asset",{attrs:{identifier:e.media}})],1)},Ee=[];const Ue={leading:"leading",trailing:"trailing"};var He={name:"ContentAndMedia",components:{Asset:$e.A,ContentNode:Oe},props:{content:Oe.props.content,media:$e.A.props.identifier,mediaPosition:{type:String,default:()=>Ue.trailing,validator:e=>Object.prototype.hasOwnProperty.call(Ue,e)}},computed:{classes(){return{"media-leading":this.mediaPosition===Ue.leading,"media-trailing":this.mediaPosition===Ue.trailing}}},MediaPosition:Ue},ze=He,Ge=(0,A.A)(ze,je,Ee,!1,null,"3fa44f9e",null),We=Ge.exports,Qe=function(){var e=this,t=e._self._c;return t("div",{staticClass:"full-width"},e._l(e.groups,function(n,s){return t(e.componentFor(n),e._b({key:s,tag:"component",staticClass:"group"},"component",e.propsFor(n),!1),[t("ContentNode",{attrs:{content:n.content}})],1)}),1)},Ke=[],Xe=function(){var e=this,t=e._self._c;return t(e.tag,{tag:"component",attrs:{id:e.anchor}},[e._t("default")],2)},Je=[],Ye=n(8284),Ze={name:"LinkableElement",mixins:[Ye.A],inject:{navigationBarHeight:{default(){}},store:{default(){return{addLinkableSection(){},updateLinkableSection(){}}}}},props:{anchor:{type:String,required:!0},depth:{type:Number,default:()=>0},tag:{type:String,default:()=>"div"},title:{type:String,required:!0}},computed:{intersectionRootMargin(){const e=this.navigationBarHeight?`-${this.navigationBarHeight}px`:"0%";return`${e} 0% -50% 0%`}},created(){this.store.addLinkableSection({anchor:this.anchor,depth:this.depth,title:this.title,visibility:0})},methods:{onIntersect(e){const t=Math.min(1,e.intersectionRatio);this.store.updateLinkableSection({anchor:this.anchor,depth:this.depth,title:this.title,visibility:t})}}},et=Ze,tt=(0,A.A)(et,Xe,Je,!1,null,null,null),nt=tt.exports;const{BlockType:st}=Oe;var it={name:"FullWidth",components:{ContentNode:Oe,LinkableElement:nt},props:Oe.props,computed:{groups:({content:e})=>e.reduce((e,t)=>0===e.length||t.type===st.heading?[...e,{heading:t.type===st.heading?t:null,content:[t]}]:[...e.slice(0,e.length-1),{heading:e[e.length-1].heading,content:e[e.length-1].content.concat(t)}],[])},methods:{componentFor(e){return e.heading?nt:"div"},depthFor(e){switch(e.level){case 1:case 2:return 0;default:return 1}},propsFor(e){return e.heading?{anchor:e.heading.anchor,depth:this.depthFor(e.heading),title:e.heading.text}:{}}}},rt=it,ot=(0,A.A)(rt,Qe,Ke,!1,null,"5b4a8b3c",null),at=ot.exports;const lt={columns:"columns",contentAndMedia:"contentAndMedia",fullWidth:"fullWidth"};var ct={name:"BodyContent",props:{content:{type:Array,required:!0,validator:e=>e.every(({kind:e})=>Object.prototype.hasOwnProperty.call(lt,e))}},methods:{componentFor(e){return{[lt.columns]:Ve,[lt.contentAndMedia]:We,[lt.fullWidth]:at}[e.kind]},propsFor(e){const{content:t,kind:n,media:s,mediaPosition:i}=e;return{[lt.columns]:{columns:t},[lt.contentAndMedia]:{content:t,media:s,mediaPosition:i},[lt.fullWidth]:{content:t}}[n]}},LayoutKind:lt},ut=ct,dt=(0,A.A)(ut,Se,xe,!1,null,"4d5a806e",null),pt=dt.exports,ht={name:"Body",components:{BodyContent:pt},props:pt.props},mt=ht,vt=(0,A.A)(mt,Ae,ke,!1,null,"20dca692",null),ft=vt.exports,gt=function(){var e=this,t=e._self._c;return t("TutorialCTA",e._b({},"TutorialCTA",e.$props,!1))},yt=[],Ct=function(){var e=this,t=e._self._c;return t("BaseCTA",e._b({attrs:{label:e.$t("tutorials.next")}},"BaseCTA",e.baseProps,!1))},bt=[],_t=function(){var e=this,t=e._self._c;return t("div",{staticClass:"call-to-action"},[t("Row",[t("LeftColumn",[t("span",{staticClass:"label"},[e._v(e._s(e.label))]),t("h2",[e._v(" "+e._s(e.title)+" ")]),e.abstract?t("ContentNode",{staticClass:"description",attrs:{content:[e.abstractParagraph]}}):e._e(),e.action?t("Button",{attrs:{action:e.action}}):e._e()],1),t("RightColumn",{staticClass:"right-column"},[e.media?t("Asset",{staticClass:"media",attrs:{identifier:e.media}}):e._e()],1)],1)],1)},wt=[],At=n(6616),kt=n(2773),St=n(1290),xt={name:"CallToAction",components:{Asset:$e.A,Button:St.A,ContentNode:Pe["default"],LeftColumn:{render(e){return e(kt.A,{props:{span:{large:5,small:12}}},this.$slots.default)}},RightColumn:{render(e){return e(kt.A,{props:{span:{large:6,small:12}}},this.$slots.default)}},Row:At.A},props:{title:{type:String,required:!0},label:{type:String,required:!0},abstract:{type:Array,required:!1},action:{type:Object,required:!1},media:{type:String,required:!1}},computed:{abstractParagraph(){return{type:"paragraph",inlineContent:this.abstract}}}},Tt=xt,It=(0,A.A)(Tt,_t,wt,!1,null,"2bfdf182",null),$t=It.exports,Nt={name:"CallToAction",components:{BaseCTA:$t},computed:{baseProps(){return{title:this.title,abstract:this.abstract,action:this.action,media:this.media}}},props:{title:{type:String,required:!0},abstract:{type:Array,required:!1},action:{type:Object,required:!1},media:{type:String,required:!1}}},qt=Nt,Pt=(0,A.A)(qt,Ct,bt,!1,null,null,null),Dt=Pt.exports,Rt={name:"CallToAction",components:{TutorialCTA:Dt},props:Dt.props},Lt=Rt,Ot=(0,A.A)(Lt,gt,yt,!1,null,"426a965c",null),Bt=Ot.exports,Mt=function(){var e=this,t=e._self._c;return t("TutorialHero",e._b({},"TutorialHero",e.$props,!1))},Ft=[],Vt=function(){var e=this,t=e._self._c;return t("LinkableSection",{staticClass:"tutorial-hero",attrs:{anchor:"introduction",title:e.sectionTitle}},[t("div",{staticClass:"hero dark"},[e.backgroundImageUrl?t("div",{staticClass:"bg",style:e.bgStyle}):e._e(),e._t("above-title"),t("Row",[t("Column",[t("Headline",{attrs:{level:1},scopedSlots:e._u([e.chapter?{key:"eyebrow",fn:function(){return[e._v(e._s(e.chapter))]},proxy:!0}:null],null,!0)},[e._v(" "+e._s(e.title)+" ")]),e.content||e.video?t("div",{staticClass:"intro"},[e.content?t("ContentNode",{attrs:{content:e.content}}):e._e(),e.video?[t("p",[t("a",{staticClass:"call-to-action",attrs:{href:"#"},on:{click:function(t){return t.preventDefault(),e.toggleCallToActionModal.apply(null,arguments)}}},[e._v(" Watch intro video "),t("PlayIcon",{staticClass:"cta-icon icon-inline"})],1)]),t("GenericModal",{attrs:{visible:e.callToActionModalVisible,isFullscreen:"",theme:"dark"},on:{"update:visible":function(t){e.callToActionModalVisible=t}}},[t("Asset",{directives:[{name:"show",rawName:"v-show",value:e.callToActionModalVisible,expression:"callToActionModalVisible"}],ref:"asset",staticClass:"video-asset",attrs:{identifier:e.video},on:{videoEnded:e.handleVideoEnd}})],1)]:e._e()],2):e._e(),t("Metadata",{staticClass:"metadata",attrs:{projectFilesUrl:e.projectFilesUrl,estimatedTimeInMinutes:e.estimatedTimeInMinutes,xcodeRequirement:e.xcodeRequirementData}})],1)],1)],2)])},jt=[],Et=function(){var e=this,t=e._self._c;return t("div",{staticClass:"headline"},[e.$slots.eyebrow?t("span",{staticClass:"eyebrow"},[e._t("eyebrow")],2):e._e(),t("Heading",{staticClass:"heading",attrs:{level:e.level}},[e._t("default")],2)],1)},Ut=[];const Ht=1,zt=6,Gt={type:Number,required:!0,validator:e=>e>=Ht&&e<=zt},Wt={name:"Heading",render:function(e){return e(`h${this.level}`,this.$slots.default)},props:{level:Gt}};var Qt={name:"Headline",components:{Heading:Wt},props:{level:Gt}},Kt=Qt,Xt=(0,A.A)(Kt,Et,Ut,!1,null,"d46a1474",null),Jt=Xt.exports,Yt=n(6262),Zt=n(4769),en=n(288),tn=function(){var e=this,t=e._self._c;return t("div",{staticClass:"metadata"},[e.estimatedTimeInMinutes?t("div",{staticClass:"item",attrs:{"aria-label":`\n ${e.$tc("tutorials.time.minutes.full",e.estimatedTimeInMinutes,{count:e.estimatedTimeInMinutes})}\n ${e.$t("tutorials.estimated-time")}\n `}},[t("div",{staticClass:"content",attrs:{"aria-hidden":"true"}},[t("i18n",{staticClass:"duration",attrs:{path:"tutorials.time.format",tag:"div"},scopedSlots:e._u([{key:"number",fn:function(){return[e._v(" "+e._s(e.estimatedTimeInMinutes)+" ")]},proxy:!0},{key:"minutes",fn:function(){return[t("div",{staticClass:"minutes"},[e._v(e._s(e.$tc("tutorials.time.minutes.short",e.estimatedTimeInMinutes))+" ")])]},proxy:!0}],null,!1,3313752798)})],1),t("div",{staticClass:"bottom",attrs:{"aria-hidden":"true"}},[e._v(e._s(e.$t("tutorials.estimated-time")))])]):e._e(),e.projectFilesUrl?t("div",{staticClass:"item"},[t("DownloadIcon",{staticClass:"item-large-icon icon-inline"}),t("div",{staticClass:"content bottom"},[t("a",{staticClass:"content-link project-download",attrs:{href:e.projectFilesUrl}},[e._v(" "+e._s(e.$t("tutorials.project-files"))+" "),t("InlineDownloadIcon",{staticClass:"small-icon icon-inline"})],1)])],1):e._e(),e.xcodeRequirement?t("div",{staticClass:"item"},[t("XcodeIcon",{staticClass:"item-large-icon icon-inline"}),t("div",{staticClass:"content bottom"},[e.isTargetIDE?t("span",[e._v(e._s(e.xcodeRequirement.title))]):t("a",{staticClass:"content-link",attrs:{href:e.xcodeRequirement.url}},[e._v(" "+e._s(e.xcodeRequirement.title)+" "),t("InlineChevronRightIcon",{staticClass:"icon-inline small-icon xcode-icon"})],1)])],1):e._e()])},nn=[],sn=n(1168),rn=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"xcode-icon",attrs:{viewBox:"0 0 14 14",themeId:"xcode"}},[t("path",{attrs:{d:"M2.668 4.452l-1.338-2.229 0.891-0.891 2.229 1.338 1.338 2.228 3.667 3.666 0.194-0.194 2.933 2.933c0.13 0.155 0.209 0.356 0.209 0.576 0 0.497-0.403 0.9-0.9 0.9-0.22 0-0.421-0.079-0.577-0.209l0.001 0.001-2.934-2.933 0.181-0.181-3.666-3.666z"}}),t("path",{attrs:{d:"M11.824 1.277l-0.908 0.908c-0.091 0.091-0.147 0.216-0.147 0.354 0 0.106 0.033 0.205 0.090 0.286l-0.001-0.002 0.058 0.069 0.185 0.185c0.090 0.090 0.215 0.146 0.353 0.146 0.107 0 0.205-0.033 0.286-0.090l-0.002 0.001 0.069-0.057 0.909-0.908c0.118 0.24 0.187 0.522 0.187 0.82 0 1.045-0.848 1.893-1.893 1.893-0.296 0-0.577-0.068-0.826-0.189l0.011 0.005-5.5 5.5c0.116 0.238 0.184 0.518 0.184 0.813 0 1.045-0.848 1.893-1.893 1.893-0.296 0-0.576-0.068-0.826-0.189l0.011 0.005 0.908-0.909c0.090-0.090 0.146-0.215 0.146-0.353 0-0.107-0.033-0.205-0.090-0.286l0.001 0.002-0.057-0.069-0.185-0.185c-0.091-0.091-0.216-0.147-0.354-0.147-0.106 0-0.205 0.033-0.286 0.090l0.002-0.001-0.069 0.058-0.908 0.908c-0.116-0.238-0.184-0.518-0.184-0.813 0-1.045 0.847-1.892 1.892-1.892 0.293 0 0.571 0.067 0.819 0.186l-0.011-0.005 5.5-5.5c-0.116-0.238-0.184-0.519-0.184-0.815 0-1.045 0.847-1.892 1.892-1.892 0.296 0 0.577 0.068 0.827 0.19l-0.011-0.005z"}})])},on=[],an={name:"XcodeIcon",components:{SVGIcon:b.A}},ln=an,cn=(0,A.A)(ln,rn,on,!1,null,null,null),un=cn.exports,dn=n(6e3),pn=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"inline-download-icon",attrs:{viewBox:"0 0 14 14",themeId:"inline-download"}},[t("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5s2.91-6.5 6.5-6.5zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5s-2.462-5.5-5.5-5.5z"}}),t("path",{attrs:{d:"M7.51 2.964l-0.001 5.431 1.308-2.041 0.842 0.539-2.664 4.162-2.633-4.164 0.845-0.534 1.303 2.059 0.001-5.452z"}})])},hn=[],mn={name:"InlineDownloadIcon",components:{SVGIcon:b.A}},vn=mn,fn=(0,A.A)(vn,pn,hn,!1,null,null,null),gn=fn.exports,yn={name:"HeroMetadata",components:{InlineDownloadIcon:gn,InlineChevronRightIcon:dn.A,DownloadIcon:sn.A,XcodeIcon:un},inject:["isTargetIDE"],props:{projectFilesUrl:{type:String},estimatedTimeInMinutes:{type:Number},xcodeRequirement:{type:Object,required:!1}}},Cn=yn,bn=(0,A.A)(Cn,tn,nn,!1,null,"94ff76c0",null),_n=bn.exports,wn={name:"Hero",components:{PlayIcon:Zt.A,GenericModal:Yt.A,Column:{render(e){return e(kt.A,{props:{span:{large:7,medium:9,small:12}}},this.$slots.default)}},ContentNode:Pe["default"],Headline:Jt,Metadata:_n,Row:At.A,Asset:$e.A,LinkableSection:nt},mixins:[T.A],props:{title:{type:String,required:!0},chapter:{type:String},content:{type:Array},projectFiles:{type:String},estimatedTimeInMinutes:{type:Number},xcodeRequirement:{type:String,required:!1},video:{type:String},backgroundImage:{type:String}},computed:{backgroundImageUrl(){const e=this.references[this.backgroundImage]||{},{variants:t=[]}=e,n=t.find(e=>e.traits.includes("light"));return(0,en.Fd)((n||{}).url)},projectFilesUrl(){return this.projectFiles?(0,en.Fd)(this.references[this.projectFiles].url):null},bgStyle(){return{backgroundImage:(0,en.iw)(this.backgroundImageUrl)}},xcodeRequirementData(){return this.references[this.xcodeRequirement]},sectionTitle(){return"Introduction"}},data(){return{callToActionModalVisible:!1}},methods:{async toggleCallToActionModal(){this.callToActionModalVisible=!0,await this.$nextTick();const e=this.$refs.asset.$el.querySelector("video");if(e)try{await e.play(),e.muted=!1}catch(t){}},handleVideoEnd(){this.callToActionModalVisible=!1}}},An=wn,kn=(0,A.A)(An,Vt,jt,!1,null,"2a434750",null),Sn=kn.exports,xn={name:"Hero",components:{TutorialHero:Sn},props:Sn.props},Tn=xn,In=(0,A.A)(Tn,Mt,Ft,!1,null,"35a9482f",null),$n=In.exports,Nn=function(){var e=this,t=e._self._c;return t("TutorialAssessments",e._b({scopedSlots:e._u([{key:"success",fn:function(){return[t("p",[e._v("Great job, you've answered all the questions for this article.")])]},proxy:!0}])},"TutorialAssessments",e.$props,!1))},qn=[],Pn=function(){var e=this,t=e._self._c;return t("LinkableSection",{staticClass:"assessments-wrapper",attrs:{anchor:e.anchor,title:e.title}},[t("Row",{ref:"assessments",staticClass:"assessments"},[t("MainColumn",[t("Row",{staticClass:"banner"},[t("HeaderColumn",[t("h2",{staticClass:"title"},[e._v(e._s(e.title))])])],1),e.completed?t("div",{staticClass:"success"},[e._t("success",function(){return[t("p",[e._v(e._s(e.SuccessMessage))])]})],2):t("div",[t("Progress",e._b({ref:"progress"},"Progress",e.progress,!1)),t("Quiz",{key:e.activeIndex,attrs:{choices:e.activeAssessment.choices,content:e.activeAssessment.content,isLast:e.isLast,title:e.activeAssessment.title},on:{submit:e.onSubmit,advance:e.onAdvance,"see-results":e.onSeeResults}})],1),t("div",{staticClass:"visuallyhidden",attrs:{"aria-live":"assertive"}},[e.completed?e._t("success",function(){return[e._v(" "+e._s(e.SuccessMessage)+" ")]}):e._e()],2)],1)],1)],1)},Dn=[],Rn=function(){var e=this,t=e._self._c;return t("Row",[t("p",{staticClass:"title"},[e._v(e._s(e.$t("tutorials.question-of",{index:e.index,total:e.total})))])])},Ln=[],On={name:"AssessmentsProgress",components:{Row:At.A},props:{index:{type:Number,required:!0},total:{type:Number,required:!0}}},Bn=On,Mn=(0,A.A)(Bn,Rn,Ln,!1,null,"28135d78",null),Fn=Mn.exports,Vn=function(){var e=this,t=e._self._c;return t("div",{staticClass:"quiz"},[t("ContentNode",{staticClass:"title",attrs:{content:e.title}}),e.content?t("ContentNode",{staticClass:"question-content",attrs:{content:e.content}}):e._e(),t("fieldset",{staticClass:"choices"},[t("legend",{staticClass:"visuallyhidden"},[e._v(e._s(e.$t("tutorials.assessment.legend")))]),e._l(e.choices,function(n,s){return t("label",{key:s,class:e.choiceClasses[s]},[t(e.getIconComponent(s),{tag:"component",staticClass:"choice-icon"}),t("input",{directives:[{name:"model",rawName:"v-model",value:e.selectedIndex,expression:"selectedIndex"}],attrs:{type:"radio",name:"assessment"},domProps:{value:s,checked:e._q(e.selectedIndex,s)},on:{change:function(t){e.selectedIndex=s}}}),t("ContentNode",{staticClass:"question",attrs:{content:n.content}}),e.userChoices[s].checked?[t("ContentNode",{staticClass:"answer",attrs:{content:n.justification}}),n.reaction?t("p",{staticClass:"answer"},[e._v(e._s(n.reaction))]):e._e()]:e._e()],2)})],2),t("div",{staticClass:"visuallyhidden",attrs:{"aria-live":"assertive"}},[null!=e.checkedIndex?t("i18n",{attrs:{path:"tutorials.assessment.answer-result",tag:"span"},scopedSlots:e._u([{key:"answer",fn:function(){return[t("ContentNode",{staticClass:"question",attrs:{content:e.choices[e.checkedIndex].content}})]},proxy:!0},{key:"result",fn:function(){return[e._v(e._s(e.choices[e.checkedIndex].isCorrect?e.$t("tutorials.assessment.correct"):e.$t("tutorials.assessment.incorrect")))]},proxy:!0}],null,!1,511264553)}):e._e()],1),t("div",{staticClass:"controls"},[t("ButtonLink",{staticClass:"check",attrs:{disabled:null===e.selectedIndex||e.showNextQuestion},nativeOn:{click:function(t){return e.submit.apply(null,arguments)}}},[e._v(" "+e._s(e.$t("tutorials.submit"))+" ")]),e.isLast?t("ButtonLink",{staticClass:"results",attrs:{disabled:!e.showNextQuestion},nativeOn:{click:function(t){return e.seeResults.apply(null,arguments)}}},[e._v(" "+e._s(e.$t("tutorials.next"))+" ")]):t("ButtonLink",{staticClass:"next",attrs:{disabled:!e.showNextQuestion},nativeOn:{click:function(t){return e.advance.apply(null,arguments)}}},[e._v(" "+e._s(e.$t("tutorials.assessment.next-question"))+" ")])],1)],1)},jn=[],En=(n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698),n(5892)),Un=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"reset-circle-icon",attrs:{viewBox:"0 0 14 14",themeId:"reset-circle"}},[t("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5v0c0-3.59 2.91-6.5 6.5-6.5v0zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5v0c0-3.038-2.462-5.5-5.5-5.5v0z"}}),t("path",{attrs:{d:"M3.828 4.539l0.707-0.707 5.657 5.657-0.707 0.707-5.657-5.657z"}}),t("path",{attrs:{d:"M3.828 9.489l5.657-5.657 0.707 0.707-5.657 5.657-0.707-0.707z"}})])},Hn=[],zn={name:"ResetCircleIcon",components:{SVGIcon:b.A}},Gn=zn,Wn=(0,A.A)(Gn,Un,Hn,!1,null,null,null),Qn=Wn.exports,Kn=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"check-circle-icon",attrs:{viewBox:"0 0 14 14",themeId:"check-circle"}},[t("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5v0c0-3.59 2.91-6.5 6.5-6.5v0zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5v0c0-3.038-2.462-5.5-5.5-5.5v0z"}}),t("path",{attrs:{d:"M9.626 3.719l0.866 0.5-3.5 6.062-3.464-2 0.5-0.866 2.6 1.5z"}})])},Xn=[],Jn={name:"CheckCircleIcon",components:{SVGIcon:b.A}},Yn=Jn,Zn=(0,A.A)(Yn,Kn,Xn,!1,null,null,null),es=Zn.exports,ts={name:"Quiz",components:{CheckCircleIcon:es,ResetCircleIcon:Qn,ContentNode:Pe["default"],ButtonLink:En.A},props:{content:{type:Array,required:!1},choices:{type:Array,required:!0},isLast:{type:Boolean,default:!1},title:{type:Array,required:!0}},data(){return{userChoices:this.choices.map(()=>({checked:!1})),selectedIndex:null,checkedIndex:null}},computed:{correctChoices(){return this.choices.reduce((e,t,n)=>t.isCorrect?e.add(n):e,new Set)},choiceClasses(){return this.userChoices.map((e,t)=>({choice:!0,active:this.selectedIndex===t,disabled:e.checked||this.showNextQuestion,correct:e.checked&&this.choices[t].isCorrect,incorrect:e.checked&&!this.choices[t].isCorrect}))},showNextQuestion(){return Array.from(this.correctChoices).every(e=>this.userChoices[e].checked)}},methods:{getIconComponent(e){const t=this.userChoices[e];if(t&&t.checked)return this.choices[e].isCorrect?es:Qn},submit(){this.$set(this.userChoices,this.selectedIndex,{checked:!0}),this.checkedIndex=this.selectedIndex,this.$emit("submit")},advance(){this.$emit("advance")},seeResults(){this.$emit("see-results")}}},ns=ts,ss=(0,A.A)(ns,Vn,jn,!1,null,"61b03ec2",null),is=ss.exports;const rs=12,os="tutorials.assessment.success-message";var as={name:"Assessments",constants:{SuccessMessage:os},components:{LinkableSection:nt,Quiz:is,Progress:Fn,Row:At.A,HeaderColumn:{render(e){return e(kt.A,{props:{isCentered:{large:!0},span:{large:10}}},this.$slots.default)}},MainColumn:{render(e){return e(kt.A,{props:{isCentered:{large:!0},span:{large:10,medium:10,small:12}}},this.$slots.default)}}},props:{assessments:{type:Array,required:!0},anchor:{type:String,required:!0}},inject:["navigationBarHeight"],data(){return{activeIndex:0,completed:!1,SuccessMessage:this.$t(os)}},computed:{activeAssessment(){return this.assessments[this.activeIndex]},isLast(){return this.activeIndex===this.assessments.length-1},progress(){return{index:this.activeIndex+1,total:this.assessments.length}},title(){return this.$t("tutorials.assessment.check-your-understanding")}},methods:{scrollTo(e,t=0){e.scrollIntoView(!0),window.scrollBy(0,-this.navigationBarHeight-t)},onSubmit(){this.$nextTick(()=>{this.scrollTo(this.$refs.progress.$el,rs)})},onAdvance(){this.activeIndex+=1,this.$nextTick(()=>{this.scrollTo(this.$refs.progress.$el,rs)})},onSeeResults(){this.completed=!0,this.$nextTick(()=>{this.scrollTo(this.$refs.assessments.$el,rs)})}}},ls=as,cs=(0,A.A)(ls,Pn,Dn,!1,null,"65e3c02c",null),us=cs.exports,ds={name:"Assessments",components:{TutorialAssessments:us},props:us.props},ps=ds,hs=(0,A.A)(ps,Nn,qn,!1,null,"6db06128",null),ms=hs.exports;const vs={articleBody:"articleBody",callToAction:"callToAction",hero:"hero",assessments:"assessments"};var fs={name:"Article",components:{NavigationBar:_e,PortalTarget:m.mf},mixins:[we.A],inject:{isTargetIDE:{default:!1},store:{default(){return{reset(){},setReferences(){}}}}},props:{hierarchy:{type:Object,required:!0},metadata:{type:Object,required:!0},references:{type:Object,required:!0},sections:{type:Array,required:!0,validator:e=>e.every(({kind:e})=>Object.prototype.hasOwnProperty.call(vs,e))},identifierUrl:{type:String,required:!0}},computed:{heroSection(){return this.sections.find(this.isHero)},heroTitle(){return(this.heroSection||{}).title},pageTitle(){return this.heroTitle?`${this.heroTitle}${this.metadata.category} Tutorials`:void 0},pageDescription:({heroSection:e,extractFirstParagraphText:t})=>e?t(e.content):null},methods:{componentFor(e){const{kind:t}=e;return{[vs.articleBody]:ft,[vs.callToAction]:Bt,[vs.hero]:$n,[vs.assessments]:ms}[t]},isHero(e){return e.kind===vs.hero},propsFor(e){const{abstract:t,action:n,anchor:s,assessments:i,backgroundImage:r,chapter:o,content:a,estimatedTimeInMinutes:l,kind:c,media:u,projectFiles:d,title:p,video:h,xcodeRequirement:m}=e;return{[vs.articleBody]:{content:a},[vs.callToAction]:{abstract:t,action:n,media:u,title:p},[vs.hero]:{backgroundImage:r,chapter:o,content:a,estimatedTimeInMinutes:l,projectFiles:d,title:p,video:h,xcodeRequirement:m},[vs.assessments]:{anchor:s,assessments:i}}[c]}},created(){v.A.setAvailableLocales(this.metadata.availableLanguages??this.metadata.availableLocales),this.store.reset(),this.store.setReferences(this.references)},watch:{references(e){this.store.setReferences(e)},"metadata.availableLocales":function(e){v.A.setAvailableLocales(this.metadata?.availableLanguages??e)},"metadata.availableLanguages":function(e){v.A.setAvailableLocales(e)}},SectionKind:vs},gs=fs,ys=(0,A.A)(gs,p,h,!1,null,"f98c4098",null),Cs=ys.exports,bs=function(){var e=this,t=e._self._c;return t("div",{staticClass:"tutorial"},[e.isTargetIDE?e._e():t("NavigationBar",{attrs:{technology:e.metadata.category,chapters:e.hierarchy.modules,topic:e.tutorialTitle||"",rootReference:e.hierarchy.reference,identifierUrl:e.identifierUrl}}),t("main",{attrs:{id:"app-main",tabindex:"0"}},[e._l(e.sections,function(e,n){return t("Section",{key:n,attrs:{section:e}})}),t("BreakpointEmitter",{on:{change:e.handleBreakpointChange}})],2),t("PortalTarget",{attrs:{name:"modal-destination",multiple:""}})],1)},_s=[],ws=n(6131),As=function(){var e=this,t=e._self._c;return t("div",{staticClass:"sections"},e._l(e.tasks,function(n,s){return t("Section",e._b({key:s,attrs:{id:n.anchor,sectionNumber:s+1,isRuntimePreviewVisible:e.isRuntimePreviewVisible},on:{"runtime-preview-toggle":e.onRuntimePreviewToggle}},"Section",n,!1))}),1)},ks=[],Ss=function(){var e=this,t=e._self._c;return t("LinkableSection",{staticClass:"section",attrs:{anchor:e.anchor,title:e.introProps.title}},[t("Intro",e._b({},"Intro",e.introProps,!1)),e.stepsSection.length>0?t("Steps",{attrs:{content:e.stepsSection,isRuntimePreviewVisible:e.isRuntimePreviewVisible,sectionNumber:e.sectionNumber},on:{"runtime-preview-toggle":e.onRuntimePreviewToggle}}):e._e()],1)},xs=[],Ts=function(){var e=this,t=e._self._c;return t("div",{staticClass:"intro-container"},[t("Row",{class:["intro",`intro-${e.sectionNumber}`,{ide:e.isTargetIDE}]},[t("Column",{staticClass:"left"},[t("Headline",{attrs:{level:2},scopedSlots:e._u([{key:"eyebrow",fn:function(){return[t("router-link",{attrs:{to:e.sectionLink}},[e._v(" "+e._s(e.$t("sections.title",{number:e.sectionNumber}))+" ")])]},proxy:!0}])},[e._v(" "+e._s(e.title)+" ")]),t("ContentNode",{attrs:{content:e.content}})],1),t("Column",{staticClass:"right"},[t("div",{staticClass:"media"},[e.media?t("Asset",{attrs:{videoAutoplays:"",videoMuted:"",identifier:e.media}}):e._e()],1)])],1),e.expandedSections.length>0?t("ExpandedIntro",{staticClass:"expanded-intro",attrs:{content:e.expandedSections}}):e._e()],1)},Is=[],$s={name:"SectionIntro",inject:{isTargetIDE:{default:()=>!1}},components:{Asset:$e.A,ContentNode:Pe["default"],ExpandedIntro:pt,Headline:Jt,Row:At.A,Column:{render(e){return e(kt.A,{props:{span:{large:6,small:12}}},this.$slots.default)}}},props:{sectionAnchor:{type:String,required:!0},content:{type:Array,required:!0},media:{type:String,required:!0},title:{type:String,required:!0},sectionNumber:{type:Number,required:!0},expandedSections:{type:Array,default:()=>[]}},methods:{focus(){this.$emit("focus",this.media)}},computed:{sectionLink(){return{path:this.$route.path,hash:this.sectionAnchor,query:this.$route.query}}}},Ns=$s,qs=(0,A.A)(Ns,Ts,Is,!1,null,"7dcf2d10",null),Ps=qs.exports,Ds=function(){var e=this,t=e._self._c;return t("div",{staticClass:"steps"},[t("div",{staticClass:"content-container"},e._l(e.contentNodes,function(n,s){return t(n.component,e._b({key:s,ref:"contentNodes",refInFor:!0,tag:"component",class:e.contentClass(s),attrs:{currentIndex:e.activeStep}},"component",n.props,!1))}),1),e.isBreakpointSmall?e._e():t("BackgroundTheme",{staticClass:"asset-container",class:e.assetContainerClasses},[t("transition",{attrs:{name:"fade"}},[e.visibleAsset.media?t("div",{key:e.visibleAsset.media,class:["asset-wrapper",{ide:e.isTargetIDE}]},[t("Asset",{ref:"asset",staticClass:"step-asset",attrs:{videoAutoplays:"",videoMuted:"",identifier:e.visibleAsset.media}})],1):e._e(),e.visibleAsset.code?t("CodePreview",{attrs:{code:e.visibleAsset.code,preview:e.visibleAsset.runtimePreview,isRuntimePreviewVisible:e.isRuntimePreviewVisible},on:{"runtime-preview-toggle":e.onRuntimePreviewToggle}},[e.visibleAsset.runtimePreview?t("transition",{attrs:{name:"fade"}},[t("Asset",{key:e.visibleAsset.runtimePreview,attrs:{identifier:e.visibleAsset.runtimePreview}})],1):e._e()],1):e._e()],1)],1)],1)},Rs=[],Ls=(n(2489),n(7588),function(){var e=this,t=e._self._c;return t("div",{class:["code-preview",{ide:e.isTargetIDE}]},[t("CodeTheme",[e.code?t("CodeListing",e._b({attrs:{showLineNumbers:""}},"CodeListing",e.codeProps,!1)):e._e()],1),t("div",{staticClass:"runtime-preview",class:e.runtimePreviewClasses,style:e.previewStyles},[t("div",{staticClass:"runtimve-preview__container"},[t("button",{staticClass:"header",attrs:{disabled:!e.hasRuntimePreview,title:e.runtimePreviewTitle},on:{click:e.togglePreview}},[t("span",{staticClass:"runtime-preview-label",attrs:{"aria-label":e.textAriaLabel}},[e._v(e._s(e.togglePreviewText))]),t("DiagonalArrowIcon",{staticClass:"icon-inline preview-icon",class:[e.shouldDisplayHideLabel?"preview-hide":"preview-show"]})],1),t("transition",{on:{leave:e.handleLeave}},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.shouldDisplayHideLabel,expression:"shouldDisplayHideLabel"}],staticClass:"runtime-preview-asset"},[e._t("default")],2)])],1)])],1)}),Os=[],Bs=n(1097),Ms=n(9540),Fs=n(822);const{BreakpointName:Vs}=a.A.constants;function js({width:e,height:t},n=1){const s=400,i=e<=s?1.75:3;return{width:e/(i/n),height:t/(i/n)}}var Es={name:"CodePreview",inject:{isTargetIDE:{default:!1},store:{default(){return{state:{references:{}}}}}},components:{DiagonalArrowIcon:Ms.A,CodeListing:Bs.A,CodeTheme:Fs.A},props:{code:{type:String,required:!0},preview:{type:String,required:!1},isRuntimePreviewVisible:{type:Boolean,required:!0}},data(){return{tutorialState:this.store.state}},computed:{references:({tutorialState:e})=>e.references,currentBreakpoint(){return this.tutorialState.breakpoint},hasRuntimePreview(){return!!this.preview},previewAssetSize(){const e=this.hasRuntimePreview?this.references[this.preview]:{},t=(e.variants||[{}])[0]||{},n={width:900};let s=t.size||{};s.width||s.height||(s=n);const i=this.currentBreakpoint===Vs.medium?.8:1;return js(s,i)},previewSize(){const e={width:102};return this.shouldDisplayHideLabel&&this.previewAssetSize?{width:this.previewAssetSize.width}:e},previewStyles(){const{width:e}=this.previewSize;return{width:`${e}px`}},codeProps(){return this.references[this.code]},runtimePreviewClasses(){return{collapsed:!this.shouldDisplayHideLabel,disabled:!this.hasRuntimePreview,"runtime-preview-ide":this.isTargetIDE}},shouldDisplayHideLabel(){return this.hasRuntimePreview&&this.isRuntimePreviewVisible},runtimePreviewTitle(){return this.hasRuntimePreview?null:this.$t("tutorials.preview.no-preview-available-step")},togglePreviewText(){return this.$tc("tutorials.preview.title",this.hasRuntimePreview?1:0)},textAriaLabel(){return`${this.togglePreviewText}, ${this.shouldDisplayHideLabel?this.$t("verbs.hide"):this.$t("verbs.show")}`}},methods:{handleLeave(e,t){setTimeout(t,200)},togglePreview(){this.hasRuntimePreview&&this.$emit("runtime-preview-toggle",!this.isRuntimePreviewVisible)}}},Us=Es,Hs=(0,A.A)(Us,Ls,Os,!1,null,"395e30cd",null),zs=Hs.exports,Gs=n(3029),Ws=function(){var e=this,t=e._self._c;return t("div",{style:e.backgroundStyle},[e._t("default")],2)},Qs=[],Ks={name:"BackgroundTheme",data(){return{codeThemeState:ws.A.state}},computed:{backgroundStyle(){const{codeColors:e}=this.codeThemeState;return e?{"--background":e.background}:null}}},Xs=Ks,Js=(0,A.A)(Xs,Ws,Qs,!1,null,null,null),Ys=Js.exports,Zs=function(){var e=this,t=e._self._c;return t("div",{class:["step-container",`step-${e.stepNumber}`]},[t("div",{ref:"step",staticClass:"step",class:{focused:e.isActive},attrs:{"data-index":e.index}},[t("p",{staticClass:"step-label"},[e._v(e._s(e.$t("tutorials.step",{number:e.stepNumber})))]),t("ContentNode",{attrs:{content:e.content}}),e.caption&&e.caption.length>0?t("ContentNode",{staticClass:"caption",attrs:{content:e.caption}}):e._e()],1),e.isBreakpointSmall||!e.isTargetIDE?t("div",{staticClass:"media-container"},[e.media?t("Asset",{attrs:{identifier:e.media,videoAutoplays:"",videoMuted:""}}):e._e(),e.code?t("MobileCodePreview",{attrs:{code:e.code}},[e.runtimePreview?t("Asset",{staticClass:"preview",attrs:{identifier:e.runtimePreview}}):e._e()],1):e._e()],1):e._e()])},ei=[],ti=function(){var e=this,t=e._self._c;return t("BackgroundTheme",{staticClass:"mobile-code-preview"},[e.code?t("GenericModal",{staticClass:"full-code-listing-modal",attrs:{theme:e.isTargetIDE?"code":"light",codeBackgroundColorOverride:e.modalBackgroundColor,isFullscreen:"",visible:e.fullCodeIsVisible},on:{"update:visible":function(t){e.fullCodeIsVisible=t}}},[t("div",{staticClass:"full-code-listing-modal-content"},[t("CodeTheme",[t("CodeListing",e._b({staticClass:"full-code-listing",attrs:{showLineNumbers:""}},"CodeListing",e.codeProps,!1))],1)],1)]):e._e(),t("CodeTheme",[e.code?t("MobileCodeListing",e._b({attrs:{showLineNumbers:""},on:{"file-name-click":e.toggleFullCode}},"MobileCodeListing",e.codeProps,!1)):e._e()],1),t("CodeTheme",{staticClass:"preview-toggle-container"},[t("PreviewToggle",{attrs:{isActionable:!!e.$slots.default},on:{click:e.togglePreview}})],1),e.$slots.default?t("GenericModal",{staticClass:"runtime-preview-modal",attrs:{theme:e.isTargetIDE?"dynamic":"light",isFullscreen:"",visible:e.previewIsVisible},on:{"update:visible":function(t){e.previewIsVisible=t}}},[t("div",{staticClass:"runtime-preview-modal-content"},[t("span",{staticClass:"runtime-preview-label"},[e._v(e._s(e.$tc("tutorials.preview.title",1)))]),e._t("default")],2)]):e._e()],1)},ni=[],si=function(){var e=this,t=e._self._c;return t("div",{staticClass:"code-listing-preview",attrs:{"data-syntax":e.syntax}},[t("CodeListing",{attrs:{fileName:e.fileName,syntax:e.syntax,fileType:e.fileType,content:e.previewedLines,startLineNumber:e.displayedRange.start,highlights:e.highlights,showLineNumbers:"",isFileNameActionable:""},on:{"file-name-click":function(t){return e.$emit("file-name-click")}}})],1)},ii=[],ri={name:"MobileCodeListing",components:{CodeListing:Bs.A},props:{fileName:String,syntax:String,fileType:String,content:{type:Array,required:!0},highlights:{type:Array,default:()=>[]}},computed:{highlightedLineNumbers(){return new Set(this.highlights.map(({line:e})=>e))},firstHighlightRange(){if(0===this.highlightedLineNumbers.size)return{start:1,end:this.content.length};const e=Math.min(...this.highlightedLineNumbers.values());let t=e;while(this.highlightedLineNumbers.has(t+1))t+=1;return{start:e,end:t}},displayedRange(){const e=this.firstHighlightRange,t=e.start-2<1?1:e.start-2,n=e.end+3>=this.content.length+1?this.content.length+1:e.end+3;return{start:t,end:n}},previewedLines(){return this.content.slice(this.displayedRange.start-1,this.displayedRange.end-1)}}},oi=ri,ai=(0,A.A)(oi,si,ii,!1,null,"0bdf2f26",null),li=ai.exports,ci=function(){var e=this,t=e._self._c;return t("span",{staticClass:"toggle-preview"},[e.isActionable?t("a",{staticClass:"toggle-text",attrs:{href:"#"},on:{click:function(t){return t.preventDefault(),e.$emit("click")}}},[e._v(" "+e._s(e.$tc("tutorials.preview.title",1))+" "),t("InlinePlusCircleIcon",{staticClass:"toggle-icon icon-inline"})],1):t("span",{staticClass:"toggle-text"},[e._v(" "+e._s(e.$tc("tutorials.preview.title",0))+" ")])])},ui=[],di=n(5948),pi={name:"MobileCodePreviewToggle",components:{InlinePlusCircleIcon:di.A},props:{isActionable:{type:Boolean,required:!0}}},hi=pi,mi=(0,A.A)(hi,ci,ui,!1,null,"78763c14",null),vi=mi.exports,fi={name:"MobileCodePreview",inject:["isTargetIDE"],mixins:[T.A],components:{GenericModal:Yt.A,CodeListing:Bs.A,MobileCodeListing:li,PreviewToggle:vi,CodeTheme:Fs.A,BackgroundTheme:Ys},props:{code:{type:String,required:!0}},computed:{codeProps(){return this.references[this.code]},modalBackgroundColor(){const{codeColors:e}=this.store.state;return e?e.background:null}},data(){return{previewIsVisible:!1,fullCodeIsVisible:!1}},methods:{togglePreview(){this.previewIsVisible=!this.previewIsVisible},toggleFullCode(){this.fullCodeIsVisible=!this.fullCodeIsVisible}}},gi=fi,yi=(0,A.A)(gi,ti,ni,!1,null,"b1691954",null),Ci=yi.exports;const{BreakpointName:bi}=a.A.constants;var _i={name:"Step",components:{Asset:$e.A,MobileCodePreview:Ci,ContentNode:Pe["default"]},inject:["isTargetIDE","store"],props:{code:{type:String,required:!1},content:{type:Array,required:!0},caption:{type:Array,required:!1},media:{type:String,required:!1},runtimePreview:{type:String,required:!1},sectionNumber:{type:Number,required:!0},stepNumber:{type:Number,required:!0},numberOfSteps:{type:Number,required:!0},index:{type:Number,required:!0},currentIndex:{type:Number,required:!0}},data(){return{tutorialState:this.store.state}},computed:{isBreakpointSmall(){return this.tutorialState.breakpoint===bi.small},isActive:({index:e,currentIndex:t})=>e===t}},wi=_i,Ai=(0,A.A)(wi,Zs,ei,!1,null,"d0198556",null),ki=Ai.exports;const{BreakpointName:Si}=a.A.constants,{IntersectionDirections:xi}=Ye.A.constants,Ti="-35% 0% -65% 0%";var Ii={name:"SectionSteps",components:{ContentNode:Pe["default"],Step:ki,Asset:$e.A,CodePreview:zs,BackgroundTheme:Ys},mixins:[Ye.A],constants:{IntersectionMargins:Ti},inject:["isTargetIDE","store"],data(){const e=this.content.findIndex(this.isStepNode),{code:t,media:n,runtimePreview:s}=this.content[e]||{};return{tutorialState:this.store.state,visibleAsset:{media:n,code:t,runtimePreview:s},activeStep:e}},computed:{assetContainerClasses(){return{"for-step-code":!!this.visibleAsset.code,ide:this.isTargetIDE}},numberOfSteps(){return this.content.filter(this.isStepNode).length},contentNodes(){return this.content.reduce(({stepCounter:e,nodes:t},n,s)=>{const{type:i,...r}=n,o=this.isStepNode(n),a=o?e+1:e;return o?{stepCounter:e+1,nodes:t.concat({component:ki,type:i,props:{...r,stepNumber:a,index:s,numberOfSteps:this.numberOfSteps,sectionNumber:this.sectionNumber}})}:{stepCounter:e,nodes:t.concat({component:Pe["default"],type:i,props:{content:[n]}})}},{stepCounter:0,nodes:[]}).nodes},isBreakpointSmall(){return this.tutorialState.breakpoint===Si.small},stepNodes:({contentNodes:e,isStepNode:t})=>e.filter(t),intersectionRootMargin:()=>Ti},async mounted(){await(0,Gs.u)(8),this.findClosestStepNode()},methods:{isStepNode({type:e}){return"step"===e},contentClass(e){return{[`interstitial interstitial-${e+1}`]:!this.isStepNode(this.content[e])}},onReverseIntoLastStep(){const{asset:e}=this.$refs;if(e){const t=e.$el.querySelector("video");t&&(t.currentTime=0,t.play().catch(()=>{}))}},onFocus(e){const{code:t,media:n,runtimePreview:s}=this.content[e];this.activeStep=e,this.visibleAsset={code:t,media:n,runtimePreview:s}},onRuntimePreviewToggle(e){this.$emit("runtime-preview-toggle",e)},findClosestStepNode(){const e=.333*window.innerHeight;let t=null,n=0;this.stepNodes.forEach(s=>{const{index:i}=s.props,r=this.$refs.contentNodes[i].$refs.step;if(!r)return;const{top:o,bottom:a}=r.getBoundingClientRect(),l=o-e,c=a-e,u=Math.abs(l+c);(0===n||u<=n)&&(n=u,t=i)}),null!==t&&this.onFocus(t)},getIntersectionTargets(){const{stepNodes:e,$refs:t}=this;return e.map(({props:{index:e}})=>t.contentNodes[e].$refs.step)},onIntersect(e){const{target:t,isIntersecting:n}=e;if(!n)return;const s=parseFloat(t.getAttribute("data-index"));this.intersectionScrollDirection===xi.down&&s===this.stepNodes[this.stepNodes.length-1].props.index&&this.onReverseIntoLastStep(),this.onFocus(s)}},props:{content:{type:Array,required:!0},isRuntimePreviewVisible:{type:Boolean,require:!0},sectionNumber:{type:Number,required:!0}}},$i=Ii,Ni=(0,A.A)($i,Ds,Rs,!1,null,"e3061a7c",null),qi=Ni.exports,Pi={name:"Section",components:{Intro:Ps,LinkableSection:nt,Steps:qi},computed:{introProps(){const[{content:e,media:t},...n]=this.contentSection;return{content:e,expandedSections:n,media:t,sectionAnchor:this.anchor,sectionNumber:this.sectionNumber,title:this.title}}},props:{anchor:{type:String,required:!0},title:{type:String,required:!0},contentSection:{type:Array,required:!0},stepsSection:{type:Array,required:!0},sectionNumber:{type:Number,required:!0},isRuntimePreviewVisible:{type:Boolean,required:!0}},methods:{onRuntimePreviewToggle(e){this.$emit("runtime-preview-toggle",e)}}},Di=Pi,Ri=(0,A.A)(Di,Ss,xs,!1,null,"6b3a0b3a",null),Li=Ri.exports,Oi={name:"SectionList",components:{Section:Li},data(){return{isRuntimePreviewVisible:!0}},props:{tasks:{type:Array,required:!0}},methods:{onRuntimePreviewToggle(e){this.isRuntimePreviewVisible=e}}},Bi=Oi,Mi=(0,A.A)(Bi,As,ks,!1,null,"79a75e9e",null),Fi=Mi.exports;const Vi={assessments:us,hero:Sn,tasks:Fi,callToAction:Dt},ji=new Set(Object.keys(Vi)),Ei={name:"TutorialSection",render:function(e){const{kind:t,...n}=this.section,s=Vi[t];return s?e(s,{props:n}):null},props:{section:{type:Object,required:!0,validator:e=>ji.has(e.kind)}}};var Ui={name:"Tutorial",mixins:[we.A],components:{NavigationBar:_e,Section:Ei,PortalTarget:m.mf,BreakpointEmitter:a.A},inject:["isTargetIDE","store"],computed:{heroSection(){return this.sections.find(({kind:e})=>"hero"===e)},tutorialTitle(){return(this.heroSection||{}).title},pageTitle(){return this.tutorialTitle?`${this.tutorialTitle}${this.metadata.category} Tutorials`:void 0},pageDescription:({heroSection:e,extractFirstParagraphText:t})=>e?t(e.content):null},props:{sections:{type:Array,required:!0},references:{type:Object,required:!0},hierarchy:{type:Object,required:!0},metadata:{type:Object,required:!0},identifierUrl:{type:String,required:!0}},methods:{handleBreakpointChange(e){this.store.updateBreakpoint(e)},handleCodeColorsChange(e){ws.A.updateCodeColors(e)}},created(){v.A.setAvailableLocales(this.metadata.availableLanguages??this.metadata.availableLocales),this.store.reset(),this.store.setReferences(this.references)},watch:{references(e){this.store.setReferences(e)},"metadata.availableLocales":function(e){v.A.setAvailableLocales(this.metadata?.availableLanguages??e)},"metadata.availableLanguages":function(e){v.A.setAvailableLocales(e)}},mounted(){this.$bridge.on("codeColors",this.handleCodeColorsChange),this.$bridge.send({type:"requestCodeColors"})},beforeDestroy(){this.$bridge.off("codeColors",this.handleCodeColorsChange)}},Hi=Ui,zi=(0,A.A)(Hi,bs,_s,!1,null,"f9aca85c",null),Gi=zi.exports,Wi=n(7470),Qi=n(4602);const Ki={article:"article",tutorial:"project"};var Xi={name:"Topic",inject:{isTargetIDE:{default:!1}},mixins:[Wi.A,Qi.A],data(){return{topicData:null}},computed:{navigationBarHeight(){return this.isTargetIDE?0:52},store(){return d},hierarchy(){const{hierarchy:e={}}=this.topicData,{technologyNavigation:t=["overview","tutorials","resources"]}=e||{};return{...e,technologyNavigation:t}},topicKey:({$route:e,topicData:t})=>[e.path,t.identifier.interfaceLanguage].join()},beforeRouteEnter(e,t,n){e.meta.skipFetchingData?n(e=>e.newContentMounted()):(0,o.Dk)(e,t,n).then(t=>n(n=>{(0,r.cu)(e.params.locale,n),n.topicData=t})).catch(n)},beforeRouteUpdate(e,t,n){(0,o.JR)(e,t)?(0,o.Dk)(e,t,n).then(t=>{this.topicData=t,(0,r.cu)(e.params.locale,this),n()}).catch(n):n()},created(){this.store.reset()},mounted(){this.$bridge.on("contentUpdate",this.handleContentUpdateFromBridge)},beforeDestroy(){this.$bridge.off("contentUpdate",this.handleContentUpdateFromBridge)},methods:{componentFor(e){const{kind:t}=e;return{[Ki.article]:Cs,[Ki.tutorial]:Gi}[t]},propsFor(e){const{hierarchy:t,kind:n,metadata:s,references:i,sections:r,identifier:o}=e;return{[Ki.article]:{hierarchy:t,metadata:s,references:i,sections:r,identifierUrl:o.url},[Ki.tutorial]:{hierarchy:t,metadata:s,references:i,sections:r,identifierUrl:o.url}}[n]}},provide(){return{navigationBarHeight:this.navigationBarHeight,store:this.store}},watch:{topicData(){this.$nextTick(()=>{this.newContentMounted()})}}},Ji=Xi,Yi=(0,A.A)(Ji,s,i,!1,null,null,null),Zi=Yi.exports}}]);