/*! * 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 */(function(e){function t(t){for(var o,i,c=t[0],h=t[1],a=t[2],l=0,u=[];l])/g,i=/^-+/,r=/["'&<>]/g;function s(e){return e.trim().replace(o,"-").replace(i,"").toLowerCase()}function c(e){const t=e=>({'"':""","'":"'","&":"&","<":"<",">":">"}[e]||e);return e.replace(r,t)}const h={zero:"zero",one:"one",two:"two",few:"few",many:"many",other:"other"},a={cardinal:"cardinal",ordinal:"ordinal"};function l(e,t){const{cardinal:n}=a,{one:o,other:i}=h,r="en",s=1===t?o:i;if(!e[r]||!e[r][s])throw new Error("No default choices provided to pluralize using default locale "+r);let c=r,l=s;if("Intl"in window&&"PluralRules"in window.Intl){const o=navigator.languages?navigator.languages:[navigator.language],i=new Intl.PluralRules(o,{type:n}),r=i.select(t),s=i.resolvedOptions().locale;e[s]&&e[s][r]&&(c=s,l=r)}return e[c][l]}function u(e){return e.replace(/#(.*)/,(e,t)=>"#"+CSS.escape(t))}function d(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function g(e){let t,n;const o="\\s*",i=" ",r=e.trim(),s=r.length;if(!s)return i;const c=[];for(t=0;t{t=e});return requestAnimationFrame((function e(){n-=1,n<=0?t():requestAnimationFrame(e)})),o}function i(e){return new Promise(t=>{setTimeout(t,e)})}n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i}))},"3e80":function(e,t,n){"use strict";n("bb9e")},"48b1":function(e,t,n){"use strict";n("e487")},"5c0b":function(e,t,n){"use strict";n("9c0c")},"5d2d":function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"c",(function(){return h})),n.d(t,"b",(function(){return a}));const o="developer.setting.";function i(e=localStorage){return{getItem:t=>{try{return e.getItem(t)}catch(n){return null}},setItem:(t,n)=>{try{e.setItem(t,n)}catch(o){}},removeItem:t=>{try{e.removeItem(t)}catch(n){}}}}function r(e){return{get:(t,n)=>{const i=JSON.parse(e.getItem(o+t));return null!==i?i:n},set:(t,n)=>e.setItem(o+t,JSON.stringify(n)),remove:t=>e.removeItem(o+t)}}const s=i(window.localStorage),c=i(window.sessionStorage),h=r(s),a=r(c)},"63b8":function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return i})),n.d(t,"a",(function(){return r})),n.d(t,"d",(function(){return c}));const o={large:"large",medium:"medium",small:"small"},i={default:"default",nav:"nav"},r={[i.default]:{[o.large]:{minWidth:1069,contentWidth:980},[o.medium]:{minWidth:736,maxWidth:1068,contentWidth:692},[o.small]:{minWidth:320,maxWidth:735,contentWidth:280}},[i.nav]:{[o.large]:{minWidth:1024},[o.medium]:{minWidth:768,maxWidth:1023},[o.small]:{minWidth:320,maxWidth:767}}},s={[o.small]:0,[o.medium]:1,[o.large]:2};function c(e,t){return s[e]>s[t]}},6842:function(e,t,n){"use strict";function o(e,t,n){let o,i=e,r=t;for("string"===typeof r&&(r=[r]),o=0;oe.json()).catch(()=>({}))}const c=(e,t)=>o(i,e,t)},7138:function(e,t,n){"use strict";n("813c")},"748c":function(e,t,n){"use strict";n.d(t,"d",(function(){return i})),n.d(t,"a",(function(){return r})),n.d(t,"c",(function(){return s})),n.d(t,"b",(function(){return c}));var o=n("6842");function i(e){return e.reduce((e,t)=>(t.traits.includes("dark")?e.dark.push(t):e.light.push(t),e),{light:[],dark:[]})}function r(e){const t=["1x","2x","3x"];return t.reduce((t,n)=>{const o=e.find(e=>e.traits.includes(n));return o?t.concat({density:n,src:o.url,size:o.size}):t},[])}function s(e){const t="/",n=new RegExp(t+"+","g");return e.join(t).replace(n,t)}function c(e){return e&&"string"===typeof e&&!e.startsWith(o["a"])&&e.startsWith("/")?s([o["a"],e]):e}},"813c":function(e,t,n){},"821b":function(e,t,n){"use strict";t["a"]={auto:{label:"Auto",value:"auto"},dark:{label:"Dark",value:"dark"},light:{label:"Light",value:"light"}}},"942d":function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return r})),n.d(t,"a",(function(){return s}));const o=52,i=48,r="nav-sticky-anchor",s={noClose:"noclose"}},9895:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i}));const o="not-found",i="documentation-topic"},"9b4f":function(e,t,n){},"9c0c":function(e,t,n){},bb9e:function(e,t,n){},d26a:function(e,t,n){"use strict";n.d(t,"c",(function(){return r})),n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return c})),n.d(t,"d",(function(){return h}));var o=n("748c"),i={input:"input",tags:"tags"};function r(e={}){return Object.entries(e).reduce((e,[t,n])=>n?e.concat(`${encodeURIComponent(t)}=${encodeURIComponent(n)}`):e,[]).join("&")}function s(e,{changes:t,language:n,context:o}={}){const[i,s]=e.split("#"),c=i.match(/\?.*/),h=r({changes:t,language:n,context:o}),a=c?"&":"?",l=s?i:e,u=h?`${a}${h}`:"",d=s?"#"+s:"";return`${l}${u}${d}`}function c(e,t){const{query:{changes:n,[i.input]:o,[i.tags]:r,...s}={}}=e,{query:{changes:c,[i.input]:h,[i.tags]:a,...l}={}}=t;return e.name===t.name&&JSON.stringify({path:e.path,query:s})===JSON.stringify({path:t.path,query:l})}function h(e,t=window.location.origin){return new URL(Object(o["b"])(e),t).href}},d369:function(e,t,n){"use strict";var o=n("5d2d");const i={preferredColorScheme:"developer.setting.preferredColorScheme",preferredLanguage:"docs.setting.preferredLanguage"},r={preferredColorScheme:"docs.setting.preferredColorScheme"};t["a"]=Object.defineProperties({},Object.keys(i).reduce((e,t)=>({...e,[t]:{get:()=>{const e=r[t],n=o["a"].getItem(i[t]);return e?n||o["a"].getItem(e):n},set:e=>o["a"].setItem(i[t],e)}}),{}))},e425:function(e,t,n){"use strict";var o=n("821b"),i=n("d369");const r="undefined"!==typeof window.matchMedia&&[o["a"].light.value,o["a"].dark.value,"no-preference"].some(e=>window.matchMedia(`(prefers-color-scheme: ${e})`).matches),s=r?o["a"].auto:o["a"].light;t["a"]={state:{preferredColorScheme:i["a"].preferredColorScheme||s.value,supportsAutoColorScheme:r,systemColorScheme:o["a"].light.value},setPreferredColorScheme(e){this.state.preferredColorScheme=e,i["a"].preferredColorScheme=e},setSystemColorScheme(e){this.state.systemColorScheme=e},syncPreferredColorScheme(){i["a"].preferredColorScheme&&i["a"].preferredColorScheme!==this.state.preferredColorScheme&&(this.state.preferredColorScheme=i["a"].preferredColorScheme)}}},e487:function(e,t,n){},ed96:function(e,t,n){n.p=window.baseUrl},f161:function(e,t,n){"use strict";n.r(t);n("ed96");var o=n("2b0e"),i=n("8c4f"),r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{class:{fromkeyboard:e.fromKeyboard,hascustomheader:e.hasCustomHeader},attrs:{id:"app"}},[n("a",{attrs:{href:"#main",id:"skip-nav"}},[e._v("Skip Navigation")]),n("InitialLoadingPlaceholder"),e._t("header",(function(){return[e.hasCustomHeader?n("custom-header",{attrs:{"data-color-scheme":e.preferredColorScheme}}):e._e()]}),{isTargetIDE:e.isTargetIDE}),n("div",{attrs:{id:e.baseNavStickyAnchorId}}),e._t("default",(function(){return[n("router-view"),e.hasCustomFooter?n("custom-footer",{attrs:{"data-color-scheme":e.preferredColorScheme}}):e.isTargetIDE?e._e():n("Footer")]}),{isTargetIDE:e.isTargetIDE}),e._t("footer",null,{isTargetIDE:e.isTargetIDE})],2)},s=[],c=n("e425"),h=n("821b"),a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("footer",{staticClass:"footer"},[n("div",{staticClass:"row"},[n("ColorSchemeToggle")],1)])},l=[],u=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"color-scheme-toggle",attrs:{"aria-label":"Select a color scheme preference",role:"radiogroup",tabindex:"0"}},e._l(e.options,(function(t){return n("label",{key:t.value},[n("input",{attrs:{type:"radio"},domProps:{checked:t.value==e.preferredColorScheme,value:t.value},on:{input:e.setPreferredColorScheme}}),n("div",{staticClass:"text"},[e._v(e._s(t.label))])])})),0)},d=[],g={name:"ColorSchemeToggle",data:()=>({appState:c["a"].state}),computed:{options:({supportsAutoColorScheme:e})=>[h["a"].light,h["a"].dark,...e?[h["a"].auto]:[]],preferredColorScheme:({appState:e})=>e.preferredColorScheme,supportsAutoColorScheme:({appState:e})=>e.supportsAutoColorScheme},methods:{setPreferredColorScheme:e=>{c["a"].setPreferredColorScheme(e.target.value)}},watch:{preferredColorScheme:{immediate:!0,handler(e){document.body.dataset.colorScheme=e}}}},f=g,m=(n("2be1"),n("2877")),p=Object(m["a"])(f,u,d,!1,null,"4472ec1e",null),j=p.exports,v={name:"Footer",components:{ColorSchemeToggle:j}},w=v,b=(n("2de0"),Object(m["a"])(w,a,l,!1,null,"72f2e2dc",null)),y=b.exports,S=function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.loaded?e._e():n("div",{staticClass:"InitialLoadingPlaceholder",attrs:{id:"loading-placeholder"}})},E=[],C={name:"InitialLoadingPlaceholder",data(){return{loaded:!1}},created(){const e=()=>{this.loaded=!0};this.$router.onReady(e,e)}},_=C,P=(n("48b1"),Object(m["a"])(_,S,E,!1,null,"35c356b6",null)),T=P.exports,k=n("942d"),O=n("6842");function A(e,t){return e&&"object"===typeof e&&Object.prototype.hasOwnProperty.call(e,t)&&"string"===typeof e[t]}function x(e,t,n,o){if(!t||"object"!==typeof t||o&&(A(t,"light")||A(t,"dark"))){let i=t;if(A(t,o)&&(i=t[o]),"object"===typeof i)return;n[e]=i}else Object.entries(t).forEach(([t,i])=>{const r=[e,t].join("-");x(r,i,n,o)})}function I(e,t="light"){const n={},o=e||{};return x("-",o,n,t),n}var L={name:"CoreApp",components:{Footer:y,InitialLoadingPlaceholder:T},provide(){return{isTargetIDE:this.isTargetIDE,performanceMetricsEnabled:"true"===Object({NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}).VUE_APP_PERFORMANCE_ENABLED}},data(){return{appState:c["a"].state,fromKeyboard:!1,isTargetIDE:"ide"===Object({NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}).VUE_APP_TARGET,themeSettings:O["d"],baseNavStickyAnchorId:k["d"]}},computed:{currentColorScheme:({appState:e})=>e.systemColorScheme,preferredColorScheme:({appState:e})=>e.preferredColorScheme,CSSCustomProperties:({themeSettings:e,currentColorScheme:t})=>I(e.theme,t),hasCustomHeader:()=>!!window.customElements.get("custom-header"),hasCustomFooter:()=>!!window.customElements.get("custom-footer")},props:{enableThemeSettings:{type:Boolean,default:!0}},watch:{CSSCustomProperties:{immediate:!0,handler(e){this.detachStylesFromRoot(e),this.attachStylesToRoot(e)}}},async created(){window.addEventListener("keydown",this.onKeyDown),this.$bridge.on("navigation",this.handleNavigationRequest),this.enableThemeSettings&&Object.assign(this.themeSettings,await Object(O["b"])()),window.addEventListener("pageshow",this.syncPreferredColorScheme),this.$once("hook:beforeDestroy",()=>{window.removeEventListener("pageshow",this.syncPreferredColorScheme)})},mounted(){(document.querySelector(".footer-current-year")||{}).innerText=(new Date).getFullYear(),this.attachColorSchemeListeners()},beforeDestroy(){this.fromKeyboard?window.removeEventListener("mousedown",this.onMouseDown):window.removeEventListener("keydown",this.onKeyDown),this.$bridge.off("navigation",this.handleNavigationRequest),this.detachStylesFromRoot(this.CSSCustomProperties)},methods:{onKeyDown(){this.fromKeyboard=!0,window.addEventListener("mousedown",this.onMouseDown),window.removeEventListener("keydown",this.onKeyDown)},onMouseDown(){this.fromKeyboard=!1,window.addEventListener("keydown",this.onKeyDown),window.removeEventListener("mousedown",this.onMouseDown)},handleNavigationRequest(e){this.$router.push(e)},attachColorSchemeListeners(){if(!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)");e.addListener(this.onColorSchemePreferenceChange),this.$once("hook:beforeDestroy",()=>{e.removeListener(this.onColorSchemePreferenceChange)}),this.onColorSchemePreferenceChange(e)},onColorSchemePreferenceChange({matches:e}){const t=e?h["a"].dark:h["a"].light;c["a"].setSystemColorScheme(t.value)},attachStylesToRoot(e){const t=document.documentElement;Object.entries(e).filter(([,e])=>Boolean(e)).forEach(([e,n])=>{t.style.setProperty(e,n)})},detachStylesFromRoot(e){const t=document.documentElement;Object.entries(e).forEach(([e])=>{t.style.removeProperty(e)})},syncPreferredColorScheme(){c["a"].syncPreferredColorScheme()}}},$=L,D=(n("5c0b"),n("3e80"),Object(m["a"])($,r,s,!1,null,"6f639c59",null)),N=D.exports;class R{constructor(){this.$send=()=>{}}send(e){this.$send(e)}}class U{constructor(){const{webkit:{messageHandlers:{bridge:e={}}={}}={}}=window;this.bridge=e;const{postMessage:t=(()=>{})}=e;this.$send=t.bind(e)}send(e){this.$send(e)}}class M{constructor(e=new R){this.backend=e,this.listeners={}}send(e){this.backend.send(e)}receive(e){this.emit(e.type,e.data)}emit(e,t){this.listeners[e]&&this.listeners[e].forEach(e=>e(t))}on(e,t){this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t)}off(e,t){this.listeners[e]&&this.listeners[e].delete(t)}}var B={install(e,t){let n;n=t.performanceMetricsEnabled||"ide"===t.appTarget?new U:new R,e.prototype.$bridge=new M(n)}};function W(e){return"custom-"+e}function V(e){return class extends HTMLElement{constructor(){super();const t=this.attachShadow({mode:"open"}),n=e.content.cloneNode(!0);t.appendChild(n)}}}function q(e){const t=W(e),n=document.getElementById(t);n&&window.customElements.define(t,V(n))}function F(e,t={names:["header","footer"]}){const{names:n}=t;e.config.ignoredElements=/^custom-/,n.forEach(q)}function H(e,t){const{value:n=!1}=t;e.style.display=n?"none":""}var K={hide:H};function G(e,{performanceMetrics:t=!1}={}){e.config.productionTip=!1,e.use(F),e.directive("hide",K.hide),e.use(B,{appTarget:Object({NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}).VUE_APP_TARGET,performanceMetricsEnabled:t}),window.bridge=e.prototype.$bridge,e.config.performance=t}var J=n("9895"),z=n("63b8"),Y=n("3908"),X=n("002d"),Q=n("d26a");function Z(){const{location:e}=window;return e.pathname+e.search+e.hash}function ee(){const e=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0);return ePromise.all([n.e("documentation-topic~topic~tutorials-overview"),n.e("tutorials-overview")]).then(n.bind(null,"f025"))},{path:"/tutorials/:id/*",name:"topic",component:()=>Promise.all([n.e("documentation-topic~topic~tutorials-overview"),n.e("topic")]).then(n.bind(null,"3213"))},{path:"/documentation/*",name:J["a"],component:()=>Promise.all([n.e("documentation-topic~topic~tutorials-overview"),n.e("documentation-topic")]).then(n.bind(null,"f8ac"))},{path:"*",name:J["b"],component:ye},{path:"*",name:"server-error",component:me}];function Ee(e={}){const t=new i["a"]({mode:"history",base:O["a"],scrollBehavior:te,...e,routes:e.routes||Se});return t.onReady(()=>{"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),ne()}),"ide"!==Object({NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}).VUE_APP_TARGET&&t.onError(e=>{const{route:n={path:"/"}}=e;t.replace({name:"server-error",params:[n.path]})}),window.addEventListener("unload",oe),t}o["default"].use(G),o["default"].use(i["a"]),new o["default"]({router:Ee(),render:e=>e(N)}).$mount("#app")},fb1e:function(e,t,n){}});