(()=>{"use strict";var e={17006:(e,t,r)=>{r.d(t,{L:()=>s});var n=r(376231),o=r(653722),i=r(735283);class s extends o.A{constructor(e){super({exec:async(t,r,o)=>{n.w.checkState(t===i.Vm.serviceName);return function(e,t){if(!e.ok)throw new Error(`Encountered an error while sending ${t} request: ${e.error}`);if(null==e.value)throw new Error(`${t}: Result cannot be empty`);return e.value}(await e.request(r,o),r)},requestChannel:void 0},i.Vm)}}},57214:(e,t,r)=>{r.d(t,{m:()=>n});const n={now:()=>Date.now()}},73331:(e,t,r)=>{function n(e){const t=new MutationObserver((t=>{t.some((e=>[...e.addedNodes].some((e=>e===document.documentElement))))&&e()}));return t.observe(document,{childList:!0}),()=>t.disconnect()}r.d(t,{P:()=>n})},101819:(e,t,r)=>{r.d(t,{d:()=>o});var n=r(133599);const o=n.X.createMessage((()=>({top:n.X.requiredDouble("top",1),left:n.X.requiredDouble("left",2),width:n.X.requiredDouble("width",3),height:n.X.requiredDouble("height",4)})),{dualDeserializationConfig:n.y.MINI_PRIMARY_FULL_SECONDARY})},106780:(e,t,r)=>{r.d(t,{B:()=>n.B});var n=r(887271)},111903:(e,t,r)=>{r.d(t,{e:()=>o});var n=r(718214);function o(e,t,r,o,i){return e.handle(t,(async e=>{const s=function(e,t,r){if(void 0===r)throw new n.cC({code:"internal_error",message:`${e}: request cannot be undefined.`});return t.deserialize(r)}(t,r,e),a=await o(s);if(i)return i.serialize(a)}))}},131834:(e,t,r)=>{r.d(t,{a:()=>i});var n=r(133599),o=r(101819);const i=n.X.createMessage((()=>({targetRect:n.X.requiredObject("targetRect",1,o.d),block:n.X.optionalString("block",2),inline:n.X.optionalString("inline",3),behavior:n.X.optionalString("behavior",4),documentWidth:n.X.optionalDouble("documentWidth",5),documentHeight:n.X.optionalDouble("documentHeight",6)})),{dualDeserializationConfig:n.y.MINI_PRIMARY_FULL_SECONDARY})},133599:(e,t,r)=>{r.d(t,{X:()=>p,y:()=>S});var n=r(106780),o=r(376231),i=r(758754);const s={STRING:{typeOfValue:"string"},BOOLEAN:{typeOfValue:"boolean",defaultValue:!1,fixedSize:1},DOUBLE:{typeOfValue:"number",defaultValue:0,fixedSize:8},INT32:{typeOfValue:"number",defaultValue:0},INT64:{typeOfValue:"number",defaultValue:0},BYTES:{typeOfValue:"Uint8Array"}};function a(e,t,r,n,o,i,s,a,l,c,d){return{tag:e,fieldLabel:t,typeOfValue:r,jsonFullKey:n,jsonFullValue:o,value:i,defaults:s,default:a,defaultValue:l,obj:c,typeOfKey:d}}function l(e){const{tag:t,jsonFullKeyOrJsonMiniKey:r,jsonFullValue:n,value:o,defaults:s}=e,l=r===T?void 0:r;return a(t,i.d.CONSTANT,"string",l,n,o,s,void 0,void 0,void 0,void 0)}function c(e,t,r,n){return a(r,i.d.REQUIRED,e.typeOfValue,t,void 0,void 0,void 0,null!=n?n:e.defaultValue,e.defaultValue,void 0,void 0)}function d(e,t,r){return a(r,i.d.OPTIONAL,e.typeOfValue,t,void 0,void 0,void 0,void 0,e.defaultValue,void 0,void 0)}function u(e,t,r){return a(r,i.d.REPEATED,e.typeOfValue,t,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}function h(e,t){return(r,n,o)=>{const{tag:s,jsonFullKey:l,other1:c}=M(r,n,o);let d;return d="object"===t?"object":"enum"===t?"string":t.typeOfValue,a(s,i.d.MAP,d,l,void 0,void 0,void 0,void 0,void 0,c,e.typeOfValue)}}class p{static constantString(e,t,r,n){const{tag:o,jsonFullKey:i,other1:s}=M(t,r,n);return l({tag:o,jsonFullKeyOrJsonMiniKey:e,jsonFullValue:i,value:s,defaults:!1})}static constantStringWithDefault(e,t,r,n){const{tag:o,jsonFullKey:i,other1:s}=M(t,r,n);return l({tag:o,jsonFullKeyOrJsonMiniKey:e,jsonFullValue:i,value:s,defaults:!0})}static requiredObject(e,t,r){const{tag:n,jsonFullKey:o,other1:s}=M(e,t,r);return a(n,i.d.REQUIRED,"object",o,void 0,void 0,void 0,void 0,void 0,s,void 0)}static optionalObject(e,t,r){const{tag:n,jsonFullKey:o,other1:s}=M(e,t,r);return a(n,i.d.OPTIONAL,"object",o,void 0,void 0,void 0,void 0,void 0,s,void 0)}static repeatedObject(e,t,r){const{tag:n,jsonFullKey:o,other1:s}=M(e,t,r);return a(n,i.d.REPEATED,"object",o,void 0,void 0,void 0,void 0,void 0,s,void 0)}static requiredStringEnum(e,t,r,n){const{tag:o,jsonFullKey:s,other1:l,other2:c}=M(e,t,r,n);return a(o,i.d.REQUIRED,"string",s,void 0,void 0,void 0,c,void 0,l,void 0)}static optionalStringEnum(e,t,r){const{tag:n,jsonFullKey:o,other1:s}=M(e,t,r);return a(n,i.d.OPTIONAL,"string",o,void 0,void 0,void 0,void 0,void 0,s,void 0)}static repeatedStringEnum(e,t,r){const{tag:n,jsonFullKey:o,other1:s}=M(e,t,r);return a(n,i.d.REPEATED,"string",o,void 0,void 0,void 0,void 0,void 0,s,void 0)}static createMessage(e,t={}){const r=(0,n.B)((()=>{const r=e(),n=Object.keys(r),s={},a={};for(let e=0;eString.fromCodePoint(e))).join("");return btoa(t)}(e):n.obj?n.obj.serializeWithPath(e,r):e}static deserialize(e){return s.deserializeWithPath(e,[])}static deserializeValue(e,t,r){const{config:n}=t;return"Uint8Array"===n.typeOfValue?(o=e,Uint8Array.from(atob(o),(e=>e.codePointAt(0)))):n.obj?n.obj.deserializeWithPath(e,r):e;var o}static deserializeWithPath(e,t){const{fieldMetadata:n}=r(),a=Object.create(s.prototype);for(let r=0;r{throw new TypeError(`Unproducible oneof case ${E(t)}`)}:(e,t)=>{if(null==e||"object"!=typeof e)throw new TypeError(`Expected type object, found: ${O(e)} ${E(t)}`);const{fieldMetadata:n}=r(),a={};for(let r=0;r{const n=e(),o=Object.keys(n)[0];let s,a;const l=new Map,c=new Map,d=new Map;for(let e=0;e{const{discriminatorKey:r,nameToObject:n}=o(),i=e[r],s=n.get(i);if(!s)throw new TypeError(`Unknown oneof deserialized case: ${JSON.stringify(i)} ${E(t)}`);return s.serializeWithPath(e,t)},a=(e,t)=>{const{serializedToObject:r,discriminatorJsonKeyEncodings:n,defaultObject:i}=o(),{primaryJsonKey:s,secondaryJsonKey:a}=n;let l=e[s];if(null==l&&a&&(l=e[a]),null==l&&i)return i.deserializeWithPath(e,t);const c=r.get(l);if(!c)throw new TypeError(`Unknown oneof serialized case: ${JSON.stringify(l)} ${E(t)}`);return c.deserializeWithPath(e,t)};return{init:o,serialize:e=>s(e,[]),serializeWithPath:s,deserialize:e=>a(e,[]),deserializeWithPath:a}}static createEnumUtil(e,t=0,r={}){const o=(0,n.B)((()=>{const n=e(),o=[],i=new Map,s=new Map,a=new Map,l=new Map,c=new Set;let d=0,u=1;for(;d{const{unproducible:n}=o();if(n&&n.has(e))throw new TypeError(`Unproducible enum value: ${JSON.stringify(e)} ${r?E(r):""}`);const i=t.get(e);if(null==i)throw new TypeError(`The proto enum serializer failed to serialize value ${JSON.stringify(e)} into JSON.\nIt does not recognize value ${JSON.stringify(e)} as a valid member of the TypeScript enum.\n${r?E(r):""}`);return i},s=(e,t)=>{const r=o().serializedToValue.get(e);if(null==r)throw new TypeError(`The proto enum deserializer failed to deserialize JSON ${JSON.stringify(e)} into an enum value.\nIt does not recognize JSON ${JSON.stringify(e)} as a valid JSON value encoding of the enum.\n${E(t)}`);return r};return{values:()=>o().values,producibleValues:()=>{const{values:e,unproducible:t}=o();return null==t?e:e.filter((e=>!t.has(e)))},serialize:e=>i(e,o().valueToSerialized,[]),serializeWithPath:(e,t)=>i(e,o().valueToSerialized,t),deserialize:e=>s(e,[]),deserializeWithPath:s}}}function y(e,t){return Object.entries(e).map((([e,r])=>{const n=function(e,t){let r,n=I(e.tag-1);if(e.fieldLabel===i.d.CONSTANT){const{primary:o,secondary:i}=f(n,e.jsonFullValue,t);n=T,r={primaryJsonValue:o,secondaryJsonValue:i}}const{primary:o,secondary:s}=f(n,e.jsonFullKey,t);return{keyEncodings:{primaryJsonKey:o,secondaryJsonKey:s},valueEncodings:r}}(r,t);return{config:r,name:e,primaryJsonKey:n.keyEncodings.primaryJsonKey,secondaryJsonKey:n.keyEncodings.secondaryJsonKey,primaryJsonValue:n.valueEncodings?.primaryJsonValue,secondaryJsonValue:n.valueEncodings?.secondaryJsonValue}}))}function f(e,t,r){if(!t){if(void 0!==r)throw new Error("Dual Deserialization config templated but JSON full key/value wasn't");return{primary:e,secondary:void 0}}if(void 0===r)return{primary:t,secondary:void 0};if(0===r)return{primary:e,secondary:t};if(1===r)return{primary:t,secondary:e};throw new Error("function should have been exhaustive, but wasn't")}function g(e,t,r,n){return new TypeError(`Expected repeated ${r} value for key ${w(e)}, found: ${O(t)} ${E(n)}`)}function m(e,t,r,n){return new TypeError(`Expected optional ${r} value for key ${w(e)}, found: ${O(t)} ${E(n)}`)}function v(e,t,r,n,o){return new TypeError(`Expected ${r} value${void 0!==o?` at index ${o}`:""} for key ${w(e)}, found: ${O(t)} ${E(n)}`)}function w(e){const{primaryJsonKey:t,secondaryJsonKey:r}=e;return r?`either "${t}" OR "${r}"`:`"${t}"`}function b(e){const{primaryJsonValue:t,secondaryJsonValue:r}=e;return r?`either "${t}" OR "${r}"`:`"${t}"`}function E(e){return`(path: .${e.join(".")})`}function O(e){return null===e?"null":Array.isArray(e)?"array":typeof e}p.requiredDouble=(e,t,r)=>{const{tag:n,jsonFullKey:o,other1:i}=M(e,t,r);return c(s.DOUBLE,o,n,i)},p.requiredInt32=(e,t,r)=>{const{tag:n,jsonFullKey:o,other1:i}=M(e,t,r);return c(s.INT32,o,n,i)},p.requiredInt64=(e,t,r)=>{const{tag:n,jsonFullKey:o,other1:i}=M(e,t,r);return c(s.INT64,o,n,i)},p.optionalDouble=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return d(s.DOUBLE,n,r)},p.optionalInt32=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return d(s.INT32,n,r)},p.optionalInt64=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return d(s.INT64,n,r)},p.repeatedDouble=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return u(s.DOUBLE,n,r)},p.repeatedInt32=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return u(s.INT32,n,r)},p.repeatedInt64=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return u(s.INT64,n,r)},p.requiredString=(e,t,r)=>{const{tag:n,jsonFullKey:o,other1:i}=M(e,t,r);return c(s.STRING,o,n,i)},p.optionalString=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return d(s.STRING,n,r)},p.repeatedString=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return u(s.STRING,n,r)},p.requiredBoolean=(e,t,r)=>{const{tag:n,jsonFullKey:o,other1:i}=M(e,t,r);return c(s.BOOLEAN,o,n,i)},p.optionalBoolean=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return d(s.BOOLEAN,n,r)},p.repeatedBoolean=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return u(s.BOOLEAN,n,r)},p.requiredBytes=(e,t,r)=>{const{tag:n,jsonFullKey:o,other1:i}=M(e,t,r);return c(s.BYTES,o,n,i)},p.optionalBytes=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return d(s.BYTES,n,r)},p.repeatedBytes=(e,t)=>{const{tag:r,jsonFullKey:n}=M(e,t);return u(s.BYTES,n,r)},p.booleanInt64Map=h(s.BOOLEAN,s.INT64),p.int32Int32Map=h(s.INT32,s.INT32),p.int32Int64Map=h(s.INT32,s.INT64),p.int32BoolMap=h(s.INT32,s.BOOLEAN),p.int32DoubleMap=h(s.INT32,s.DOUBLE),p.int32StringMap=h(s.INT32,s.STRING),p.int32StringEnumMap=h(s.INT32,"enum"),p.int32ObjectMap=h(s.INT32,"object"),p.int32BytesMap=h(s.INT32,s.BYTES),p.int64Int32Map=h(s.INT64,s.INT32),p.int64Int64Map=h(s.INT64,s.INT64),p.int64BooleanMap=h(s.INT64,s.BOOLEAN),p.int64DoubleMap=h(s.INT64,s.DOUBLE),p.int64StringMap=h(s.INT64,s.STRING),p.int64StringEnumMap=h(s.INT64,"enum"),p.int64ObjectMap=h(s.INT64,"object"),p.int64BytesMap=h(s.INT64,s.BYTES),p.doubleInt32Map=h(s.DOUBLE,s.INT32),p.doubleInt64Map=h(s.DOUBLE,s.INT64),p.doubleBoolMap=h(s.DOUBLE,s.BOOLEAN),p.doubleDoubleMap=h(s.DOUBLE,s.DOUBLE),p.doubleStringMap=h(s.DOUBLE,s.STRING),p.doubleStringEnumMap=h(s.DOUBLE,"enum"),p.doubleObjectMap=h(s.DOUBLE,"object"),p.doubleBytesMap=h(s.DOUBLE,s.BYTES),p.stringInt32Map=h(s.STRING,s.INT32),p.stringInt64Map=h(s.STRING,s.INT64),p.stringBooleanMap=h(s.STRING,s.BOOLEAN),p.stringDoubleMap=h(s.STRING,s.DOUBLE),p.stringStringMap=h(s.STRING,s.STRING),p.stringStringEnumMap=h(s.STRING,"enum"),p.stringObjectMap=h(s.STRING,"object"),p.stringBytesMap=h(s.STRING,s.BYTES);const S={MINI_PRIMARY_FULL_SECONDARY:0,FULL_PRIMARY_MINI_SECONDARY:1},T="A?",N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function I(e){if(e0;)t.push(N.charAt(e%N.length)),e=Math.floor(e/N.length);return t.reverse().join("")}}function M(e,t,r,n){return"string"==typeof e?{jsonFullKey:e,tag:t,other1:r,other2:n}:{tag:e,other1:t,other2:r}}function R(e,t){return typeof e===t||function(e,t){return"Uint8Array"===t&&"string"==typeof e}(e,t)}},175104:(e,t,r)=>{r.d(t,{J:()=>o,w:()=>n});class n{static checkArgument(e,t,...r){if(!e)throw new Error(null==t?"invalid argument":n.format(t,...r))}static checkState(e,t,...r){if(!e)throw new Error(null==t?"invalid state":n.format(t,...r))}static checkEquals(e,t,r,...o){if(e!==t)throw new Error(null==r?n.format("{} != {}",n.stringify(e),n.stringify(t)):n.format(r,...o))}static stringify(e){if(null==e||"symbol"==typeof e)return String(e);try{return JSON.stringify(e)}catch(t){return String(e)}}static checkExists(e,t,...r){if(null==e)throw new Error(null==t?"argument is null":n.format(t,...r));return e}static format(e,...t){let r=0;return e.replace(/\{}/g,(()=>r{r.d(t,{C:()=>n});class n{static ok(e){return new n(!0,e,void 0)}static error(e){return new n(!1,void 0,e)}get isOk(){return this._success}get isError(){return!this._success}get data(){if(!this._success)throw new Error("Cannot access data on error result");return this._data}get error(){if(this._success)throw new Error("Cannot access error on success result");return this._error}constructor(e,t,r){this._success=e,this._data=t,this._error=r}}},235548:(e,t,r)=>{r.d(t,{Q:()=>i});var n=r(133599),o=r(646120);const i=n.X.createMessage((()=>({body:n.X.requiredObject("body",1,o.E)})),{dualDeserializationConfig:n.y.MINI_PRIMARY_FULL_SECONDARY})},248590:(e,t,r)=>{r.d(t,{J:()=>n,X:()=>o});class n extends Error{constructor(){super("[internal_error] Comms promise timed out.")}}class o{reset(e){e&&(this.timeoutMs=e),this.setTimeout()}resolve(e){clearTimeout(this.timeoutId),this.resolveFn(e)}reject(e){clearTimeout(this.timeoutId),this.rejectFn(e)}promise(){return this.p}rejectOnNextTick(){this.timeoutId=setTimeout((()=>{this.rejectFn(new n)}),500)}setTimeout(){clearTimeout(this.timeoutId),this.timeoutId=setTimeout((()=>{this.rejectOnNextTick()}),Math.max(this.timeoutMs-500,500))}constructor(e){this.timeoutMs=e,this.p=new Promise(((e,t)=>{this.resolveFn=e,this.rejectFn=t})),this.setTimeout()}}},299865:(e,t,r)=>{r.d(t,{N:()=>o});var n=r(786190);class o{log(e,...t){console[e](n.K,`[CLIENT (${this.context})]`,...t)}report(e,t,...r){const[n,o]=r;this.beforeReportHandlers.forEach((e=>e(t,n,o))),this.log(e,...r)}createChild(e){const t=new o(`${this.context}:${e}`);return t.beforeReportHandlers=this.beforeReportHandlers,t}withOfflineStatus(){}setContext(e){this.log("debug","context set",e)}setTag(e,t){this.log("debug","tag set",e,t)}addBeforeSendHandler(){}addBeforeReportHandler(e){this.beforeReportHandlers.push(e)}setFilters(){}setSensitiveStrings(e){}addBreadCrumb(e){this.log("debug","breadcrumb added",e)}debug(e,t){this.report("debug","debug",e,t)}info(...e){this.report("info","info",...e)}warn(...e){this.report("warn","warning",...e)}warning(e,t){this.report("warn","warning",e,t)}warningException(e,t){this.report("warn","warning",e,t)}error(e,t){this.report("error","error",e,t)}errorException(e,t){this.report("error","error",e,t)}critical(e,t){this.report("error","fatal",e,t)}criticalException(e,t){this.report("error","fatal",e,t)}constructor(e){this.context=e,this.beforeReportHandlers=[]}}},309809:(e,t,r)=>{r.d(t,{J:()=>i});var n=r(57214),o=r(328392);class i{request(e){if(e.scrollWidth===this.lastReportedWidth&&e.scrollHeight===this.lastReportedHeight)return;const t=this.clock.now(),r=t-this.lastRequestAtMs<100;this.lastRequestAtMs=t,r?this.rapidCount++:(this.rapidCount=0,this.minScrollHeight=1/0,this.latched=!1),this.minScrollHeight=Math.max(this.minBodyHeightPx??0,Math.min(this.minScrollHeight,e.scrollHeight)),this.rapidCount>=80?this.latched||(this.latched=!0,this.throttledEmit.cancel(),this.errorService.warning(`Resize loop detected: ${this.rapidCount} reports at under 100ms apart. Pinning the height to ${this.minScrollHeight}px and stopping further reports.`),this.emit({...e,scrollHeight:this.minScrollHeight})):this.rapidCount>=40?this.throttledEmit(e):this.emit(e)}forceReport(e){this.throttledEmit.cancel(),this.rapidCount=0,this.minScrollHeight=1/0,this.latched=!1,this.lastRequestAtMs=this.clock.now(),this.emit(e)}emit(e){this.lastReportedWidth=e.scrollWidth,this.lastReportedHeight=e.scrollHeight,this.report(e)}constructor(e,t,r,i=n.m){this.report=e,this.minBodyHeightPx=t,this.errorService=r,this.clock=i,this.lastRequestAtMs=-1/0,this.rapidCount=0,this.minScrollHeight=1/0,this.latched=!1,this.throttledEmit=(0,o.n)((e=>this.emit(e)),250)}}},328392:(e,t,r)=>{function n(e,t=10){let r,n;function o(){e(...r??[]),n=r=void 0}function i(...e){r=e,n||(n=setTimeout(o,t))}return i.cancel=()=>{clearTimeout(n),n=r=void 0},i}r.d(t,{n:()=>n})},344832:(e,t,r)=>{r.d(t,{W:()=>n});const n=r(133599).X.createMessage((()=>({})))},376231:(e,t,r)=>{r.d(t,{J:()=>n.J,w:()=>n.w});var n=r(175104)},409346:(e,t,r)=>{r.d(t,{a:()=>i});var n=r(573699),o=r(563316);function i({hostRpcService:e,serviceName:t,methodName:r,spanName:i,tracer:s,serializeRequest:a,deserializeResponse:l}){if(null!=r)return async(c,{parentSpan:d}={})=>{if(null==s||null==i||null==d)return l(await e.exec(t,r,a(c)));const u=s.startSpan(i,d),h=(0,o.X)(u);try{const o=l(await e.exec(t,r,a(c),{traceContext:h}));return u.end(n.nW.OK),o}catch(p){throw u.end(n.nW.ERROR),p}}}},438342:(e,t,r)=>{r.d(t,{a:()=>o});var n=r(133599);const o=n.X.createMessage((()=>({handled:n.X.requiredBoolean(1)})))},488051:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(376231),o=r(658435),i=r(500383),s=r(697604);async function a(e,t,{parent:r,addEventListener:a,removeEventListener:l}=window,c){const d=Promise.withResolvers(),u=({ports:t,data:r})=>{const o=(0,s.lT)(r,"parent",c);if(!o.ok){switch(o.error){case s.Gz.INVALID_SOURCE:e.info(o.error,{errorMessagePrefix:"failed to verify message",extra:new Map([["data.sandboxCommsSource",r?.sandboxCommsSource]])});break;case s.Gz.MISSING_DATA:case s.Gz.MISSING_SOURCE:case s.Gz.UNKNOWN_CLIENT_ID:break;default:throw new n.J(o.error)}return}if(1!==t.length)return void e.error("invalid number of ports received from the parent");const[i]=t;d.resolve(i)};a("message",u);try{const n=(0,s.v7)("iframe",c);r.postMessage(n,t);const a=await d.promise;return o.Q.Ok(new i.I(a,e.createChild("comms"),!1))}catch(h){return o.Q.Err(h)}finally{l("message",u)}}},500383:(e,t,r)=>{r.d(t,{I:()=>a});var n=r(376231),o=r(841857),i=r(611411),s=r(749972);class a{constructor(e,t,r){this.request=(e,t)=>this.client.request(e,t),this.handle=(e,t)=>this.requestHandler.handle(e,t),this.addErrorObserver=e=>this.requestHandler.addErrorObserver(e);const o=new l((e=>{switch(e.type){case"ack":case"error":case"response":return void this.client.handleReply(e);case"request":return void this.requestHandler.handleRequest(e);default:throw new n.J(e)}}),e,t.createChild("bus"));this.client=new i.K(o.sendRequest,t.createChild("client")),this.requestHandler=new s.w(o,t.createChild("requestHandler"),r)}}class l{sendResponse(e,t){return this.bus.send({type:"response",requestId:e,payload:t})}sendError(e,t,r){return this.bus.send({type:"error",requestId:e,code:t,message:r})}sendAck(e){return this.bus.send({type:"ack",requestId:e})}constructor(e,t,r){this.handleMessage=e,this.sendRequest=(e,t,r)=>this.bus.send({type:"request",requestId:e,path:t,payload:r}),this.onReceive=e=>{switch(e.type){case"ack":return void this.handleMessage({type:"ack",requestId:e.requestId});case"error":return void this.handleMessage({type:"error",requestId:e.requestId,code:e.code,message:e.message});case"response":return void this.handleMessage({type:"response",requestId:e.requestId,payload:e.payload});case"request":return void this.handleMessage({type:"request",requestId:e.requestId,path:e.path,payload:e.payload});default:throw new n.J(e)}},this.bus=new o.Q({receive:this.onReceive},t,r)}}},560350:(e,t,r)=>{r.d(t,{Y:()=>o});var n=r(133599);const o=n.X.createMessage((()=>({viewportHeight:n.X.requiredInt32("viewportHeight",1),minBodyHeight:n.X.optionalInt32("minBodyHeight",2)})),{dualDeserializationConfig:n.y.MINI_PRIMARY_FULL_SECONDARY})},563316:(e,t,r)=>{function n(e){const t=e.spanContext();return`00-${t.traceId}-${t.spanId}-${e.isSampled()?"01":"00"}`}r.d(t,{X:()=>n})},573699:(e,t,r)=>{r.d(t,{nW:()=>n});const n={UNSET:"unset",OK:"ok",ERROR:"error"}},592756:(e,t,r)=>{function n(){const e=window.navigation;null==e?document.addEventListener("click",i,{capture:!0}):e.addEventListener("navigate",o)}function o(e){const t=new URL(e.destination.url);s(t)&&(e.preventDefault(),window.open(t,"_blank","noopener,noreferrer"))}function i(e){if(!(e.target instanceof Element))return;const t=e.target.closest("a");if(!(t instanceof HTMLAnchorElement)||""===t.href)return;s(new URL(t.href,document.baseURI))&&(t.target="_blank",t.relList.add("noopener","noreferrer"))}function s(e){return("http:"===e.protocol||"https:"===e.protocol)&&e.origin!==window.location.origin}r.d(t,{x:()=>n})},611411:(e,t,r)=>{r.d(t,{K:()=>c});var n=r(376231),o=r(658435),i=r(737329),s=r(718214),a=r(624859),l=r(248590);class c{request(e,t){const r=this.pendingRequests,n=this.recentTimedOutRequests,i=new l.X(a.FU),c=this.requestIdGenerator(),d=async function(){r.set(c,{path:e,requestPromise:i});try{const e=await i.promise();return o.Q.Ok(e)}catch(t){return t instanceof l.J?(n.set(c,[e,Date.now()]),n.size>32&&n.delete(n.keys().next().value),o.Q.Err(new s.cC({code:"internal_error",message:`Comms promise timed out (${e}).`}))):o.Q.Err(t)}finally{r.delete(c)}}(),u=this.send(c,e,t);return u.ok||(this.errorService.errorException(u.error,{errorMessagePrefix:"unable to send request",tags:new Map([["type","request"],["path",e]])}),i.reject(u.error)),d}handleReply(e){const{requestId:t,type:r}=e,{path:o,requestPromise:i}=this.pendingRequests.get(t)||{};if(i)switch(r){case"response":return void i.resolve(e.payload);case"ack":return void i.reset(a.I6);case"error":this.errorService.addBreadCrumb({level:"info",category:"sandbox_comms",message:"Error response received",data:{path:o??"unknown"}});const{code:t,message:r}=e;return void i.reject(new s.cC({code:t,message:r}));default:throw new n.J(e)}else if("ack"!==r){const[e,n]=this.recentTimedOutRequests.get(t)??["not_recently_timed_out",void 0],o=void 0!==n?new Map([["time_since_timeout",Date.now()-n]]):void 0;this.errorService.error("request has already been handled and resolved or was not sent from this client",{tags:new Map([["type",r],["path",e]]),extra:o})}}constructor(e,t,r=i.g){this.send=e,this.errorService=t,this.requestIdGenerator=r,this.pendingRequests=new Map,this.recentTimedOutRequests=new Map}}},624859:(e,t,r)=>{r.d(t,{FU:()=>o,I6:()=>i,MY:()=>n});const n=9e3,o=2e4,i=3e4},646120:(e,t,r)=>{r.d(t,{E:()=>o});var n=r(133599);const o=n.X.createMessage((()=>({scrollWidth:n.X.requiredInt32("scrollWidth",1),scrollHeight:n.X.requiredInt32("scrollHeight",2),offsetWidth:n.X.requiredInt32("offsetWidth",3),offsetHeight:n.X.requiredInt32("offsetHeight",4)})),{dualDeserializationConfig:n.y.MINI_PRIMARY_FULL_SECONDARY})},648290:(e,t,r)=>{r.d(t,{O:()=>u});var n=r(376231),o=r(763186),i=r(735283),s=r(73331),a=r(209369),l=r(592756),c=r(309809),d=r(848026);class u{setupHashNavigationScrolling(){const e=()=>{if(window.addEventListener("hashchange",this.handleHashChange),""!==window.location.hash){const e=window.location.hash;this.resetHashSilently(),this.maybeScrollToHash(e)}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}resetHashSilently(){try{window.history.replaceState(window.history.state,"",window.location.pathname+window.location.search)}catch{}}maybeScrollToHash(e){const t=e.startsWith("#")?e.slice(1):e;let r;try{r=decodeURIComponent(t)}catch{r=t}const n=this.findHashTarget(r);if(null==n)return;const o={behavior:"smooth",block:"start",inline:"nearest"},i=(0,d.$)(n,window,o);return null!=i?null==this.commsClient?(this.pendingHash=e,void this.scrollTargetInterceptor.nativeScrollIntoView(n,o)):void this.requestHostScroll(i).then((e=>{e||this.scrollTargetInterceptor.nativeScrollIntoView(n,o)})):void 0}findHashTarget(e){if(""===e||"top"===e)return document.documentElement;const t=document.getElementById(e);return null!=t?t:document.getElementsByName(e)[0]}emitProgrammaticScrollTarget(e){null!=this.commsClient&&this.requestHostScroll(e)}async requestHostScroll(e){try{const t=await(this.commsClient?.scrollTargetIntoView?.(e));return!0===t?.handled}catch(t){return this.errorService.warning(`scrollTargetIntoView failed: ${String(t)}`),!1}}observeStyleSheets(){new MutationObserver((e=>{let t=!1;for(const r of e)switch(r.type){case"childList":t=t||[...r.addedNodes,...r.removedNodes].some((e=>{if(e.nodeType===Node.ELEMENT_NODE&&e!==this.stylesOverride){const t=e.tagName.toLowerCase();return"style"===t||"link"===t}}));break;case"characterData":{const e=r.target.parentElement;if(null==e)return;t=t||"style"===e.tagName.toLowerCase()&&e!==this.stylesOverride;break}}t&&this.overrideViewportHeightUnits()})).observe(document,{childList:!0,subtree:!0,characterData:!0}),this.overrideViewportHeightUnits()}overrideViewportHeightUnits(){const e=[];for(const t of document.styleSheets)if(t.ownerNode!==this.stylesOverride)for(const r of this.maybeGetCssRuleList(t)??[]){if(null==r||!(r instanceof CSSStyleRule))continue;const t=[];for(const e of["height","minHeight"]){const n=this.overrideAttributeViewportHeight(r.style,e);n&&t.push(n)}t.length>0&&e.push(`${r.selectorText} { ${t.join(" ")} }`)}0!==e.length&&(this.stylesOverride.innerText=e.join("\n"),null==this.stylesOverride.parentNode&&document.head.appendChild(this.stylesOverride))}overrideAttributeViewportHeight(e,t){const r=this.getAttributeViewportHeightValue(e,t);if(null==r)return;return`${t.replace(/([A-Z])/g,(e=>`-${e[0].toLowerCase()}`))}: ${r} !important;`}getAttributeViewportHeightValue(e,t){const[r,n]=e[t]?.match(/([\\.\d]+)?[sld]?vh/)??[];if(null!=n)return`calc(${n} * min(var(--vh, 1vh), 1vh))`}maybeGetCssRuleList(e){try{return e.cssRules}catch(t){if(t instanceof DOMException&&"SecurityError"===t.name)return;throw t}}setViewportHeight(e){const t=null==this.minBodyHeightPx?"auto":`${e}px`;document.documentElement.style.height=t,document.documentElement.style.setProperty("--vh",e/100+"px"),document.documentElement.style.overflow="visible",document.documentElement.style.scrollbarWidth="none",document.documentElement.style.fontSize="clamp(12px, calc(10.2241px + 0.4228vw), 16px)"}applyBodyMinHeight(){null!=document.body&&(null==this.minBodyHeightPx?document.body.style.removeProperty("min-height"):document.body.style.minHeight=`${this.minBodyHeightPx}px`)}async setupParentCommunication(){const e=await this.connectToParent(this.errorService,"*",window,i.eI);if(!e.ok)return a.C.error(new Error("Failed to connect to parent"));if((0,i.bB)(e.value,{setViewport:this.handleSetViewport}),this.setViewportHeight(this.viewportHeightPx),null==globalThis.ResizeObserver)this.errorService.warning("ResizeObserver is not supported");else{const e=new c.J((e=>{this.commsClient?.resized({body:e})}),this.minBodyHeightPx,this.errorService),t=()=>{const{scrollWidth:e,scrollHeight:t,offsetWidth:r,offsetHeight:n}=document.body;return{scrollWidth:Math.max(e,window.innerWidth),scrollHeight:Math.max(t,this.minBodyHeightPx??0),offsetWidth:r,offsetHeight:n}};this.reportDimensions=()=>e.request(t()),this.reportDimensionsNow=()=>e.forceReport(t());const r=new globalThis.ResizeObserver((()=>this.reportDimensions?.())),o=e=>{e.tagName.toLowerCase().startsWith("canva-")||r.observe(e,{box:"border-box"})},i=new MutationObserver((e=>{for(const t of e)"childList"===t.type&&(t.addedNodes.forEach((e=>{e.nodeType===Node.ELEMENT_NODE&&o(e)})),t.removedNodes.forEach((e=>{e.nodeType===Node.ELEMENT_NODE&&r.unobserve(e)})))})),a=e=>{if(e.hasAttribute("style"))for(const t of["height","minHeight"]){const r=this.getAttributeViewportHeightValue(e.style,t);if(r){const n=t.replace(/([A-Z])/g,(e=>`-${e[0].toLowerCase()}`));e.style.setProperty(n,r)}}},l=new MutationObserver((e=>{const t=new Set;for(const r of e)switch(r.type){case"attributes":r.target instanceof HTMLElement&&t.add(r.target);break;case"childList":r.addedNodes.forEach((e=>{e instanceof HTMLElement&&(t.add(e),e.querySelectorAll("[style]").forEach((e=>a(e))))}));break;case"characterData":continue;default:throw new n.J(r.type)}t.forEach((e=>a(e)))})),d=()=>{o(document.body);for(const e of document.body.children)o(e);i.observe(document.body,{childList:!0}),document.querySelectorAll("[style]").forEach((e=>a(e))),l.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style"]})},u=()=>{r.disconnect(),i.disconnect(),l.disconnect(),null!=document.body&&(this.setViewportHeight(this.viewportHeightPx),this.applyBodyMinHeight(),d(),this.overrideViewportHeightUnits(),this.reportDimensionsNow?.())},h=()=>{this.applyBodyMinHeight(),this.observeStyleSheets(),d(),(0,s.P)(u)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",h):h()}this.errorService.info("Successfully connected to parent"),this.commsClient=this.createResizingClientComms(e.value);const t=this.pendingHash;return this.pendingHash=void 0,null!=t&&this.maybeScrollToHash(t),a.C.ok(this.commsClient)}constructor(e,t,r){this.connectToParent=e,this.createResizingClientComms=t,this.errorService=r,this.stylesOverride=document.createElement("style"),this.viewportHeightPx=768,this.minBodyHeightPx=768,this.handleHashChange=e=>{let t=window.location.hash;if(""!==e.newURL)try{t=new URL(e.newURL).hash}catch{}this.resetHashSilently(),this.maybeScrollToHash(t)},this.handleSetViewport=async e=>(this.viewportHeightPx=e.viewportHeight,this.minBodyHeightPx=e.minBodyHeight,this.setViewportHeight(e.viewportHeight),this.applyBodyMinHeight(),this.reportDimensionsNow?.(),new o.i),this.scrollTargetInterceptor=(0,d.Z)({emit:e=>this.emitProgrammaticScrollTarget(e),win:window}),this.setupParentCommunication(),this.setupHashNavigationScrolling(),(0,l.x)()}}},653722:(e,t,r)=>{r.d(t,{A:()=>l});var n=r(409346),o=r(235548),i=r(344832),s=r(131834),a=r(438342);class l{resized(e){return this.hostRpc.exec(this.capabilities.serviceName,this.capabilities.resized,o.Q.serialize(e)).then(i.W.deserialize)}constructor(e,t){this.hostRpc=e,this.capabilities=t,this.scrollTargetIntoView=(0,n.a)({hostRpcService:this.hostRpc,serviceName:this.capabilities.serviceName,methodName:this.capabilities.scrollTargetIntoView,serializeRequest:s.a.serialize,deserializeResponse:a.a.deserialize})}}},658435:(e,t,r)=>{r.d(t,{Q:()=>i});class n{get ok(){return!0}map(e){return new n(e(this.value))}flatMap(e){return e(this.value)}mapError(){return this}get(){return this.value}constructor(e){this.value=e}}class o{get ok(){return!1}map(){return this}mapError(e){return new o(e(this.error))}flatMap(){return this}get(){}constructor(e){this.error=e}}const i={Ok:function(e){return void 0===e?s:new n(e)},Err:function(e){return void 0===e?a:new o(e)}},s=new n(void 0),a=new o(void 0)},697604:(e,t,r)=>{r.d(t,{Gz:()=>o,lT:()=>s,v7:()=>i});var n=r(658435);const o={MISSING_DATA:"missing 'data' field in MessageEvent",MISSING_SOURCE:"'sandboxCommsSource' is missing in MessageEvent data object",INVALID_SOURCE:"invalid source",UNKNOWN_CLIENT_ID:"unknown client id"};function i(e,t){return{sandboxCommsSource:e,clientId:t}}function s(e,t,r){if(!e)return n.Q.Err("missing 'data' field in MessageEvent");const o=e,i=o.sandboxCommsSource;return i?i!==t?n.Q.Err("invalid source"):o.clientId!==r?n.Q.Err("unknown client id"):n.Q.Ok():n.Q.Err("'sandboxCommsSource' is missing in MessageEvent data object")}},718214:(e,t,r)=>{r.d(t,{cC:()=>o});var n=r(903661);class o extends Error{constructor(e){e.code=i(e.code),super((0,n.C)(e)),this.code=e.code,this.name="CanvaError",this.rawMessage=e.message,Object.setPrototypeOf(this,o.prototype)}}let i=e=>e},735283:(e,t,r)=>{r.d(t,{Vm:()=>a,bB:()=>c,eI:()=>s});r(235548),r(344832),r(131834),r(438342);var n=r(560350),o=r(763186),i=r(111903);const s="canva-code-resizing-sdk",a={serviceName:s,resized:"RESIZE_EVENT",scrollTargetIntoView:"SCROLL_TARGET_INTO_VIEW"},l={serviceName:s,setViewport:"SET_VIEWPORT"};function c(e,t){(0,i.e)(e,l.setViewport,n.Y,(e=>t.setViewport(e)),o.i)}},737329:(e,t,r)=>{function n(e){const t=o(e,31);let r=0;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(function(e){const n=Number(e);return(n^t[r++]&15>>n/4).toString(16)}))}r.d(t,{g:()=>n});function o(e,t){if(!e&&"undefined"!=typeof window&&void 0!==window.crypto&&"function"==typeof window.crypto.getRandomValues)return window.crypto.getRandomValues(new Uint8Array(t));const r=e??Math.random;return Array.from({length:t},(()=>Math.floor(255*r())))}},749972:(e,t,r)=>{r.d(t,{w:()=>l});var n=r(718214),o=r(624859);const i=()=>"Something went wrong on our end, if this issue persists please contact us.",s=e=>`No request handler configured for path: "${e}".`,a=e=>`Handler for '${e}' is already defined.`;class l{addErrorObserver(e){return this.errorObservers.add(e),()=>this.errorObservers.delete(e)}handle(e,t){if(this.requestHandler.has(e))throw new n.cC({code:"internal_error",message:a(e)});return this.requestHandler.set(e,t),()=>this.requestHandler.delete(e)}async handleRequest(e){const{requestId:t,path:r,payload:a}=e,l=this.requestHandler.get(r);if(!l){const e=this.messenger.sendError(t,"internal_error",s(r));return void(e.ok||this.errorService.criticalException(e.error,{errorMessagePrefix:"unable to send error response",tags:new Map([["type","request"],["path",r]])}))}this.messenger.sendAck(t);const c=setInterval((()=>this.messenger.sendAck(t)),o.MY);let d;try{const e=await l(a);clearInterval(c),this.messenger.sendResponse(t,e)}catch(u){clearInterval(c);let e="internal_error",o=i();u instanceof n.cC?(d=u,"internal_error"===u.code?this.errorService.errorException(u,{errorMessagePrefix:"Internal error in comms handler",tags:new Map([["type","request"],["path",r]])}):(e=u.code,o=u.rawMessage)):this.reportNonCanvaErrors?this.errorService.errorException(u,{errorMessagePrefix:"Unexpected error type thrown from comms handler",tags:new Map([["type","request"],["path",r]])}):this.devConsole.error(u);const s=this.messenger.sendError(t,e,o);s.ok||this.errorService.criticalException(s.error,{errorMessagePrefix:"unable to send error response",tags:new Map([["type","request"],["path",r]])})}if(null!=d)for(const n of this.errorObservers)try{n(d)}catch(u){this.errorService.warningException(u,{errorMessagePrefix:"Error executing errorObserver"})}}constructor(e,t,r,n=console){this.messenger=e,this.errorService=t,this.reportNonCanvaErrors=r,this.devConsole=n,this.requestHandler=new Map,this.errorObservers=new Set}}},758754:(e,t,r)=>{r.d(t,{d:()=>n.dh,g:()=>n.gs});var n=r(923410)},763186:(e,t,r)=>{r.d(t,{i:()=>n});const n=r(133599).X.createMessage((()=>({})))},786190:(e,t,r)=>{r.d(t,{K:()=>n});const n=Symbol("canvaSystemLog")},841857:(e,t,r)=>{r.d(t,{Q:()=>i});var n=r(658435),o=r(718214);class i{constructor(e,t,r){this.handler=e,this.port=t,this.errorService=r,this.send=e=>{try{return this.port.postMessage(e),n.Q.Ok()}catch(t){return this.errorService.errorException(t),n.Q.Err(t)}},this.onMessageError=e=>{this.errorService.errorException(e)},this.onMessage=({data:e})=>{if(e)try{this.handler.receive(e)}catch(t){this.errorService.errorException(t)}else this.errorService.error(new o.cC({code:"internal_error",message:"missing data in 'MessageEvent'"}))},this.port.onmessage=this.onMessage,this.port.onmessageerror=this.onMessageError}}},848026:(e,t,r)=>{r.d(t,{$:()=>a,Z:()=>s});var n=r(131834),o=r(101819);const i=Symbol("codeletOriginalScrollIntoView");function s({emit:e,win:t}){const r=function(e){const t=e;return[t.Element.prototype,t.HTMLElement.prototype].find((e=>Object.prototype.hasOwnProperty.call(e,"scrollIntoView")))??t.Element.prototype}(t),n=Object.prototype.hasOwnProperty.call(r,i);let o=r.scrollIntoView;function s(e,t){if("function"==typeof o)try{o.call(e,t)}catch{}}function l(r){s(this,r);const n=a(this,t,r);if(null!=n)try{e(n)}catch{}}return n&&(o=r[i]??void 0),r[i]=o??null,r.scrollIntoView=l,{nativeScrollIntoView:s,dispose:()=>{r.scrollIntoView===l&&(null==o?delete r.scrollIntoView:r.scrollIntoView=o,delete r[i])}}}function a(e,t,r){let i;try{i=e.getBoundingClientRect()}catch{return}const s=e.ownerDocument.documentElement,a=e.ownerDocument.body,l=Math.max(s.scrollWidth,a?.scrollWidth??0,t.innerWidth),c=Math.max(s.scrollHeight,a?.scrollHeight??0,t.innerHeight);if(![i.top,i.left,i.width,i.height,t.scrollY,t.scrollX,l,c].every(Number.isFinite)||l<=0||c<=0)return;const d=function(e){return!1===e?{block:"end",inline:"nearest",behavior:"auto"}:"object"==typeof e&&null!=e?{block:e.block??"start",inline:e.inline??"nearest",behavior:e.behavior??"auto"}:{block:"start",inline:"nearest",behavior:"auto"}}(r),u=e===s;return new n.a({targetRect:new o.d({top:u?0:i.top+t.scrollY,left:u?0:i.left+t.scrollX,width:i.width,height:i.height}),block:d.block,inline:d.inline,behavior:d.behavior,documentWidth:l,documentHeight:c})}},887271:(e,t,r)=>{r.d(t,{B:()=>o});var n=r(175104);function o(e,{invalidateOnError:t}={invalidateOnError:!1}){let r,o=!1,i=!1;return(...s)=>{if(n.w.checkArgument(0===s.length),!i||t&&(!r.ok||o))try{o=!1,r={ok:!0,value:e()},i=!0,null!=(a=r.value)&&null!=a.then&&r.value.then(null,(e=>o=!0))}catch(l){r={ok:!1,error:l},i=!0}var a;if(r.ok)return r.value;throw r.error}}},903661:(e,t,r)=>{r.d(t,{C:()=>n});const n=e=>{const t=e.message.endsWith(".")?"":".";return`[${e.code}]: ${e.message}${t}`.trim()}},923410:(e,t,r)=>{r.d(t,{dh:()=>o,gs:()=>n});const n={CONCRETE:1,ONEOF:2},o={CONSTANT:1,REQUIRED:2,OPTIONAL:3,REPEATED:4,MAP:5}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n=r(488051),o=r(17006),i=r(299865),s=r(648290);const a=function(){const e=window.telemetrySdk?.errorService;return e?.createChild("Resizing")??new i.N("Resizing")}();new s.O(n.A,(e=>new o.L(e)),a)})(); //# sourceMappingURL=sourcemaps/a6de989e8af05ea5.resizing_sdk.js.map