1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6223],{36223:(e,t,n)=>{n.r(t),n.d(t,{OptimizelyCms12Client:()=>a,default:()=>s});var o=n(22507);let i=(0,o.J1)`query GetAllRoutes($cursor: String, $pageSize: Int = 100, $typeFilter: [String] = "Page", $siteId: String = null) 2{ 3Content( 4 where: { 5 _and: { 6 _and: { 7 RelativePath: { exist: true } 8 ContentType: { in: $typeFilter } 9 SiteId: { eq: $siteId } 10 } 11 RelativePath: { notIn: [""] } 12 } 13 }, 14 limit: $pageSize, 15 cursor: $cursor 16) { 17 items { 18 path: RelativePath 19 locale:Language { name: Name } 20 contentLink: ContentLink { id: Id, workId: WorkId, guidValue: GuidValue } 21 name: Name 22 contentType: ContentType 23 slug: RouteSegment 24 changed: Changed 25 published: StartPublish 26 siteId: SiteId 27 url: Url 28 }, 29 cursor, 30 total 31} 32}`,r=(0,o.J1)`query GetRouteById($id: Int!, $workId: Int, $locale: [Locales]!) { 33Content( 34 where: { 35 ContentLink: { 36 Id: { 37 eq: $id 38 } 39 WorkId: { 40 eq: $workId 41 } 42 } 43 }, 44 locale: $locale 45 limit: 1, 46 orderBy: { 47 ContentLink: { 48 WorkId: DESC 49 } 50 Status: ASC 51 } 52) 53{ 54 total, 55 items { 56 route: RelativePath 57 url: Url 58 locale:Language { name: Name } 59 contentLink: ContentLink { id: Id, workId: WorkId, guidValue: GuidValue } 60 name: Name, 61 contentType: ContentType, 62 slug: RouteSegment, 63 changed: Changed, 64 published: StartPublish 65 siteId: SiteId 66 } 67} 68}`,l=(0,o.J1)`query GetRouteByPath($path: [String!]!, $siteId: String) { 69Content( 70 where: { 71 _and: { 72 RelativePath: { 73 in: $path 74 }, 75 SiteId: { 76 eq:$siteId 77 } 78 } 79 } 80) 81{ 82 total, 83 items { 84 route: RelativePath 85 url: Url 86 locale:Language { name: Name } 87 contentLink: ContentLink { id: Id, workId: WorkId, guidValue: GuidValue } 88 name: Name, 89 contentType: ContentType, 90 slug: RouteSegment, 91 changed: Changed, 92 published: StartPublish 93 siteId: SiteId 94 } 95} 96}`;class a{enablePreview(){throw Error("The CMS 12 implementation does not support preview mode")}disablePreview(){throw Error("The CMS 12 implementation does not support preview mode")}async getRoutes(e,t){e.updateFlags({queryCache:!1},!0);let n=await e.request(i,{siteId:t,typeFilter:"Page"}),o=n?.Content?.items??[],r=n?.Content?.total??0,l=n?.Content?.cursor??"";if(r>0&&""!==l&&r>o.length)for(;(n?.Content?.items?.length??0)>0&&o.length<r;)n=await e.request({document:i,variables:{cursor:l,siteId:t,typeFilter:"Page"}}),o=o.concat(n.Content?.items??[]);return e.restoreFlags(),o.map(this.tryConvertResponse.bind(this)).filter(this.isNotNullOrUndefined)}async getRouteByPath(e,t,n){e.debug&&console.log(`Resolving content info for ${t} on ${n?"site "+n:"all sites"}`);let o=await e.request({document:l,variables:{path:t,siteId:n}});if((o.Content?.items?.length??0)===0){e.debug&&console.warn("No items in the resultset");return}if((o.Content?.items?.length??0)>1)throw Error("Ambiguous URL provided, did you omit the siteId in a multi-channel setup?");return e.debug&&console.log(`Resolved content info for ${t} to:`,o.Content.items[0]),this.convertResponse(o.Content.items[0])}async getRouteById(e,t,n,o){let[i,l]=this.parseIdString(t),a={id:i,workId:l,locale:n.replaceAll("-","_")};e.debug&&console.log("Resolving content by id:",JSON.stringify(a));let s=await e.request({document:r,variables:a});if(s.Content?.total>=1)return e.debug&&s.Content?.total>1&&console.warn(`Received multiple entries with this ID, returning the first one from: ${(s.Content?.items||[]).map(e=>`${e.contentLink.id}_${e.contentLink.workId}_${e.locale.name}`).join("; ")}`),this.convertResponse(s.Content.items[0])}parseIdString(e){let t=-1,n=null;if(e.indexOf("_")>0)[t,n]=e.split("_").map(e=>{try{return Number.parseInt(e,10)}catch{return -1}}),n<0&&(n=null);else try{t=Number.parseInt(e,10)}catch{t=-1}return[t,n]}convertResponse(e){return{...e,url:new URL(e.url),key:e.contentLink?.guidValue||"",version:e.contentLink?.workId?.toString(),locale:e.locale.name,changed:e.changed?new Date(e.changed):null}}tryConvertResponse(e){try{return this.convertResponse(e)}catch(t){console.error(`Unable to convert ${JSON.stringify(e)} to Route`,t);return}}isNotNullOrUndefined(e){return null!=e&&void 0!=e}}let s=a}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.