@uniformdev/canvas 17.5.1-alpha.130 → 17.5.1-alpha.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var ae=Object.create;var x=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var ue=(t,e,n)=>e in t?x(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Se=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,n)=>(typeof require!="undefined"?require:e)[n]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var Oe=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),be=(t,e)=>{for(var n in e)x(t,n,{get:e[n],enumerable:!0})},U=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ce(e))!le.call(t,r)&&r!==n&&x(t,r,{get:()=>e[r],enumerable:!(o=pe(e,r))||o.enumerable});return t};var de=(t,e,n)=>(n=t!=null?ae(me(t)):{},U(e||!t||!t.__esModule?x(n,"default",{value:t,enumerable:!0}):n,t)),De=t=>U(x({},"__esModule",{value:!0}),t);var Me=(t,e,n)=>(ue(t,typeof e!="symbol"?e+"":e,n),n),j=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var v=(t,e,n)=>(j(t,e,"read from private field"),n?n.call(t):e.get(t)),V=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},he=(t,e,n,o)=>(j(t,e,"write to private field"),o?o.call(t,n):e.set(t,n),n),Ne=(t,e,n,o)=>({set _(r){he(t,e,r,n)},get _(){return v(t,e,o)}});var F=I((Ge,$)=>{function g(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}$.exports=g;g.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};g.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};g.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},n),this._options.unref&&this._timer.unref(),!0};g.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};g.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};g.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};g.prototype.start=g.prototype.try;g.prototype.errors=function(){return this._errors};g.prototype.attempts=function(){return this._attempts};g.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,n=0,o=0;o<this._errors.length;o++){var r=this._errors[o],s=r.message,i=(t[s]||0)+1;t[s]=i,i>=n&&(e=r,n=i)}return e}});var k=I(P=>{var fe=F();P.operation=function(t){var e=P.timeouts(t);return new fe(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};P.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],r=0;r<e.retries;r++)o.push(this.createTimeout(r,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(r,e)),o.sort(function(s,i){return s-i}),o};P.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,o=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return o=Math.min(o,e.maxTimeout),o};P.wrap=function(t,e,n){if(e instanceof Array&&(n=e,e=null),!n){n=[];for(var o in t)typeof t[o]=="function"&&n.push(o)}for(var r=0;r<n.length;r++){var s=n[r],i=t[s];t[s]=function(a){var d=P.operation(e),l=Array.prototype.slice.call(arguments,1),c=l.pop();l.push(function(u){d.retry(u)||(u&&(arguments[0]=d.mainError()),c.apply(this,arguments))}),d.attempt(function(){a.apply(t,l)})}.bind(t,i),t[s].options=e}}});var z=I((Ue,J)=>{J.exports=k()});import{ApiClient as Pe}from"@uniformdev/context/api";var W=de(z(),1),ye=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"]),w=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},Ce=(t,e,n)=>{let o=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=o,t},ge=t=>ye.has(t),H=t=>globalThis.DOMException===void 0?new Error(t):new DOMException(t);async function S(t,e){return new Promise((n,o)=>{e={onFailedAttempt(){},retries:10,...e};let r=W.default.operation(e);r.attempt(async s=>{try{n(await t(s))}catch(i){if(!(i instanceof Error)){o(new TypeError(`Non-error was thrown: "${i}". You should only throw errors.`));return}if(i instanceof w)r.stop(),o(i.originalError);else if(i instanceof TypeError&&!ge(i.message))r.stop(),o(i);else{Ce(i,s,e);try{await e.onFailedAttempt(i)}catch(p){o(p);return}r.retry(i)||o(r.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{r.stop();let s=e.signal.reason===void 0?H("The operation was aborted."):e.signal.reason;o(s instanceof Error?s:H(s))},{once:!0})})}var O=class extends Error{constructor(){super("Throttled function aborted"),this.name="AbortError"}};function b({limit:t,interval:e,strict:n}){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(e))throw new TypeError("Expected `interval` to be a finite number");let o=new Map,r=0,s=0;function i(){let l=Date.now();return l-r>e?(s=1,r=l,0):(s<t?s++:(r+=e,s=1),r-l)}let p=[];function a(){let l=Date.now();if(p.length<t)return p.push(l),0;let c=p.shift()+e;return l>=c?(p.push(l),0):(p.push(c),c-l)}let d=n?a:i;return l=>{let c=function(...u){if(!c.isEnabled)return(async()=>l.apply(this,u))();let f;return new Promise((C,m)=>{f=setTimeout(()=>{C(l.apply(this,u)),o.delete(f)},d()),o.set(f,m)})};return c.abort=()=>{for(let u of o.keys())clearTimeout(u),o.get(u)(new O);o.clear(),p.splice(0,p.length)},c.isEnabled=!0,c}}function Z({throttle:t={interval:1e3,limit:10},retry:e={retries:1,factor:1.66}}){let n=t?b(t):null;return function(r){let s=async()=>await r();if(n&&(s=n(s)),e){let i=s;s=()=>S(i,e)}return s()}}var E=async t=>await t();var D=class extends Pe{constructor(n){n.limitPolicy||(n.limitPolicy=Z({}));super(n);this.canvasUrl="/api/v1/canvas"}async getCompositionList(n){let{projectId:o}=this.options,r=this.createUrl(this.canvasUrl,{...n,projectId:o});return await this.apiClient(r)}unstable_getCompositionByNodePath(n){return this.getOneComposition(n)}unstable_getCompositionByNodeId(n){return this.getOneComposition(n)}getCompositionBySlug(n){return this.getOneComposition(n)}getCompositionById(n){return this.getOneComposition(n)}getOneComposition({unstable_resolveData:n,unstable_dynamicVariables:o,unstable_dataDiagnostics:r,...s}){let{projectId:i}=this.options,p=n?"/api/edge/v1/composition":this.canvasUrl,a={};return n&&(o&&(a.dynamicVariables=JSON.stringify(o)),r&&(a.dataDiagnostics="true")),this.apiClient(this.createUrl(p,{...s,...a,projectId:i}))}async updateComposition(n){let o=this.createUrl("/api/v1/canvas");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComposition(n){let o=this.createUrl("/api/v1/canvas"),{projectId:r}=this.options;await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:r}),expectNoContent:!0})}async getComponentDefinitions(n){let{projectId:o}=this.options,r=this.createUrl("/api/v1/canvas-definitions",{...n,projectId:o});return await this.apiClient(r)}async updateComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}},Y=class extends D{constructor(e){super({...e,bypassCache:!0})}};import{ApiClient as Ee}from"@uniformdev/context/api";var M="/api/v1/data-source",Te="/api/v1/data-sources",q=class extends Ee{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(M,{...e,projectId:n});return await this.apiClient(o)}async getList(e){let{projectId:n}=this.options,o=this.createUrl(Te,{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(M);await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(M);await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}};import{ApiClient as xe}from"@uniformdev/context/api";var T,_=class extends xe{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(v(_,T),{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(v(_,T));await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(v(_,T));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},N=_;T=new WeakMap,V(N,T,"/api/v1/data-types");var B=class{constructor(e,n,o){this._resolve=e;this._reject=n;this.args=o;this._isCompleted=!1}resolve(e){this._resolve(e),this._isCompleted=!0}reject(e){this._reject(e),this._isCompleted=!0}get isCompleted(){return this._isCompleted}};function st({handleBatch:t,shouldQueue:e,limitPolicy:n}){let o=[];return{enhanceOne:async i=>{if(!e||e(i))return new Promise((p,a)=>{o.push(new B(p,a,i))})},completeAll:async()=>{if(o.length>0){try{await t(o)}catch(p){o.forEach(a=>a.reject(p))}if(o.some(p=>!p.isCompleted))throw new Error("The completeAll() function failed to resolve or reject all promises in the batch!")}let i=o.length;return o=[],i},limitPolicy:n}}var at=(t,...e)=>({enhanceOne:o=>{let r="enhanceOne"in t?t.enhanceOne(o):t(o);for(let s of e){let i=ve(r)?r:Promise.resolve(r),p="enhanceOne"in s?s.enhanceOne:s;r=i.then(a=>p({...o,parameter:{type:o.parameter.type,value:a}}))}return r},completeAll:async()=>{var o,r;for(let s of e)if("completeAll"in s)throw new Error("Only the first enhancer in a compose chain can use the completeAll function (batching)");return(r="completeAll"in t?(o=t.completeAll)==null?void 0:o.call(t):0)!=null?r:0}});function ve(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function A(t,e,n){var s;let o=[{ancestorsAndSelf:[{component:t,parentSlot:void 0,parentSlotIndex:void 0}],context:n}],r=new Map;do{let i=o.pop();if(!i)continue;let p=i.ancestorsAndSelf[0],a=!0,d=(s=r.get(p.component))!=null?s:i.context;e(p.component,i.ancestorsAndSelf,{replaceComponent:c=>{Object.assign(p.component,c),["parameters","variant","slots","data","_pattern","_patternError"].forEach(f=>{c[f]||delete p.component[f]})},removeComponent:()=>{let{parentSlot:c,parentSlotIndex:u}=i.ancestorsAndSelf[0],f=i.ancestorsAndSelf[1];if(c&&typeof u!="undefined")f.component.slots[c].splice(u,1);else throw new Error("Unable to delete composition.")},insertAfter:c=>{let u=Array.isArray(c)?c:[c],{parentSlot:f,parentSlotIndex:C}=i.ancestorsAndSelf[0],m=i.ancestorsAndSelf[1];if(f&&typeof C!="undefined")m.component.slots[f].splice(C+1,0,...u),o.unshift(...u.map(h=>({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return m.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})));else throw new Error("Unable to insert after a component not in a slot.")},stopProcessingDescendants(){a=!1},setDescendantsContext(c){d=c},setChildContext(c,u){r.set(c,u)}},d);let l=p.component.slots;if(a&&l){let c=Object.keys(l);for(let u=c.length-1;u>=0;u--){let f=c[u],C=l[f];for(let m=C.length-1;m>=0;m--){let h=C[m];o.push({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return p.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})}}}}while(o.length>0)}function G(t){let e=[];for(let n=t.length-1;n>=0;n--){let{parentSlot:o,parentSlotIndex:r}=t[n];o&&r!==void 0&&e.push(`${o}[${r}]`)}return`.${e.join(".")}`}function ct(t,{withSlots:e=!1}={}){let n=[];for(let o=t.length-1;o>=0;o--){let{parentSlot:r,parentSlotIndex:s}=t[o];r&&s!==void 0&&n.push(`${r}/${s}`)}return e?`/slots/${n.join("/slots/")}`:`/${n.join("/")}`}async function ht({composition:t,enhancers:e,context:n,onErrors:o=r=>{throw new Error(r.map(s=>`${s.message}
1
+ var ae=Object.create;var x=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var ue=(t,e,n)=>e in t?x(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Se=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,n)=>(typeof require!="undefined"?require:e)[n]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var Oe=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),De=(t,e)=>{for(var n in e)x(t,n,{get:e[n],enumerable:!0})},U=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ce(e))!le.call(t,r)&&r!==n&&x(t,r,{get:()=>e[r],enumerable:!(o=pe(e,r))||o.enumerable});return t};var de=(t,e,n)=>(n=t!=null?ae(me(t)):{},U(e||!t||!t.__esModule?x(n,"default",{value:t,enumerable:!0}):n,t)),be=t=>U(x({},"__esModule",{value:!0}),t);var Me=(t,e,n)=>(ue(t,typeof e!="symbol"?e+"":e,n),n),j=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var _=(t,e,n)=>(j(t,e,"read from private field"),n?n.call(t):e.get(t)),V=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},he=(t,e,n,o)=>(j(t,e,"write to private field"),o?o.call(t,n):e.set(t,n),n),Ne=(t,e,n,o)=>({set _(r){he(t,e,r,n)},get _(){return _(t,e,o)}});var F=I((Ge,$)=>{function g(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}$.exports=g;g.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};g.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};g.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},n),this._options.unref&&this._timer.unref(),!0};g.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};g.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};g.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};g.prototype.start=g.prototype.try;g.prototype.errors=function(){return this._errors};g.prototype.attempts=function(){return this._attempts};g.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,n=0,o=0;o<this._errors.length;o++){var r=this._errors[o],s=r.message,i=(t[s]||0)+1;t[s]=i,i>=n&&(e=r,n=i)}return e}});var k=I(P=>{var fe=F();P.operation=function(t){var e=P.timeouts(t);return new fe(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};P.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],r=0;r<e.retries;r++)o.push(this.createTimeout(r,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(r,e)),o.sort(function(s,i){return s-i}),o};P.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,o=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return o=Math.min(o,e.maxTimeout),o};P.wrap=function(t,e,n){if(e instanceof Array&&(n=e,e=null),!n){n=[];for(var o in t)typeof t[o]=="function"&&n.push(o)}for(var r=0;r<n.length;r++){var s=n[r],i=t[s];t[s]=function(a){var d=P.operation(e),l=Array.prototype.slice.call(arguments,1),c=l.pop();l.push(function(u){d.retry(u)||(u&&(arguments[0]=d.mainError()),c.apply(this,arguments))}),d.attempt(function(){a.apply(t,l)})}.bind(t,i),t[s].options=e}}});var J=I((Ue,H)=>{H.exports=k()});import{ApiClient as Pe}from"@uniformdev/context/api";var W=de(J(),1),ye=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"]),w=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},Ce=(t,e,n)=>{let o=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=o,t},ge=t=>ye.has(t),z=t=>globalThis.DOMException===void 0?new Error(t):new DOMException(t);async function S(t,e){return new Promise((n,o)=>{e={onFailedAttempt(){},retries:10,...e};let r=W.default.operation(e);r.attempt(async s=>{try{n(await t(s))}catch(i){if(!(i instanceof Error)){o(new TypeError(`Non-error was thrown: "${i}". You should only throw errors.`));return}if(i instanceof w)r.stop(),o(i.originalError);else if(i instanceof TypeError&&!ge(i.message))r.stop(),o(i);else{Ce(i,s,e);try{await e.onFailedAttempt(i)}catch(p){o(p);return}r.retry(i)||o(r.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{r.stop();let s=e.signal.reason===void 0?z("The operation was aborted."):e.signal.reason;o(s instanceof Error?s:z(s))},{once:!0})})}var O=class extends Error{constructor(){super("Throttled function aborted"),this.name="AbortError"}};function D({limit:t,interval:e,strict:n}){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(e))throw new TypeError("Expected `interval` to be a finite number");let o=new Map,r=0,s=0;function i(){let l=Date.now();return l-r>e?(s=1,r=l,0):(s<t?s++:(r+=e,s=1),r-l)}let p=[];function a(){let l=Date.now();if(p.length<t)return p.push(l),0;let c=p.shift()+e;return l>=c?(p.push(l),0):(p.push(c),c-l)}let d=n?a:i;return l=>{let c=function(...u){if(!c.isEnabled)return(async()=>l.apply(this,u))();let f;return new Promise((C,m)=>{f=setTimeout(()=>{C(l.apply(this,u)),o.delete(f)},d()),o.set(f,m)})};return c.abort=()=>{for(let u of o.keys())clearTimeout(u),o.get(u)(new O);o.clear(),p.splice(0,p.length)},c.isEnabled=!0,c}}function Z({throttle:t={interval:1e3,limit:10},retry:e={retries:1,factor:1.66}}){let n=t?D(t):null;return function(r){let s=async()=>await r();if(n&&(s=n(s)),e){let i=s;s=()=>S(i,e)}return s()}}var E=async t=>await t();var b=class extends Pe{constructor(n){n.limitPolicy||(n.limitPolicy=Z({}));super(n);this.canvasUrl="/api/v1/canvas"}async getCompositionList(n){let{projectId:o}=this.options,r=this.createUrl(this.canvasUrl,{...n,projectId:o});return await this.apiClient(r)}unstable_getCompositionByNodePath(n){return this.getOneComposition(n)}unstable_getCompositionByNodeId(n){return this.getOneComposition(n)}getCompositionBySlug(n){return this.getOneComposition(n)}getCompositionById(n){return this.getOneComposition(n)}getOneComposition({unstable_resolveData:n,unstable_dynamicVariables:o,unstable_dataDiagnostics:r,...s}){let{projectId:i}=this.options,p=n?"/api/edge/v1/composition":this.canvasUrl,a={};return n&&(o&&(a.dynamicVariables=JSON.stringify(o)),r&&(a.dataDiagnostics="true")),this.apiClient(this.createUrl(p,{...s,...a,projectId:i}))}async updateComposition(n){let o=this.createUrl("/api/v1/canvas");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComposition(n){let o=this.createUrl("/api/v1/canvas"),{projectId:r}=this.options;await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:r}),expectNoContent:!0})}async getComponentDefinitions(n){let{projectId:o}=this.options,r=this.createUrl("/api/v1/canvas-definitions",{...n,projectId:o});return await this.apiClient(r)}async updateComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}},Y=class extends b{constructor(e){super({...e,bypassCache:!0})}};import{ApiClient as Ee}from"@uniformdev/context/api";var M="/api/v1/data-source",Te="/api/v1/data-sources",q=class extends Ee{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(M,{...e,projectId:n});return await this.apiClient(o)}async getList(e){let{projectId:n}=this.options,o=this.createUrl(Te,{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(M);await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(M);await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}};import{ApiClient as xe}from"@uniformdev/context/api";var T,v=class extends xe{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(_(v,T),{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(_(v,T));await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(_(v,T));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},N=v;T=new WeakMap,V(N,T,"/api/v1/data-types");var B=class{constructor(e,n,o){this._resolve=e;this._reject=n;this.args=o;this._isCompleted=!1}resolve(e){this._resolve(e),this._isCompleted=!0}reject(e){this._reject(e),this._isCompleted=!0}get isCompleted(){return this._isCompleted}};function st({handleBatch:t,shouldQueue:e,limitPolicy:n}){let o=[];return{enhanceOne:async i=>{if(!e||e(i))return new Promise((p,a)=>{o.push(new B(p,a,i))})},completeAll:async()=>{if(o.length>0){try{await t(o)}catch(p){o.forEach(a=>a.reject(p))}if(o.some(p=>!p.isCompleted))throw new Error("The completeAll() function failed to resolve or reject all promises in the batch!")}let i=o.length;return o=[],i},limitPolicy:n}}var at=(t,...e)=>({enhanceOne:o=>{let r="enhanceOne"in t?t.enhanceOne(o):t(o);for(let s of e){let i=_e(r)?r:Promise.resolve(r),p="enhanceOne"in s?s.enhanceOne:s;r=i.then(a=>p({...o,parameter:{type:o.parameter.type,value:a}}))}return r},completeAll:async()=>{var o,r;for(let s of e)if("completeAll"in s)throw new Error("Only the first enhancer in a compose chain can use the completeAll function (batching)");return(r="completeAll"in t?(o=t.completeAll)==null?void 0:o.call(t):0)!=null?r:0}});function _e(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function A(t,e,n){var s;let o=[{ancestorsAndSelf:[{component:t,parentSlot:void 0,parentSlotIndex:void 0}],context:n}],r=new Map;do{let i=o.pop();if(!i)continue;let p=i.ancestorsAndSelf[0],a=!0,d=(s=r.get(p.component))!=null?s:i.context;e(p.component,i.ancestorsAndSelf,{replaceComponent:c=>{Object.assign(p.component,c),["parameters","variant","slots","data","_pattern","_patternError"].forEach(f=>{c[f]||delete p.component[f]})},removeComponent:()=>{let{parentSlot:c,parentSlotIndex:u}=i.ancestorsAndSelf[0],f=i.ancestorsAndSelf[1];if(c&&typeof u!="undefined")f.component.slots[c].splice(u,1);else throw new Error("Unable to delete composition.")},insertAfter:c=>{let u=Array.isArray(c)?c:[c],{parentSlot:f,parentSlotIndex:C}=i.ancestorsAndSelf[0],m=i.ancestorsAndSelf[1];if(f&&typeof C!="undefined")m.component.slots[f].splice(C+1,0,...u),o.unshift(...u.map(h=>({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return m.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})));else throw new Error("Unable to insert after a component not in a slot.")},stopProcessingDescendants(){a=!1},setDescendantsContext(c){d=c},setChildContext(c,u){r.set(c,u)}},d);let l=p.component.slots;if(a&&l){let c=Object.keys(l);for(let u=c.length-1;u>=0;u--){let f=c[u],C=l[f];for(let m=C.length-1;m>=0;m--){let h=C[m];o.push({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return p.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})}}}}while(o.length>0)}function G(t){let e=[];for(let n=t.length-1;n>=0;n--){let{parentSlot:o,parentSlotIndex:r}=t[n];o&&r!==void 0&&e.push(`${o}[${r}]`)}return`.${e.join(".")}`}function ct(t,{withSlots:e=!1}={}){let n=[];for(let o=t.length-1;o>=0;o--){let{parentSlot:r,parentSlotIndex:s}=t[o];r&&s!==void 0&&n.push(`${r}/${s}`)}return e?`/slots/${n.join("/slots/")}`:`/${n.join("/")}`}async function ht({composition:t,enhancers:e,context:n,onErrors:o=r=>{throw new Error(r.map(s=>`${s.message}
2
2
  ${typeof s.error=="object"&&"stack"in s.error?s.error.stack:s.error}`).join(`
3
3
 
4
- `))}}){let r=[],s=new Set,i=new Set;A(t,(a,d)=>{var c;Object.entries((c=a.parameters)!=null?c:{}).forEach(([u,f])=>{let C=e.resolveParameterEnhancer(a,u,f);C&&(i.add(C),r.push(Ae(a,d,u,f,C,n)))});let l=e.resolveComponentEnhancers(a);r.push(_e(a,d,l,n)),s.add(l)}),r.push(...Array.from(s).flatMap(a=>Array.from(a).map(async([,d])=>{var l;try{d.completeAll&&await((l=d.limitPolicy)!=null?l:E)(()=>d.completeAll())}catch(c){return{error:c,message:"Batch component enhancer failed. Individual failed components should receive their own rejections."}}}))),r.push(...Array.from(i).map(async a=>{var d;try{a.completeAll&&await((d=a.limitPolicy)!=null?d:E)(()=>a.completeAll())}catch(l){return{error:l,message:"Batch parameter enhancer failed. Individual failed parameters should receive their own rejections."}}}));let p=(await Promise.all(r)).flatMap(a=>Array.isArray(a)?a:[a]).filter(a=>a);p.length&&o(p)}async function _e(t,e,n,o){return n.size&&(t.data={}),await Promise.all(Array.from(n).map(async([r,s])=>{var i;try{let a=await(s.completeAll?E:(i=s.limitPolicy)!=null?i:E)(async()=>s.enhanceOne({component:t,context:o}));a!=null&&(t.data[r]=a)}catch(p){let a=`Component ${G(e)} (type: ${t.type}): data.${r} enhancer threw exception. Data key will not be present.`;return delete t.data[r],{message:a,error:p}}}))}async function Ae(t,e,n,o,r,s){var i;try{let a=await(r.completeAll?E:(i=r.limitPolicy)!=null?i:E)(async()=>r.enhanceOne({parameter:o,parameterName:n,component:t,context:s}));a===null?delete t.parameters[n]:typeof a=="undefined"?t.parameters[n]={...o,value:o.value}:t.parameters[n]={...o,value:a}}catch(p){let a=`Component ${G(e)} (type: ${t.type}): enhancing parameter ${n} (type: ${o.type}) threw exception. Parameter will be removed.`;return delete t.parameters[n],{message:a,error:p}}}var R=class{constructor(){this._paramMatches=Array();this._dataMatches=new Map}parameter(e){return this._paramMatches.push({enhancer:this._resolveParameterEnhancer(e)}),this}parameterName(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({name:r,enhancer:this._resolveParameterEnhancer(n)})),this}parameterType(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({type:r,enhancer:this._resolveParameterEnhancer(n)})),this}data(e,n){if(this._dataMatches.has(e))throw new Error(`${e} enhancer data key has been used more than once. This will cause data loss.`);return this._dataMatches.set(e,typeof n=="function"?{enhanceOne:n}:n),this}resolveParameterEnhancer(e,n){var o;return(o=this._paramMatches.find(r=>r.name&&r.name===e||r.type&&r.type===n.type||!r.type&&!r.name))==null?void 0:o.enhancer}resolveComponentEnhancers(){return this._dataMatches}_resolveParameterEnhancer(e){return typeof e=="function"?{enhanceOne:e}:e}},Q=class{constructor(){this._componentIndex={};this._rootBuilder=new R}parameter(e){return this._rootBuilder.parameter(e),this}parameterName(e,n){return this._rootBuilder.parameterName(e,n),this}parameterType(e,n){return this._rootBuilder.parameterType(e,n),this}data(e,n){return this._rootBuilder.data(e,n),this}component(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>{this._componentIndex[r]=this._componentIndex[r]||new R,n(this._componentIndex[r])}),this}resolveParameterEnhancer(e,n,o){let r=this._componentIndex[e.type];if(r){let s=r.resolveParameterEnhancer(n,o);if(s)return s}return this._rootBuilder.resolveParameterEnhancer(n,o)}resolveComponentEnhancers(e){let n=this._rootBuilder.resolveComponentEnhancers(),o=this._componentIndex[e.type];if(o){n=new Map(n);for(let[r,s]of o.resolveComponentEnhancers())n.set(r,s)}return n}};var Ct="$personalization",gt="$test",K="$localization",Pt="intentTag",X="locale",Et="pz",Tt="test",ee="localized",xt=0,vt=64,te="$pzCrit",ne="$tstVrnt",_t="$enr",At="is_incontext_editing_mode",Rt="uniform-component-start",It="placeholder";function Re({component:t}){var o;let e={},n=(o=t.slots)==null?void 0:o[ee];return n==null||n.forEach(r=>{var i;let s=(i=r.parameters)==null?void 0:i[X];(s==null?void 0:s.value)&&typeof s.value=="string"&&(e[s.value]=e[s.value]||[],e[s.value].push(r))}),e}function bt({composition:t,locale:e}){A(t,(n,o,r)=>{if(n.type===K){let s=Re({component:n}),i=typeof e=="string"?e:e({component:n,locales:s}),p;if(i&&(p=s[i]),p!=null&&p.length){let[a,...d]=p;r.replaceComponent(a),d.length&&r.insertAfter(d)}else r.removeComponent()}})}var oe=class{constructor(e,n){this.groups=e.reduce((o,r)=>{var i;let s=n(r.args);return o[s]=(i=o[s])!=null?i:[],o[s].push(r),o},{})}resolveKey(e,n){this.groups[e].forEach(o=>o.resolve(n))}resolveRemaining(e){Object.keys(this.groups).forEach(n=>{this.groups[n].forEach(o=>{o.isCompleted||o.resolve(e)})})}};var re=({composition:t,secret:e})=>{if(!e)return;let n=`${JSON.stringify(t)}-${e}`,o=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);o=(o<<5)-o+s,o|=0}return o};var Gt=t=>t.type==="select-component"&&t.id!==void 0,Lt=t=>t.type==="ready",Ut=t=>t.type==="update-composition",jt=t=>t.type==="add-component",Vt=t=>t.type==="move-component",$t=t=>t.type==="dismiss-placeholder",Ft=({listenTo:t,broadcastTo:e})=>{let n=0,o={},r=[...e],s=m=>{r.forEach(h=>h.postMessage(JSON.stringify(m),"*"))},i=m=>{s({type:"select-component",id:m})},p=()=>{s({type:"ready"})},a=(m,h)=>{let y=++n;return o[y]={types:Array.isArray(m)?m:[m],handler:h},()=>{delete o[y]}},d=(m,h)=>{let y={type:"update-composition",composition:m,hash:re({composition:m,secret:h})};s(y)},l=m=>{let h={...m,type:"add-component"};s(h)},c=m=>{let h={...m,type:"move-component"};s(h)},u=m=>{let h={...m,type:"dismiss-placeholder"};s(h)},f=m=>{if(typeof m.data!="string"||m.source===window)return;let h=null;try{let y=JSON.parse(m.data);Object.hasOwn(y,"type")&&(h=y)}catch(y){}if(!!h)for(let y in o){let L=o[y];L.types.includes(h.type)&&L.handler(h,m)}};return t.forEach(m=>m.addEventListener("message",f)),{ready:p,destroy:()=>{t.forEach(m=>m.removeEventListener("message",f))},selectComponent:i,updateComposition:d,on:a,addComponent:l,moveComponent:c,dismissPlaceholder:u}};var se="https://js.pusher.com/7.0.3/pusher.min.js";async function Ie(){if(!(typeof document=="undefined"||typeof window=="undefined"))return window.Pusher?window.Pusher:new Promise((t,e)=>{let n=setTimeout(()=>{window.Pusher&&t(window.Pusher),e(`Unable to load pusher.js; Uniform Canvas live preview disabled. Consider adding <script src="${se}"><\/script> manually.`)},5e3),o=document.createElement("script");o.src=se,o.addEventListener("load",()=>{clearTimeout(n),t(window.Pusher)}),document.head.appendChild(o)})}async function Jt(){let t=await Ie();if(!t)return;let e=window.__UNIFORM_EVENT_BUS__;if(!e){let n=new t("7b5f5abd160fea549ffe",{cluster:"mt1"});n.connect(),console.log("[canvas] \u{1F525} preview connected"),e=window.__UNIFORM_EVENT_BUS__={subscribe:o=>{let r=n.subscribe(o);return{unsubscribe:()=>n.unsubscribe(o),addEventHandler:(s,i)=>(r.bind(s,i),()=>r.unbind(s,i))}}}}return e}function ie(t,e,n){return`${t}.${e}@${n}`}function Zt({projectId:t,compositionId:e,compositionState:n=0,eventBus:{subscribe:o},callback:r,event:s="updated"}){let i=ie(t,e,n),p=o(i),a=p.addEventHandler(s,r);return()=>{a(),p.unsubscribe()}}var qt=t=>t.startsWith("$");function Xt(t){return t?t.map((e,n)=>{var s,i;let o=(i=(s=e.parameters)==null?void 0:s[te])==null?void 0:i.value,r=(o==null?void 0:o.name)||`pz-${n}-${e.type}`;return{...e,id:r,pz:o}}):[]}function nn(t){return t?t.map((e,n)=>{var s,i,p;let o=(i=(s=e.parameters)==null?void 0:s[ne])==null?void 0:i.value,r=(p=o==null?void 0:o.id)!=null?p:"testId"in e?e.testId:`ab-${n}-${e.type}`;return{...e,id:r}}):[]}import{ApiClientError as we}from"@uniformdev/context/api";var sn=we;export{Se as a,Oe as b,I as c,be as d,de as e,De as f,Me as g,v as h,V as i,he as j,Ne as k,Z as l,E as m,D as n,Y as o,q as p,N as q,B as r,st as s,at as t,A as u,G as v,ct as w,ht as x,R as y,Q as z,Ct as A,gt as B,K as C,Pt as D,X as E,Et as F,Tt as G,ee as H,xt as I,vt as J,te as K,ne as L,_t as M,At as N,Rt as O,It as P,Re as Q,bt as R,oe as S,re as T,Gt as U,Lt as V,Ut as W,jt as X,Vt as Y,$t as Z,Ft as _,Jt as $,ie as aa,Zt as ba,qt as ca,Xt as da,nn as ea,we as fa,sn as ga};
4
+ `))}}){let r=[],s=new Set,i=new Set;A(t,(a,d)=>{var c;Object.entries((c=a.parameters)!=null?c:{}).forEach(([u,f])=>{let C=e.resolveParameterEnhancer(a,u,f);C&&(i.add(C),r.push(Ae(a,d,u,f,C,n)))});let l=e.resolveComponentEnhancers(a);r.push(ve(a,d,l,n)),s.add(l)}),r.push(...Array.from(s).flatMap(a=>Array.from(a).map(async([,d])=>{var l;try{d.completeAll&&await((l=d.limitPolicy)!=null?l:E)(()=>d.completeAll())}catch(c){return{error:c,message:"Batch component enhancer failed. Individual failed components should receive their own rejections."}}}))),r.push(...Array.from(i).map(async a=>{var d;try{a.completeAll&&await((d=a.limitPolicy)!=null?d:E)(()=>a.completeAll())}catch(l){return{error:l,message:"Batch parameter enhancer failed. Individual failed parameters should receive their own rejections."}}}));let p=(await Promise.all(r)).flatMap(a=>Array.isArray(a)?a:[a]).filter(a=>a);p.length&&o(p)}async function ve(t,e,n,o){return n.size&&(t.data={}),await Promise.all(Array.from(n).map(async([r,s])=>{var i;try{let a=await(s.completeAll?E:(i=s.limitPolicy)!=null?i:E)(async()=>s.enhanceOne({component:t,context:o}));a!=null&&(t.data[r]=a)}catch(p){let a=`Component ${G(e)} (type: ${t.type}): data.${r} enhancer threw exception. Data key will not be present.`;return delete t.data[r],{message:a,error:p}}}))}async function Ae(t,e,n,o,r,s){var i;try{let a=await(r.completeAll?E:(i=r.limitPolicy)!=null?i:E)(async()=>r.enhanceOne({parameter:o,parameterName:n,component:t,context:s}));a===null?delete t.parameters[n]:typeof a=="undefined"?t.parameters[n]={...o,value:o.value}:t.parameters[n]={...o,value:a}}catch(p){let a=`Component ${G(e)} (type: ${t.type}): enhancing parameter ${n} (type: ${o.type}) threw exception. Parameter will be removed.`;return delete t.parameters[n],{message:a,error:p}}}var R=class{constructor(){this._paramMatches=Array();this._dataMatches=new Map}parameter(e){return this._paramMatches.push({enhancer:this._resolveParameterEnhancer(e)}),this}parameterName(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({name:r,enhancer:this._resolveParameterEnhancer(n)})),this}parameterType(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({type:r,enhancer:this._resolveParameterEnhancer(n)})),this}data(e,n){if(this._dataMatches.has(e))throw new Error(`${e} enhancer data key has been used more than once. This will cause data loss.`);return this._dataMatches.set(e,typeof n=="function"?{enhanceOne:n}:n),this}resolveParameterEnhancer(e,n){var o;return(o=this._paramMatches.find(r=>r.name&&r.name===e||r.type&&r.type===n.type||!r.type&&!r.name))==null?void 0:o.enhancer}resolveComponentEnhancers(){return this._dataMatches}_resolveParameterEnhancer(e){return typeof e=="function"?{enhanceOne:e}:e}},Q=class{constructor(){this._componentIndex={};this._rootBuilder=new R}parameter(e){return this._rootBuilder.parameter(e),this}parameterName(e,n){return this._rootBuilder.parameterName(e,n),this}parameterType(e,n){return this._rootBuilder.parameterType(e,n),this}data(e,n){return this._rootBuilder.data(e,n),this}component(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>{this._componentIndex[r]=this._componentIndex[r]||new R,n(this._componentIndex[r])}),this}resolveParameterEnhancer(e,n,o){let r=this._componentIndex[e.type];if(r){let s=r.resolveParameterEnhancer(n,o);if(s)return s}return this._rootBuilder.resolveParameterEnhancer(n,o)}resolveComponentEnhancers(e){let n=this._rootBuilder.resolveComponentEnhancers(),o=this._componentIndex[e.type];if(o){n=new Map(n);for(let[r,s]of o.resolveComponentEnhancers())n.set(r,s)}return n}};var Ct="$personalization",gt="$test",K="$localization",Pt="intentTag",X="locale",Et="pz",Tt="test",ee="localized",xt=0,_t=64,te="$pzCrit",ne="$tstVrnt",vt="$enr",At="is_incontext_editing_mode",Rt="uniform-component-start",It="placeholder",wt=15,St=600,Ot=30,Dt=-1;function Re({component:t}){var o;let e={},n=(o=t.slots)==null?void 0:o[ee];return n==null||n.forEach(r=>{var i;let s=(i=r.parameters)==null?void 0:i[X];(s==null?void 0:s.value)&&typeof s.value=="string"&&(e[s.value]=e[s.value]||[],e[s.value].push(r))}),e}function Bt({composition:t,locale:e}){A(t,(n,o,r)=>{if(n.type===K){let s=Re({component:n}),i=typeof e=="string"?e:e({component:n,locales:s}),p;if(i&&(p=s[i]),p!=null&&p.length){let[a,...d]=p;r.replaceComponent(a),d.length&&r.insertAfter(d)}else r.removeComponent()}})}var oe=class{constructor(e,n){this.groups=e.reduce((o,r)=>{var i;let s=n(r.args);return o[s]=(i=o[s])!=null?i:[],o[s].push(r),o},{})}resolveKey(e,n){this.groups[e].forEach(o=>o.resolve(n))}resolveRemaining(e){Object.keys(this.groups).forEach(n=>{this.groups[n].forEach(o=>{o.isCompleted||o.resolve(e)})})}};var re=({composition:t,secret:e})=>{if(!e)return;let n=`${JSON.stringify(t)}-${e}`,o=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);o=(o<<5)-o+s,o|=0}return o};var Vt=t=>t.type==="select-component"&&t.id!==void 0,$t=t=>t.type==="ready",Ft=t=>t.type==="update-composition",kt=t=>t.type==="add-component",Ht=t=>t.type==="move-component",Jt=t=>t.type==="dismiss-placeholder",zt=({listenTo:t,broadcastTo:e})=>{let n=0,o={},r=[...e],s=m=>{r.forEach(h=>h.postMessage(JSON.stringify(m),"*"))},i=m=>{s({type:"select-component",id:m})},p=()=>{s({type:"ready"})},a=(m,h)=>{let y=++n;return o[y]={types:Array.isArray(m)?m:[m],handler:h},()=>{delete o[y]}},d=(m,h)=>{let y={type:"update-composition",composition:m,hash:re({composition:m,secret:h})};s(y)},l=m=>{let h={...m,type:"add-component"};s(h)},c=m=>{let h={...m,type:"move-component"};s(h)},u=m=>{let h={...m,type:"dismiss-placeholder"};s(h)},f=m=>{if(typeof m.data!="string"||m.source===window)return;let h=null;try{let y=JSON.parse(m.data);Object.hasOwn(y,"type")&&(h=y)}catch(y){}if(!!h)for(let y in o){let L=o[y];L.types.includes(h.type)&&L.handler(h,m)}};return t.forEach(m=>m.addEventListener("message",f)),{ready:p,destroy:()=>{t.forEach(m=>m.removeEventListener("message",f))},selectComponent:i,updateComposition:d,on:a,addComponent:l,moveComponent:c,dismissPlaceholder:u}};var se="https://js.pusher.com/7.0.3/pusher.min.js";async function Ie(){if(!(typeof document=="undefined"||typeof window=="undefined"))return window.Pusher?window.Pusher:new Promise((t,e)=>{let n=setTimeout(()=>{window.Pusher&&t(window.Pusher),e(`Unable to load pusher.js; Uniform Canvas live preview disabled. Consider adding <script src="${se}"><\/script> manually.`)},5e3),o=document.createElement("script");o.src=se,o.addEventListener("load",()=>{clearTimeout(n),t(window.Pusher)}),document.head.appendChild(o)})}async function Zt(){let t=await Ie();if(!t)return;let e=window.__UNIFORM_EVENT_BUS__;if(!e){let n=new t("7b5f5abd160fea549ffe",{cluster:"mt1"});n.connect(),console.log("[canvas] \u{1F525} preview connected"),e=window.__UNIFORM_EVENT_BUS__={subscribe:o=>{let r=n.subscribe(o);return{unsubscribe:()=>n.unsubscribe(o),addEventHandler:(s,i)=>(r.bind(s,i),()=>r.unbind(s,i))}}}}return e}function ie(t,e,n){return`${t}.${e}@${n}`}function Kt({projectId:t,compositionId:e,compositionState:n=0,eventBus:{subscribe:o},callback:r,event:s="updated"}){let i=ie(t,e,n),p=o(i),a=p.addEventHandler(s,r);return()=>{a(),p.unsubscribe()}}var en=t=>t.startsWith("$");function on(t){return t?t.map((e,n)=>{var s,i;let o=(i=(s=e.parameters)==null?void 0:s[te])==null?void 0:i.value,r=(o==null?void 0:o.name)||`pz-${n}-${e.type}`;return{...e,id:r,pz:o}}):[]}function an(t){return t?t.map((e,n)=>{var s,i,p;let o=(i=(s=e.parameters)==null?void 0:s[ne])==null?void 0:i.value,r=(p=o==null?void 0:o.id)!=null?p:"testId"in e?e.testId:`ab-${n}-${e.type}`;return{...e,id:r}}):[]}import{ApiClientError as we}from"@uniformdev/context/api";var mn=we;export{Se as a,Oe as b,I as c,De as d,de as e,be as f,Me as g,_ as h,V as i,he as j,Ne as k,Z as l,E as m,b as n,Y as o,q as p,N as q,B as r,st as s,at as t,A as u,G as v,ct as w,ht as x,R as y,Q as z,Ct as A,gt as B,K as C,Pt as D,X as E,Et as F,Tt as G,ee as H,xt as I,_t as J,te as K,ne as L,vt as M,At as N,Rt as O,It as P,wt as Q,St as R,Ot as S,Dt as T,Re as U,Bt as V,oe as W,re as X,Vt as Y,$t as Z,Ft as _,kt as $,Ht as aa,Jt as ba,zt as ca,Zt as da,ie as ea,Kt as fa,en as ga,on as ha,an as ia,we as ja,mn as ka};
package/dist/cli/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{I as As,J as ni,a as te,b as C2,c as H,d as x2,e as Gp,f as A2,g as di,h as wa,i as Yp,j as $1,k as ri,o as ie,q as Xe}from"../chunk-VKEQONOQ.mjs";var O0=H((N7,E0)=>{var Qa=1e3,Za=Qa*60,Xa=Za*60,Fa=Xa*24,j6=Fa*7,L6=Fa*365.25;E0.exports=function(e,a){a=a||{};var p=typeof e;if(p==="string"&&e.length>0)return M6(e);if(p==="number"&&isFinite(e))return a.long?R6(e):B6(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function M6(e){if(e=String(e),!(e.length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!a){var p=parseFloat(a[1]),t=(a[2]||"ms").toLowerCase();switch(t){case"years":case"year":case"yrs":case"yr":case"y":return p*L6;case"weeks":case"week":case"w":return p*j6;case"days":case"day":case"d":return p*Fa;case"hours":case"hour":case"hrs":case"hr":case"h":return p*Xa;case"minutes":case"minute":case"mins":case"min":case"m":return p*Za;case"seconds":case"second":case"secs":case"sec":case"s":return p*Qa;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function B6(e){var a=Math.abs(e);return a>=Fa?Math.round(e/Fa)+"d":a>=Xa?Math.round(e/Xa)+"h":a>=Za?Math.round(e/Za)+"m":a>=Qa?Math.round(e/Qa)+"s":e+"ms"}function R6(e){var a=Math.abs(e);return a>=Fa?ct(e,a,Fa,"day"):a>=Xa?ct(e,a,Xa,"hour"):a>=Za?ct(e,a,Za,"minute"):a>=Qa?ct(e,a,Qa,"second"):e+" ms"}function ct(e,a,p,t){var i=a>=p*1.5;return Math.round(e/p)+" "+t+(i?"s":"")}});var ji=H((E7,T0)=>{function U6(e){p.debug=p,p.default=p,p.coerce=o,p.disable=r,p.enable=i,p.enabled=d,p.humanize=O0(),p.destroy=s,Object.keys(e).forEach(l=>{p[l]=e[l]}),p.names=[],p.skips=[],p.formatters={};function a(l){let m=0;for(let c=0;c<l.length;c++)m=(m<<5)-m+l.charCodeAt(c),m|=0;return p.colors[Math.abs(m)%p.colors.length]}p.selectColor=a;function p(l){let m,c=null,u,g;function v(...h){if(!v.enabled)return;let C=v,x=Number(new Date),I=x-(m||x);C.diff=I,C.prev=m,C.curr=x,m=x,h[0]=p.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let V=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(L,T)=>{if(L==="%%")return"%";V++;let Y=p.formatters[T];if(typeof Y=="function"){let ae=h[V];L=Y.call(C,ae),h.splice(V,1),V--}return L}),p.formatArgs.call(C,h),(C.log||p.log).apply(C,h)}return v.namespace=l,v.useColors=p.useColors(),v.color=p.selectColor(l),v.extend=t,v.destroy=p.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>c!==null?c:(u!==p.namespaces&&(u=p.namespaces,g=p.enabled(l)),g),set:h=>{c=h}}),typeof p.init=="function"&&p.init(v),v}function t(l,m){let c=p(this.namespace+(typeof m=="undefined"?":":m)+l);return c.log=this.log,c}function i(l){p.save(l),p.namespaces=l,p.names=[],p.skips=[];let m,c=(typeof l=="string"?l:"").split(/[\s,]+/),u=c.length;for(m=0;m<u;m++)!c[m]||(l=c[m].replace(/\*/g,".*?"),l[0]==="-"?p.skips.push(new RegExp("^"+l.slice(1)+"$")):p.names.push(new RegExp("^"+l+"$")))}function r(){let l=[...p.names.map(n),...p.skips.map(n).map(m=>"-"+m)].join(",");return p.enable(""),l}function d(l){if(l[l.length-1]==="*")return!0;let m,c;for(m=0,c=p.skips.length;m<c;m++)if(p.skips[m].test(l))return!1;for(m=0,c=p.names.length;m<c;m++)if(p.names[m].test(l))return!0;return!1}function n(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function o(l){return l instanceof Error?l.stack||l.message:l}function s(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return p.enable(p.load()),p}T0.exports=U6});var P0=H((Je,ut)=>{Je.formatArgs=$6;Je.save=q6;Je.load=H6;Je.useColors=k6;Je.storage=z6();Je.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Je.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function k6(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function $6(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+ut.exports.humanize(this.diff),!this.useColors)return;let a="color: "+this.color;e.splice(1,0,a,"color: inherit");let p=0,t=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(p++,i==="%c"&&(t=p))}),e.splice(t,0,a)}Je.log=console.debug||console.log||(()=>{});function q6(e){try{e?Je.storage.setItem("debug",e):Je.storage.removeItem("debug")}catch(a){}}function H6(){let e;try{e=Je.storage.getItem("debug")}catch(a){}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}function z6(){try{return localStorage}catch(e){}}ut.exports=ji()(Je);var{formatters:W6}=ut.exports;W6.j=function(e){try{return JSON.stringify(e)}catch(a){return"[UnexpectedJSONParseError]: "+a.message}}});var I0=H((O7,F0)=>{"use strict";F0.exports=(e,a=process.argv)=>{let p=e.startsWith("-")?"":e.length===1?"-":"--",t=a.indexOf(p+e),i=a.indexOf("--");return t!==-1&&(i===-1||t<i)}});var L0=H((T7,j0)=>{"use strict";var G6=te("os"),V0=te("tty"),d1=I0(),{env:Ne}=process,J1;d1("no-color")||d1("no-colors")||d1("color=false")||d1("color=never")?J1=0:(d1("color")||d1("colors")||d1("color=true")||d1("color=always"))&&(J1=1);"FORCE_COLOR"in Ne&&(Ne.FORCE_COLOR==="true"?J1=1:Ne.FORCE_COLOR==="false"?J1=0:J1=Ne.FORCE_COLOR.length===0?1:Math.min(parseInt(Ne.FORCE_COLOR,10),3));function Li(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Mi(e,a){if(J1===0)return 0;if(d1("color=16m")||d1("color=full")||d1("color=truecolor"))return 3;if(d1("color=256"))return 2;if(e&&!a&&J1===void 0)return 0;let p=J1||0;if(Ne.TERM==="dumb")return p;if(process.platform==="win32"){let t=G6.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in Ne)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(t=>t in Ne)||Ne.CI_NAME==="codeship"?1:p;if("TEAMCITY_VERSION"in Ne)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ne.TEAMCITY_VERSION)?1:0;if(Ne.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Ne){let t=parseInt((Ne.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ne.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ne.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ne.TERM)||"COLORTERM"in Ne?1:p}function Y6(e){let a=Mi(e,e&&e.isTTY);return Li(a)}j0.exports={supportsColor:Y6,stdout:Li(Mi(!0,V0.isatty(1))),stderr:Li(Mi(!0,V0.isatty(2)))}});var B0=H((Te,ht)=>{var K6=te("tty"),ft=te("util");Te.init=p4;Te.log=X6;Te.formatArgs=Q6;Te.save=e4;Te.load=a4;Te.useColors=J6;Te.destroy=ft.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Te.colors=[6,2,3,4,5,1];try{let e=L0();e&&(e.stderr||e).level>=2&&(Te.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}Te.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,a)=>{let p=a.substring(6).toLowerCase().replace(/_([a-z])/g,(i,r)=>r.toUpperCase()),t=process.env[a];return/^(yes|on|true|enabled)$/i.test(t)?t=!0:/^(no|off|false|disabled)$/i.test(t)?t=!1:t==="null"?t=null:t=Number(t),e[p]=t,e},{});function J6(){return"colors"in Te.inspectOpts?Boolean(Te.inspectOpts.colors):K6.isatty(process.stderr.fd)}function Q6(e){let{namespace:a,useColors:p}=this;if(p){let t=this.color,i="\x1B[3"+(t<8?t:"8;5;"+t),r=` ${i};1m${a} \x1B[0m`;e[0]=r+e[0].split(`
1
+ import{I as As,J as ni,a as te,b as C2,c as H,d as x2,e as Gp,f as A2,g as di,h as wa,i as Yp,j as $1,k as ri,o as ie,q as Xe}from"../chunk-62Q2UUAR.mjs";var O0=H((N7,E0)=>{var Qa=1e3,Za=Qa*60,Xa=Za*60,Fa=Xa*24,j6=Fa*7,L6=Fa*365.25;E0.exports=function(e,a){a=a||{};var p=typeof e;if(p==="string"&&e.length>0)return M6(e);if(p==="number"&&isFinite(e))return a.long?R6(e):B6(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function M6(e){if(e=String(e),!(e.length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!a){var p=parseFloat(a[1]),t=(a[2]||"ms").toLowerCase();switch(t){case"years":case"year":case"yrs":case"yr":case"y":return p*L6;case"weeks":case"week":case"w":return p*j6;case"days":case"day":case"d":return p*Fa;case"hours":case"hour":case"hrs":case"hr":case"h":return p*Xa;case"minutes":case"minute":case"mins":case"min":case"m":return p*Za;case"seconds":case"second":case"secs":case"sec":case"s":return p*Qa;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function B6(e){var a=Math.abs(e);return a>=Fa?Math.round(e/Fa)+"d":a>=Xa?Math.round(e/Xa)+"h":a>=Za?Math.round(e/Za)+"m":a>=Qa?Math.round(e/Qa)+"s":e+"ms"}function R6(e){var a=Math.abs(e);return a>=Fa?ct(e,a,Fa,"day"):a>=Xa?ct(e,a,Xa,"hour"):a>=Za?ct(e,a,Za,"minute"):a>=Qa?ct(e,a,Qa,"second"):e+" ms"}function ct(e,a,p,t){var i=a>=p*1.5;return Math.round(e/p)+" "+t+(i?"s":"")}});var ji=H((E7,T0)=>{function U6(e){p.debug=p,p.default=p,p.coerce=o,p.disable=r,p.enable=i,p.enabled=d,p.humanize=O0(),p.destroy=s,Object.keys(e).forEach(l=>{p[l]=e[l]}),p.names=[],p.skips=[],p.formatters={};function a(l){let m=0;for(let c=0;c<l.length;c++)m=(m<<5)-m+l.charCodeAt(c),m|=0;return p.colors[Math.abs(m)%p.colors.length]}p.selectColor=a;function p(l){let m,c=null,u,g;function v(...h){if(!v.enabled)return;let C=v,x=Number(new Date),I=x-(m||x);C.diff=I,C.prev=m,C.curr=x,m=x,h[0]=p.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let V=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(L,T)=>{if(L==="%%")return"%";V++;let Y=p.formatters[T];if(typeof Y=="function"){let ae=h[V];L=Y.call(C,ae),h.splice(V,1),V--}return L}),p.formatArgs.call(C,h),(C.log||p.log).apply(C,h)}return v.namespace=l,v.useColors=p.useColors(),v.color=p.selectColor(l),v.extend=t,v.destroy=p.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>c!==null?c:(u!==p.namespaces&&(u=p.namespaces,g=p.enabled(l)),g),set:h=>{c=h}}),typeof p.init=="function"&&p.init(v),v}function t(l,m){let c=p(this.namespace+(typeof m=="undefined"?":":m)+l);return c.log=this.log,c}function i(l){p.save(l),p.namespaces=l,p.names=[],p.skips=[];let m,c=(typeof l=="string"?l:"").split(/[\s,]+/),u=c.length;for(m=0;m<u;m++)!c[m]||(l=c[m].replace(/\*/g,".*?"),l[0]==="-"?p.skips.push(new RegExp("^"+l.slice(1)+"$")):p.names.push(new RegExp("^"+l+"$")))}function r(){let l=[...p.names.map(n),...p.skips.map(n).map(m=>"-"+m)].join(",");return p.enable(""),l}function d(l){if(l[l.length-1]==="*")return!0;let m,c;for(m=0,c=p.skips.length;m<c;m++)if(p.skips[m].test(l))return!1;for(m=0,c=p.names.length;m<c;m++)if(p.names[m].test(l))return!0;return!1}function n(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function o(l){return l instanceof Error?l.stack||l.message:l}function s(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return p.enable(p.load()),p}T0.exports=U6});var P0=H((Je,ut)=>{Je.formatArgs=$6;Je.save=q6;Je.load=H6;Je.useColors=k6;Je.storage=z6();Je.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Je.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function k6(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function $6(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+ut.exports.humanize(this.diff),!this.useColors)return;let a="color: "+this.color;e.splice(1,0,a,"color: inherit");let p=0,t=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(p++,i==="%c"&&(t=p))}),e.splice(t,0,a)}Je.log=console.debug||console.log||(()=>{});function q6(e){try{e?Je.storage.setItem("debug",e):Je.storage.removeItem("debug")}catch(a){}}function H6(){let e;try{e=Je.storage.getItem("debug")}catch(a){}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}function z6(){try{return localStorage}catch(e){}}ut.exports=ji()(Je);var{formatters:W6}=ut.exports;W6.j=function(e){try{return JSON.stringify(e)}catch(a){return"[UnexpectedJSONParseError]: "+a.message}}});var I0=H((O7,F0)=>{"use strict";F0.exports=(e,a=process.argv)=>{let p=e.startsWith("-")?"":e.length===1?"-":"--",t=a.indexOf(p+e),i=a.indexOf("--");return t!==-1&&(i===-1||t<i)}});var L0=H((T7,j0)=>{"use strict";var G6=te("os"),V0=te("tty"),d1=I0(),{env:Ne}=process,J1;d1("no-color")||d1("no-colors")||d1("color=false")||d1("color=never")?J1=0:(d1("color")||d1("colors")||d1("color=true")||d1("color=always"))&&(J1=1);"FORCE_COLOR"in Ne&&(Ne.FORCE_COLOR==="true"?J1=1:Ne.FORCE_COLOR==="false"?J1=0:J1=Ne.FORCE_COLOR.length===0?1:Math.min(parseInt(Ne.FORCE_COLOR,10),3));function Li(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Mi(e,a){if(J1===0)return 0;if(d1("color=16m")||d1("color=full")||d1("color=truecolor"))return 3;if(d1("color=256"))return 2;if(e&&!a&&J1===void 0)return 0;let p=J1||0;if(Ne.TERM==="dumb")return p;if(process.platform==="win32"){let t=G6.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in Ne)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(t=>t in Ne)||Ne.CI_NAME==="codeship"?1:p;if("TEAMCITY_VERSION"in Ne)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ne.TEAMCITY_VERSION)?1:0;if(Ne.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Ne){let t=parseInt((Ne.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ne.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ne.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ne.TERM)||"COLORTERM"in Ne?1:p}function Y6(e){let a=Mi(e,e&&e.isTTY);return Li(a)}j0.exports={supportsColor:Y6,stdout:Li(Mi(!0,V0.isatty(1))),stderr:Li(Mi(!0,V0.isatty(2)))}});var B0=H((Te,ht)=>{var K6=te("tty"),ft=te("util");Te.init=p4;Te.log=X6;Te.formatArgs=Q6;Te.save=e4;Te.load=a4;Te.useColors=J6;Te.destroy=ft.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Te.colors=[6,2,3,4,5,1];try{let e=L0();e&&(e.stderr||e).level>=2&&(Te.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}Te.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,a)=>{let p=a.substring(6).toLowerCase().replace(/_([a-z])/g,(i,r)=>r.toUpperCase()),t=process.env[a];return/^(yes|on|true|enabled)$/i.test(t)?t=!0:/^(no|off|false|disabled)$/i.test(t)?t=!1:t==="null"?t=null:t=Number(t),e[p]=t,e},{});function J6(){return"colors"in Te.inspectOpts?Boolean(Te.inspectOpts.colors):K6.isatty(process.stderr.fd)}function Q6(e){let{namespace:a,useColors:p}=this;if(p){let t=this.color,i="\x1B[3"+(t<8?t:"8;5;"+t),r=` ${i};1m${a} \x1B[0m`;e[0]=r+e[0].split(`
2
2
  `).join(`
3
3
  `+r),e.push(i+"m+"+ht.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Z6()+a+" "+e[0]}function Z6(){return Te.inspectOpts.hideDate?"":new Date().toISOString()+" "}function X6(...e){return process.stderr.write(ft.format(...e)+`
4
4
  `)}function e4(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function a4(){return process.env.DEBUG}function p4(e){e.inspectOpts={};let a=Object.keys(Te.inspectOpts);for(let p=0;p<a.length;p++)e.inspectOpts[a[p]]=Te.inspectOpts[a[p]]}ht.exports=ji()(Te);var{formatters:M0}=ht.exports;M0.o=function(e){return this.inspectOpts.colors=this.useColors,ft.inspect(e,this.inspectOpts).split(`
package/dist/index.d.ts CHANGED
@@ -644,6 +644,14 @@ declare const IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode"
644
644
  declare const IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
645
645
  /** The ID we give to placeholder components */
646
646
  declare const PLACEHOLDER_ID = "placeholder";
647
+ /** Minimal value for Edgehancers Cache TTL */
648
+ declare const EDGE_MIN_CACHE_TTL = 15;
649
+ /** Maximal value for Edgehancers Cache TTL */
650
+ declare const EDGE_MAX_CACHE_TTL = 600;
651
+ /** Default value for Edgehancers Cache TTL */
652
+ declare const EDGE_DEFAULT_CACHE_TTL = 30;
653
+ /** A value that indicates that Edgehancers caching is disabled */
654
+ declare const EDGE_CACHE_DISABLED = -1;
647
655
 
648
656
  declare const generateHash: ({ composition, secret, }: {
649
657
  composition: RootComponentInstance;
@@ -667,4 +675,4 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
667
675
 
668
676
  declare const CanvasClientError: typeof ApiClientError;
669
677
 
670
- export { AddComponentMessage, BatchEnhancer, BatchEntry, CANVAS_DRAFT_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, Channel, ChannelMessage, ChildEnhancerBuilder, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentLocationReference, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, DataSourceClient, DataTypeClient, DismissPlaceholderMessage, EnhancerBuilder, EnhancerContext, EnhancerError, EventNames, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, InvalidationInput, InvalidationPayload, InvalidationResult, LimitPolicy, MessageHandler, MoveComponentMessage, PLACEHOLDER_ID, ReadyMessage, SelectComponentMessage, SubscribeToCompositionOptions, UncachedCanvasClient, UniqueBatchEntries, UnsubscribeCallback, UpdateCompositionMessage, WalkComponentTreeActions, compose, createBatchEnhancer, createCanvasChannel, createLimitPolicy, enhance, extractLocales, generateHash, getChannelName, getComponentJsonPointer, getComponentPath, isAddComponentMessage, isDismissPlaceholderMessage, isMovingComponentMessage, isReadyMessage, isSelectComponentMessage, isSystemComponentDefinition, isUpdateCompositionMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, subscribeToComposition, walkComponentTree };
678
+ export { AddComponentMessage, BatchEnhancer, BatchEntry, CANVAS_DRAFT_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, Channel, ChannelMessage, ChildEnhancerBuilder, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentLocationReference, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, DataSourceClient, DataTypeClient, DismissPlaceholderMessage, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EnhancerBuilder, EnhancerContext, EnhancerError, EventNames, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, InvalidationInput, InvalidationPayload, InvalidationResult, LimitPolicy, MessageHandler, MoveComponentMessage, PLACEHOLDER_ID, ReadyMessage, SelectComponentMessage, SubscribeToCompositionOptions, UncachedCanvasClient, UniqueBatchEntries, UnsubscribeCallback, UpdateCompositionMessage, WalkComponentTreeActions, compose, createBatchEnhancer, createCanvasChannel, createLimitPolicy, enhance, extractLocales, generateHash, getChannelName, getComponentJsonPointer, getComponentPath, isAddComponentMessage, isDismissPlaceholderMessage, isMovingComponentMessage, isReadyMessage, isSelectComponentMessage, isSystemComponentDefinition, isUpdateCompositionMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, subscribeToComposition, walkComponentTree };
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- import{$ as Q,A as p,B as q,C as r,D as s,E as t,F as u,G as v,H as w,I as x,J as y,K as z,L as A,M as B,N as C,O as D,P as E,Q as F,R as G,S as H,T as I,U as J,V as K,W as L,X as M,Y as N,Z as O,_ as P,aa as R,ba as S,ca as T,da as U,ea as V,fa as W,ga as X,l as a,m as b,n as c,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-VKEQONOQ.mjs";export{W as ApiClientError,g as BatchEntry,x as CANVAS_DRAFT_STATE,B as CANVAS_ENRICHMENT_TAG_PARAM,s as CANVAS_INTENT_TAG_PARAM,t as CANVAS_LOCALE_TAG_PARAM,w as CANVAS_LOCALIZATION_SLOT,r as CANVAS_LOCALIZATION_TYPE,z as CANVAS_PERSONALIZATION_PARAM,u as CANVAS_PERSONALIZE_SLOT,p as CANVAS_PERSONALIZE_TYPE,y as CANVAS_PUBLISHED_STATE,v as CANVAS_TEST_SLOT,q as CANVAS_TEST_TYPE,A as CANVAS_TEST_VARIANT_PARAM,c as CanvasClient,X as CanvasClientError,n as ChildEnhancerBuilder,e as DataSourceClient,f as DataTypeClient,o as EnhancerBuilder,D as IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,C as IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,E as PLACEHOLDER_ID,d as UncachedCanvasClient,H as UniqueBatchEntries,i as compose,h as createBatchEnhancer,P as createCanvasChannel,Q as createEventBus,a as createLimitPolicy,m as enhance,F as extractLocales,I as generateHash,R as getChannelName,l as getComponentJsonPointer,k as getComponentPath,M as isAddComponentMessage,O as isDismissPlaceholderMessage,N as isMovingComponentMessage,K as isReadyMessage,J as isSelectComponentMessage,T as isSystemComponentDefinition,L as isUpdateCompositionMessage,G as localize,U as mapSlotToPersonalizedVariations,V as mapSlotToTestVariations,b as nullLimitPolicy,S as subscribeToComposition,j as walkComponentTree};
1
+ import{$ as Q,A as p,B as q,C as r,D as s,E as t,F as u,G as v,H as w,I as x,J as y,K as z,L as A,M as B,N as C,O as D,P as E,Q as F,R as G,S as H,T as I,U as J,V as K,W as L,X as M,Y as N,Z as O,_ as P,aa as R,ba as S,ca as T,da as U,ea as V,fa as W,ga as X,ha as Y,ia as Z,ja as _,ka as $,l as a,m as b,n as c,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-62Q2UUAR.mjs";export{_ as ApiClientError,g as BatchEntry,x as CANVAS_DRAFT_STATE,B as CANVAS_ENRICHMENT_TAG_PARAM,s as CANVAS_INTENT_TAG_PARAM,t as CANVAS_LOCALE_TAG_PARAM,w as CANVAS_LOCALIZATION_SLOT,r as CANVAS_LOCALIZATION_TYPE,z as CANVAS_PERSONALIZATION_PARAM,u as CANVAS_PERSONALIZE_SLOT,p as CANVAS_PERSONALIZE_TYPE,y as CANVAS_PUBLISHED_STATE,v as CANVAS_TEST_SLOT,q as CANVAS_TEST_TYPE,A as CANVAS_TEST_VARIANT_PARAM,c as CanvasClient,$ as CanvasClientError,n as ChildEnhancerBuilder,e as DataSourceClient,f as DataTypeClient,I as EDGE_CACHE_DISABLED,H as EDGE_DEFAULT_CACHE_TTL,G as EDGE_MAX_CACHE_TTL,F as EDGE_MIN_CACHE_TTL,o as EnhancerBuilder,D as IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,C as IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,E as PLACEHOLDER_ID,d as UncachedCanvasClient,L as UniqueBatchEntries,i as compose,h as createBatchEnhancer,T as createCanvasChannel,U as createEventBus,a as createLimitPolicy,m as enhance,J as extractLocales,M as generateHash,V as getChannelName,l as getComponentJsonPointer,k as getComponentPath,Q as isAddComponentMessage,S as isDismissPlaceholderMessage,R as isMovingComponentMessage,O as isReadyMessage,N as isSelectComponentMessage,X as isSystemComponentDefinition,P as isUpdateCompositionMessage,K as localize,Y as mapSlotToPersonalizedVariations,Z as mapSlotToTestVariations,b as nullLimitPolicy,W as subscribeToComposition,j as walkComponentTree};
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var le=Object.create;var A=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var b=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ye=(t,e)=>{for(var n in e)A(t,n,{get:e[n],enumerable:!0})},Q=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of de(e))!fe.call(t,r)&&r!==n&&A(t,r,{get:()=>e[r],enumerable:!(o=ue(e,r))||o.enumerable});return t};var Ce=(t,e,n)=>(n=t!=null?le(he(t)):{},Q(e||!t||!t.__esModule?A(n,"default",{value:t,enumerable:!0}):n,t)),ge=t=>Q(A({},"__esModule",{value:!0}),t);var Pe=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var R=(t,e,n)=>(Pe(t,e,"read from private field"),n?n.call(t):e.get(t)),K=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)};var ee=b((rt,X)=>{function g(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}X.exports=g;g.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};g.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};g.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},n),this._options.unref&&this._timer.unref(),!0};g.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};g.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};g.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};g.prototype.start=g.prototype.try;g.prototype.errors=function(){return this._errors};g.prototype.attempts=function(){return this._attempts};g.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,n=0,o=0;o<this._errors.length;o++){var r=this._errors[o],s=r.message,i=(t[s]||0)+1;t[s]=i,i>=n&&(e=r,n=i)}return e}});var te=b(E=>{var Ee=ee();E.operation=function(t){var e=E.timeouts(t);return new Ee(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};E.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],r=0;r<e.retries;r++)o.push(this.createTimeout(r,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(r,e)),o.sort(function(s,i){return s-i}),o};E.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,o=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return o=Math.min(o,e.maxTimeout),o};E.wrap=function(t,e,n){if(e instanceof Array&&(n=e,e=null),!n){n=[];for(var o in t)typeof t[o]=="function"&&n.push(o)}for(var r=0;r<n.length;r++){var s=n[r],i=t[s];t[s]=function(a){var d=E.operation(e),l=Array.prototype.slice.call(arguments,1),c=l.pop();l.push(function(u){d.retry(u)||(u&&(arguments[0]=d.mainError()),c.apply(this,arguments))}),d.attempt(function(){a.apply(t,l)})}.bind(t,i),t[s].options=e}}});var oe=b((it,ne)=>{ne.exports=te()});var nt={};ye(nt,{ApiClientError:()=>Y.ApiClientError,BatchEntry:()=>S,CANVAS_DRAFT_STATE:()=>Dt,CANVAS_ENRICHMENT_TAG_PARAM:()=>Le,CANVAS_INTENT_TAG_PARAM:()=>Ne,CANVAS_LOCALE_TAG_PARAM:()=>F,CANVAS_LOCALIZATION_SLOT:()=>k,CANVAS_LOCALIZATION_TYPE:()=>$,CANVAS_PERSONALIZATION_PARAM:()=>J,CANVAS_PERSONALIZE_SLOT:()=>Be,CANVAS_PERSONALIZE_TYPE:()=>De,CANVAS_PUBLISHED_STATE:()=>Mt,CANVAS_TEST_SLOT:()=>Ge,CANVAS_TEST_TYPE:()=>Me,CANVAS_TEST_VARIANT_PARAM:()=>z,CanvasClient:()=>I,CanvasClientError:()=>tt,ChildEnhancerBuilder:()=>_,DataSourceClient:()=>j,DataTypeClient:()=>w,EnhancerBuilder:()=>V,IN_CONTEXT_EDITOR_COMPONENT_START_ROLE:()=>je,IN_CONTEXT_EDITOR_QUERY_STRING_PARAM:()=>Ue,PLACEHOLDER_ID:()=>Ve,UncachedCanvasClient:()=>L,UniqueBatchEntries:()=>H,compose:()=>Re,createBatchEnhancer:()=>Ae,createCanvasChannel:()=>Ze,createEventBus:()=>qe,createLimitPolicy:()=>G,enhance:()=>Se,extractLocales:()=>ce,generateHash:()=>W,getChannelName:()=>Z,getComponentJsonPointer:()=>we,getComponentPath:()=>O,isAddComponentMessage:()=>ze,isDismissPlaceholderMessage:()=>We,isMovingComponentMessage:()=>He,isReadyMessage:()=>ke,isSelectComponentMessage:()=>Fe,isSystemComponentDefinition:()=>Ke,isUpdateCompositionMessage:()=>Je,localize:()=>$e,mapSlotToPersonalizedVariations:()=>Xe,mapSlotToTestVariations:()=>et,nullLimitPolicy:()=>P,subscribeToComposition:()=>Qe,walkComponentTree:()=>v});module.exports=ge(nt);var ie=require("@uniformdev/context/api");var se=Ce(oe(),1),Te=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"]),D=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},xe=(t,e,n)=>{let o=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=o,t},ve=t=>Te.has(t),re=t=>globalThis.DOMException===void 0?new Error(t):new DOMException(t);async function M(t,e){return new Promise((n,o)=>{e={onFailedAttempt(){},retries:10,...e};let r=se.default.operation(e);r.attempt(async s=>{try{n(await t(s))}catch(i){if(!(i instanceof Error)){o(new TypeError(`Non-error was thrown: "${i}". You should only throw errors.`));return}if(i instanceof D)r.stop(),o(i.originalError);else if(i instanceof TypeError&&!ve(i.message))r.stop(),o(i);else{xe(i,s,e);try{await e.onFailedAttempt(i)}catch(p){o(p);return}r.retry(i)||o(r.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{r.stop();let s=e.signal.reason===void 0?re("The operation was aborted."):e.signal.reason;o(s instanceof Error?s:re(s))},{once:!0})})}var N=class extends Error{constructor(){super("Throttled function aborted"),this.name="AbortError"}};function B({limit:t,interval:e,strict:n}){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(e))throw new TypeError("Expected `interval` to be a finite number");let o=new Map,r=0,s=0;function i(){let l=Date.now();return l-r>e?(s=1,r=l,0):(s<t?s++:(r+=e,s=1),r-l)}let p=[];function a(){let l=Date.now();if(p.length<t)return p.push(l),0;let c=p.shift()+e;return l>=c?(p.push(l),0):(p.push(c),c-l)}let d=n?a:i;return l=>{let c=function(...u){if(!c.isEnabled)return(async()=>l.apply(this,u))();let f;return new Promise((C,m)=>{f=setTimeout(()=>{C(l.apply(this,u)),o.delete(f)},d()),o.set(f,m)})};return c.abort=()=>{for(let u of o.keys())clearTimeout(u),o.get(u)(new N);o.clear(),p.splice(0,p.length)},c.isEnabled=!0,c}}function G({throttle:t={interval:1e3,limit:10},retry:e={retries:1,factor:1.66}}){let n=t?B(t):null;return function(r){let s=async()=>await r();if(n&&(s=n(s)),e){let i=s;s=()=>M(i,e)}return s()}}var P=async t=>await t();var I=class extends ie.ApiClient{constructor(n){n.limitPolicy||(n.limitPolicy=G({}));super(n);this.canvasUrl="/api/v1/canvas"}async getCompositionList(n){let{projectId:o}=this.options,r=this.createUrl(this.canvasUrl,{...n,projectId:o});return await this.apiClient(r)}unstable_getCompositionByNodePath(n){return this.getOneComposition(n)}unstable_getCompositionByNodeId(n){return this.getOneComposition(n)}getCompositionBySlug(n){return this.getOneComposition(n)}getCompositionById(n){return this.getOneComposition(n)}getOneComposition({unstable_resolveData:n,unstable_dynamicVariables:o,unstable_dataDiagnostics:r,...s}){let{projectId:i}=this.options,p=n?"/api/edge/v1/composition":this.canvasUrl,a={};return n&&(o&&(a.dynamicVariables=JSON.stringify(o)),r&&(a.dataDiagnostics="true")),this.apiClient(this.createUrl(p,{...s,...a,projectId:i}))}async updateComposition(n){let o=this.createUrl("/api/v1/canvas");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComposition(n){let o=this.createUrl("/api/v1/canvas"),{projectId:r}=this.options;await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:r}),expectNoContent:!0})}async getComponentDefinitions(n){let{projectId:o}=this.options,r=this.createUrl("/api/v1/canvas-definitions",{...n,projectId:o});return await this.apiClient(r)}async updateComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}},L=class extends I{constructor(e){super({...e,bypassCache:!0})}};var ae=require("@uniformdev/context/api"),U="/api/v1/data-source",_e="/api/v1/data-sources",j=class extends ae.ApiClient{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(U,{...e,projectId:n});return await this.apiClient(o)}async getList(e){let{projectId:n}=this.options,o=this.createUrl(_e,{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(U);await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(U);await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}};var pe=require("@uniformdev/context/api");var T,x=class extends pe.ApiClient{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(R(x,T),{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(R(x,T));await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(R(x,T));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},w=x;T=new WeakMap,K(w,T,"/api/v1/data-types");var S=class{constructor(e,n,o){this._resolve=e;this._reject=n;this.args=o;this._isCompleted=!1}resolve(e){this._resolve(e),this._isCompleted=!0}reject(e){this._reject(e),this._isCompleted=!0}get isCompleted(){return this._isCompleted}};function Ae({handleBatch:t,shouldQueue:e,limitPolicy:n}){let o=[];return{enhanceOne:async i=>{if(!e||e(i))return new Promise((p,a)=>{o.push(new S(p,a,i))})},completeAll:async()=>{if(o.length>0){try{await t(o)}catch(p){o.forEach(a=>a.reject(p))}if(o.some(p=>!p.isCompleted))throw new Error("The completeAll() function failed to resolve or reject all promises in the batch!")}let i=o.length;return o=[],i},limitPolicy:n}}var Re=(t,...e)=>({enhanceOne:o=>{let r="enhanceOne"in t?t.enhanceOne(o):t(o);for(let s of e){let i=Ie(r)?r:Promise.resolve(r),p="enhanceOne"in s?s.enhanceOne:s;r=i.then(a=>p({...o,parameter:{type:o.parameter.type,value:a}}))}return r},completeAll:async()=>{var o,r;for(let s of e)if("completeAll"in s)throw new Error("Only the first enhancer in a compose chain can use the completeAll function (batching)");return(r="completeAll"in t?(o=t.completeAll)==null?void 0:o.call(t):0)!=null?r:0}});function Ie(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function v(t,e,n){var s;let o=[{ancestorsAndSelf:[{component:t,parentSlot:void 0,parentSlotIndex:void 0}],context:n}],r=new Map;do{let i=o.pop();if(!i)continue;let p=i.ancestorsAndSelf[0],a=!0,d=(s=r.get(p.component))!=null?s:i.context;e(p.component,i.ancestorsAndSelf,{replaceComponent:c=>{Object.assign(p.component,c),["parameters","variant","slots","data","_pattern","_patternError"].forEach(f=>{c[f]||delete p.component[f]})},removeComponent:()=>{let{parentSlot:c,parentSlotIndex:u}=i.ancestorsAndSelf[0],f=i.ancestorsAndSelf[1];if(c&&typeof u!="undefined")f.component.slots[c].splice(u,1);else throw new Error("Unable to delete composition.")},insertAfter:c=>{let u=Array.isArray(c)?c:[c],{parentSlot:f,parentSlotIndex:C}=i.ancestorsAndSelf[0],m=i.ancestorsAndSelf[1];if(f&&typeof C!="undefined")m.component.slots[f].splice(C+1,0,...u),o.unshift(...u.map(h=>({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return m.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})));else throw new Error("Unable to insert after a component not in a slot.")},stopProcessingDescendants(){a=!1},setDescendantsContext(c){d=c},setChildContext(c,u){r.set(c,u)}},d);let l=p.component.slots;if(a&&l){let c=Object.keys(l);for(let u=c.length-1;u>=0;u--){let f=c[u],C=l[f];for(let m=C.length-1;m>=0;m--){let h=C[m];o.push({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return p.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})}}}}while(o.length>0)}function O(t){let e=[];for(let n=t.length-1;n>=0;n--){let{parentSlot:o,parentSlotIndex:r}=t[n];o&&r!==void 0&&e.push(`${o}[${r}]`)}return`.${e.join(".")}`}function we(t,{withSlots:e=!1}={}){let n=[];for(let o=t.length-1;o>=0;o--){let{parentSlot:r,parentSlotIndex:s}=t[o];r&&s!==void 0&&n.push(`${r}/${s}`)}return e?`/slots/${n.join("/slots/")}`:`/${n.join("/")}`}async function Se({composition:t,enhancers:e,context:n,onErrors:o=r=>{throw new Error(r.map(s=>`${s.message}
1
+ "use strict";var le=Object.create;var A=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var D=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ye=(t,e)=>{for(var n in e)A(t,n,{get:e[n],enumerable:!0})},Q=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of de(e))!fe.call(t,r)&&r!==n&&A(t,r,{get:()=>e[r],enumerable:!(o=ue(e,r))||o.enumerable});return t};var Ce=(t,e,n)=>(n=t!=null?le(he(t)):{},Q(e||!t||!t.__esModule?A(n,"default",{value:t,enumerable:!0}):n,t)),ge=t=>Q(A({},"__esModule",{value:!0}),t);var Pe=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var R=(t,e,n)=>(Pe(t,e,"read from private field"),n?n.call(t):e.get(t)),K=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)};var ee=D((rt,X)=>{function g(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}X.exports=g;g.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};g.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};g.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},n),this._options.unref&&this._timer.unref(),!0};g.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};g.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};g.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};g.prototype.start=g.prototype.try;g.prototype.errors=function(){return this._errors};g.prototype.attempts=function(){return this._attempts};g.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,n=0,o=0;o<this._errors.length;o++){var r=this._errors[o],s=r.message,i=(t[s]||0)+1;t[s]=i,i>=n&&(e=r,n=i)}return e}});var te=D(E=>{var Ee=ee();E.operation=function(t){var e=E.timeouts(t);return new Ee(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};E.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],r=0;r<e.retries;r++)o.push(this.createTimeout(r,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(r,e)),o.sort(function(s,i){return s-i}),o};E.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,o=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return o=Math.min(o,e.maxTimeout),o};E.wrap=function(t,e,n){if(e instanceof Array&&(n=e,e=null),!n){n=[];for(var o in t)typeof t[o]=="function"&&n.push(o)}for(var r=0;r<n.length;r++){var s=n[r],i=t[s];t[s]=function(a){var d=E.operation(e),l=Array.prototype.slice.call(arguments,1),c=l.pop();l.push(function(u){d.retry(u)||(u&&(arguments[0]=d.mainError()),c.apply(this,arguments))}),d.attempt(function(){a.apply(t,l)})}.bind(t,i),t[s].options=e}}});var oe=D((it,ne)=>{ne.exports=te()});var nt={};ye(nt,{ApiClientError:()=>Y.ApiClientError,BatchEntry:()=>S,CANVAS_DRAFT_STATE:()=>bt,CANVAS_ENRICHMENT_TAG_PARAM:()=>Le,CANVAS_INTENT_TAG_PARAM:()=>Ne,CANVAS_LOCALE_TAG_PARAM:()=>F,CANVAS_LOCALIZATION_SLOT:()=>k,CANVAS_LOCALIZATION_TYPE:()=>$,CANVAS_PERSONALIZATION_PARAM:()=>H,CANVAS_PERSONALIZE_SLOT:()=>Be,CANVAS_PERSONALIZE_TYPE:()=>be,CANVAS_PUBLISHED_STATE:()=>Mt,CANVAS_TEST_SLOT:()=>Ge,CANVAS_TEST_TYPE:()=>Me,CANVAS_TEST_VARIANT_PARAM:()=>J,CanvasClient:()=>I,CanvasClientError:()=>tt,ChildEnhancerBuilder:()=>v,DataSourceClient:()=>j,DataTypeClient:()=>w,EDGE_CACHE_DISABLED:()=>Lt,EDGE_DEFAULT_CACHE_TTL:()=>Gt,EDGE_MAX_CACHE_TTL:()=>Bt,EDGE_MIN_CACHE_TTL:()=>Nt,EnhancerBuilder:()=>V,IN_CONTEXT_EDITOR_COMPONENT_START_ROLE:()=>je,IN_CONTEXT_EDITOR_QUERY_STRING_PARAM:()=>Ue,PLACEHOLDER_ID:()=>Ve,UncachedCanvasClient:()=>L,UniqueBatchEntries:()=>z,compose:()=>Re,createBatchEnhancer:()=>Ae,createCanvasChannel:()=>Ze,createEventBus:()=>qe,createLimitPolicy:()=>G,enhance:()=>Se,extractLocales:()=>ce,generateHash:()=>W,getChannelName:()=>Z,getComponentJsonPointer:()=>we,getComponentPath:()=>O,isAddComponentMessage:()=>Je,isDismissPlaceholderMessage:()=>We,isMovingComponentMessage:()=>ze,isReadyMessage:()=>ke,isSelectComponentMessage:()=>Fe,isSystemComponentDefinition:()=>Ke,isUpdateCompositionMessage:()=>He,localize:()=>$e,mapSlotToPersonalizedVariations:()=>Xe,mapSlotToTestVariations:()=>et,nullLimitPolicy:()=>P,subscribeToComposition:()=>Qe,walkComponentTree:()=>_});module.exports=ge(nt);var ie=require("@uniformdev/context/api");var se=Ce(oe(),1),Te=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"]),b=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},xe=(t,e,n)=>{let o=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=o,t},_e=t=>Te.has(t),re=t=>globalThis.DOMException===void 0?new Error(t):new DOMException(t);async function M(t,e){return new Promise((n,o)=>{e={onFailedAttempt(){},retries:10,...e};let r=se.default.operation(e);r.attempt(async s=>{try{n(await t(s))}catch(i){if(!(i instanceof Error)){o(new TypeError(`Non-error was thrown: "${i}". You should only throw errors.`));return}if(i instanceof b)r.stop(),o(i.originalError);else if(i instanceof TypeError&&!_e(i.message))r.stop(),o(i);else{xe(i,s,e);try{await e.onFailedAttempt(i)}catch(p){o(p);return}r.retry(i)||o(r.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{r.stop();let s=e.signal.reason===void 0?re("The operation was aborted."):e.signal.reason;o(s instanceof Error?s:re(s))},{once:!0})})}var N=class extends Error{constructor(){super("Throttled function aborted"),this.name="AbortError"}};function B({limit:t,interval:e,strict:n}){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(e))throw new TypeError("Expected `interval` to be a finite number");let o=new Map,r=0,s=0;function i(){let l=Date.now();return l-r>e?(s=1,r=l,0):(s<t?s++:(r+=e,s=1),r-l)}let p=[];function a(){let l=Date.now();if(p.length<t)return p.push(l),0;let c=p.shift()+e;return l>=c?(p.push(l),0):(p.push(c),c-l)}let d=n?a:i;return l=>{let c=function(...u){if(!c.isEnabled)return(async()=>l.apply(this,u))();let f;return new Promise((C,m)=>{f=setTimeout(()=>{C(l.apply(this,u)),o.delete(f)},d()),o.set(f,m)})};return c.abort=()=>{for(let u of o.keys())clearTimeout(u),o.get(u)(new N);o.clear(),p.splice(0,p.length)},c.isEnabled=!0,c}}function G({throttle:t={interval:1e3,limit:10},retry:e={retries:1,factor:1.66}}){let n=t?B(t):null;return function(r){let s=async()=>await r();if(n&&(s=n(s)),e){let i=s;s=()=>M(i,e)}return s()}}var P=async t=>await t();var I=class extends ie.ApiClient{constructor(n){n.limitPolicy||(n.limitPolicy=G({}));super(n);this.canvasUrl="/api/v1/canvas"}async getCompositionList(n){let{projectId:o}=this.options,r=this.createUrl(this.canvasUrl,{...n,projectId:o});return await this.apiClient(r)}unstable_getCompositionByNodePath(n){return this.getOneComposition(n)}unstable_getCompositionByNodeId(n){return this.getOneComposition(n)}getCompositionBySlug(n){return this.getOneComposition(n)}getCompositionById(n){return this.getOneComposition(n)}getOneComposition({unstable_resolveData:n,unstable_dynamicVariables:o,unstable_dataDiagnostics:r,...s}){let{projectId:i}=this.options,p=n?"/api/edge/v1/composition":this.canvasUrl,a={};return n&&(o&&(a.dynamicVariables=JSON.stringify(o)),r&&(a.dataDiagnostics="true")),this.apiClient(this.createUrl(p,{...s,...a,projectId:i}))}async updateComposition(n){let o=this.createUrl("/api/v1/canvas");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComposition(n){let o=this.createUrl("/api/v1/canvas"),{projectId:r}=this.options;await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:r}),expectNoContent:!0})}async getComponentDefinitions(n){let{projectId:o}=this.options,r=this.createUrl("/api/v1/canvas-definitions",{...n,projectId:o});return await this.apiClient(r)}async updateComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}},L=class extends I{constructor(e){super({...e,bypassCache:!0})}};var ae=require("@uniformdev/context/api"),U="/api/v1/data-source",ve="/api/v1/data-sources",j=class extends ae.ApiClient{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(U,{...e,projectId:n});return await this.apiClient(o)}async getList(e){let{projectId:n}=this.options,o=this.createUrl(ve,{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(U);await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(U);await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}};var pe=require("@uniformdev/context/api");var T,x=class extends pe.ApiClient{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(R(x,T),{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(R(x,T));await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(R(x,T));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},w=x;T=new WeakMap,K(w,T,"/api/v1/data-types");var S=class{constructor(e,n,o){this._resolve=e;this._reject=n;this.args=o;this._isCompleted=!1}resolve(e){this._resolve(e),this._isCompleted=!0}reject(e){this._reject(e),this._isCompleted=!0}get isCompleted(){return this._isCompleted}};function Ae({handleBatch:t,shouldQueue:e,limitPolicy:n}){let o=[];return{enhanceOne:async i=>{if(!e||e(i))return new Promise((p,a)=>{o.push(new S(p,a,i))})},completeAll:async()=>{if(o.length>0){try{await t(o)}catch(p){o.forEach(a=>a.reject(p))}if(o.some(p=>!p.isCompleted))throw new Error("The completeAll() function failed to resolve or reject all promises in the batch!")}let i=o.length;return o=[],i},limitPolicy:n}}var Re=(t,...e)=>({enhanceOne:o=>{let r="enhanceOne"in t?t.enhanceOne(o):t(o);for(let s of e){let i=Ie(r)?r:Promise.resolve(r),p="enhanceOne"in s?s.enhanceOne:s;r=i.then(a=>p({...o,parameter:{type:o.parameter.type,value:a}}))}return r},completeAll:async()=>{var o,r;for(let s of e)if("completeAll"in s)throw new Error("Only the first enhancer in a compose chain can use the completeAll function (batching)");return(r="completeAll"in t?(o=t.completeAll)==null?void 0:o.call(t):0)!=null?r:0}});function Ie(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function _(t,e,n){var s;let o=[{ancestorsAndSelf:[{component:t,parentSlot:void 0,parentSlotIndex:void 0}],context:n}],r=new Map;do{let i=o.pop();if(!i)continue;let p=i.ancestorsAndSelf[0],a=!0,d=(s=r.get(p.component))!=null?s:i.context;e(p.component,i.ancestorsAndSelf,{replaceComponent:c=>{Object.assign(p.component,c),["parameters","variant","slots","data","_pattern","_patternError"].forEach(f=>{c[f]||delete p.component[f]})},removeComponent:()=>{let{parentSlot:c,parentSlotIndex:u}=i.ancestorsAndSelf[0],f=i.ancestorsAndSelf[1];if(c&&typeof u!="undefined")f.component.slots[c].splice(u,1);else throw new Error("Unable to delete composition.")},insertAfter:c=>{let u=Array.isArray(c)?c:[c],{parentSlot:f,parentSlotIndex:C}=i.ancestorsAndSelf[0],m=i.ancestorsAndSelf[1];if(f&&typeof C!="undefined")m.component.slots[f].splice(C+1,0,...u),o.unshift(...u.map(h=>({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return m.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})));else throw new Error("Unable to insert after a component not in a slot.")},stopProcessingDescendants(){a=!1},setDescendantsContext(c){d=c},setChildContext(c,u){r.set(c,u)}},d);let l=p.component.slots;if(a&&l){let c=Object.keys(l);for(let u=c.length-1;u>=0;u--){let f=c[u],C=l[f];for(let m=C.length-1;m>=0;m--){let h=C[m];o.push({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return p.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})}}}}while(o.length>0)}function O(t){let e=[];for(let n=t.length-1;n>=0;n--){let{parentSlot:o,parentSlotIndex:r}=t[n];o&&r!==void 0&&e.push(`${o}[${r}]`)}return`.${e.join(".")}`}function we(t,{withSlots:e=!1}={}){let n=[];for(let o=t.length-1;o>=0;o--){let{parentSlot:r,parentSlotIndex:s}=t[o];r&&s!==void 0&&n.push(`${r}/${s}`)}return e?`/slots/${n.join("/slots/")}`:`/${n.join("/")}`}async function Se({composition:t,enhancers:e,context:n,onErrors:o=r=>{throw new Error(r.map(s=>`${s.message}
2
2
  ${typeof s.error=="object"&&"stack"in s.error?s.error.stack:s.error}`).join(`
3
3
 
4
- `))}}){let r=[],s=new Set,i=new Set;v(t,(a,d)=>{var c;Object.entries((c=a.parameters)!=null?c:{}).forEach(([u,f])=>{let C=e.resolveParameterEnhancer(a,u,f);C&&(i.add(C),r.push(be(a,d,u,f,C,n)))});let l=e.resolveComponentEnhancers(a);r.push(Oe(a,d,l,n)),s.add(l)}),r.push(...Array.from(s).flatMap(a=>Array.from(a).map(async([,d])=>{var l;try{d.completeAll&&await((l=d.limitPolicy)!=null?l:P)(()=>d.completeAll())}catch(c){return{error:c,message:"Batch component enhancer failed. Individual failed components should receive their own rejections."}}}))),r.push(...Array.from(i).map(async a=>{var d;try{a.completeAll&&await((d=a.limitPolicy)!=null?d:P)(()=>a.completeAll())}catch(l){return{error:l,message:"Batch parameter enhancer failed. Individual failed parameters should receive their own rejections."}}}));let p=(await Promise.all(r)).flatMap(a=>Array.isArray(a)?a:[a]).filter(a=>a);p.length&&o(p)}async function Oe(t,e,n,o){return n.size&&(t.data={}),await Promise.all(Array.from(n).map(async([r,s])=>{var i;try{let a=await(s.completeAll?P:(i=s.limitPolicy)!=null?i:P)(async()=>s.enhanceOne({component:t,context:o}));a!=null&&(t.data[r]=a)}catch(p){let a=`Component ${O(e)} (type: ${t.type}): data.${r} enhancer threw exception. Data key will not be present.`;return delete t.data[r],{message:a,error:p}}}))}async function be(t,e,n,o,r,s){var i;try{let a=await(r.completeAll?P:(i=r.limitPolicy)!=null?i:P)(async()=>r.enhanceOne({parameter:o,parameterName:n,component:t,context:s}));a===null?delete t.parameters[n]:typeof a=="undefined"?t.parameters[n]={...o,value:o.value}:t.parameters[n]={...o,value:a}}catch(p){let a=`Component ${O(e)} (type: ${t.type}): enhancing parameter ${n} (type: ${o.type}) threw exception. Parameter will be removed.`;return delete t.parameters[n],{message:a,error:p}}}var _=class{constructor(){this._paramMatches=Array();this._dataMatches=new Map}parameter(e){return this._paramMatches.push({enhancer:this._resolveParameterEnhancer(e)}),this}parameterName(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({name:r,enhancer:this._resolveParameterEnhancer(n)})),this}parameterType(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({type:r,enhancer:this._resolveParameterEnhancer(n)})),this}data(e,n){if(this._dataMatches.has(e))throw new Error(`${e} enhancer data key has been used more than once. This will cause data loss.`);return this._dataMatches.set(e,typeof n=="function"?{enhanceOne:n}:n),this}resolveParameterEnhancer(e,n){var o;return(o=this._paramMatches.find(r=>r.name&&r.name===e||r.type&&r.type===n.type||!r.type&&!r.name))==null?void 0:o.enhancer}resolveComponentEnhancers(){return this._dataMatches}_resolveParameterEnhancer(e){return typeof e=="function"?{enhanceOne:e}:e}},V=class{constructor(){this._componentIndex={};this._rootBuilder=new _}parameter(e){return this._rootBuilder.parameter(e),this}parameterName(e,n){return this._rootBuilder.parameterName(e,n),this}parameterType(e,n){return this._rootBuilder.parameterType(e,n),this}data(e,n){return this._rootBuilder.data(e,n),this}component(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>{this._componentIndex[r]=this._componentIndex[r]||new _,n(this._componentIndex[r])}),this}resolveParameterEnhancer(e,n,o){let r=this._componentIndex[e.type];if(r){let s=r.resolveParameterEnhancer(n,o);if(s)return s}return this._rootBuilder.resolveParameterEnhancer(n,o)}resolveComponentEnhancers(e){let n=this._rootBuilder.resolveComponentEnhancers(),o=this._componentIndex[e.type];if(o){n=new Map(n);for(let[r,s]of o.resolveComponentEnhancers())n.set(r,s)}return n}};var De="$personalization",Me="$test",$="$localization",Ne="intentTag",F="locale",Be="pz",Ge="test",k="localized",Dt=0,Mt=64,J="$pzCrit",z="$tstVrnt",Le="$enr",Ue="is_incontext_editing_mode",je="uniform-component-start",Ve="placeholder";function ce({component:t}){var o;let e={},n=(o=t.slots)==null?void 0:o[k];return n==null||n.forEach(r=>{var i;let s=(i=r.parameters)==null?void 0:i[F];(s==null?void 0:s.value)&&typeof s.value=="string"&&(e[s.value]=e[s.value]||[],e[s.value].push(r))}),e}function $e({composition:t,locale:e}){v(t,(n,o,r)=>{if(n.type===$){let s=ce({component:n}),i=typeof e=="string"?e:e({component:n,locales:s}),p;if(i&&(p=s[i]),p!=null&&p.length){let[a,...d]=p;r.replaceComponent(a),d.length&&r.insertAfter(d)}else r.removeComponent()}})}var H=class{constructor(e,n){this.groups=e.reduce((o,r)=>{var i;let s=n(r.args);return o[s]=(i=o[s])!=null?i:[],o[s].push(r),o},{})}resolveKey(e,n){this.groups[e].forEach(o=>o.resolve(n))}resolveRemaining(e){Object.keys(this.groups).forEach(n=>{this.groups[n].forEach(o=>{o.isCompleted||o.resolve(e)})})}};var W=({composition:t,secret:e})=>{if(!e)return;let n=`${JSON.stringify(t)}-${e}`,o=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);o=(o<<5)-o+s,o|=0}return o};var Fe=t=>t.type==="select-component"&&t.id!==void 0,ke=t=>t.type==="ready",Je=t=>t.type==="update-composition",ze=t=>t.type==="add-component",He=t=>t.type==="move-component",We=t=>t.type==="dismiss-placeholder",Ze=({listenTo:t,broadcastTo:e})=>{let n=0,o={},r=[...e],s=m=>{r.forEach(h=>h.postMessage(JSON.stringify(m),"*"))},i=m=>{s({type:"select-component",id:m})},p=()=>{s({type:"ready"})},a=(m,h)=>{let y=++n;return o[y]={types:Array.isArray(m)?m:[m],handler:h},()=>{delete o[y]}},d=(m,h)=>{let y={type:"update-composition",composition:m,hash:W({composition:m,secret:h})};s(y)},l=m=>{let h={...m,type:"add-component"};s(h)},c=m=>{let h={...m,type:"move-component"};s(h)},u=m=>{let h={...m,type:"dismiss-placeholder"};s(h)},f=m=>{if(typeof m.data!="string"||m.source===window)return;let h=null;try{let y=JSON.parse(m.data);Object.hasOwn(y,"type")&&(h=y)}catch(y){}if(!!h)for(let y in o){let q=o[y];q.types.includes(h.type)&&q.handler(h,m)}};return t.forEach(m=>m.addEventListener("message",f)),{ready:p,destroy:()=>{t.forEach(m=>m.removeEventListener("message",f))},selectComponent:i,updateComposition:d,on:a,addComponent:l,moveComponent:c,dismissPlaceholder:u}};var me="https://js.pusher.com/7.0.3/pusher.min.js";async function Ye(){if(!(typeof document=="undefined"||typeof window=="undefined"))return window.Pusher?window.Pusher:new Promise((t,e)=>{let n=setTimeout(()=>{window.Pusher&&t(window.Pusher),e(`Unable to load pusher.js; Uniform Canvas live preview disabled. Consider adding <script src="${me}"><\/script> manually.`)},5e3),o=document.createElement("script");o.src=me,o.addEventListener("load",()=>{clearTimeout(n),t(window.Pusher)}),document.head.appendChild(o)})}async function qe(){let t=await Ye();if(!t)return;let e=window.__UNIFORM_EVENT_BUS__;if(!e){let n=new t("7b5f5abd160fea549ffe",{cluster:"mt1"});n.connect(),console.log("[canvas] \u{1F525} preview connected"),e=window.__UNIFORM_EVENT_BUS__={subscribe:o=>{let r=n.subscribe(o);return{unsubscribe:()=>n.unsubscribe(o),addEventHandler:(s,i)=>(r.bind(s,i),()=>r.unbind(s,i))}}}}return e}function Z(t,e,n){return`${t}.${e}@${n}`}function Qe({projectId:t,compositionId:e,compositionState:n=0,eventBus:{subscribe:o},callback:r,event:s="updated"}){let i=Z(t,e,n),p=o(i),a=p.addEventHandler(s,r);return()=>{a(),p.unsubscribe()}}var Ke=t=>t.startsWith("$");function Xe(t){return t?t.map((e,n)=>{var s,i;let o=(i=(s=e.parameters)==null?void 0:s[J])==null?void 0:i.value,r=(o==null?void 0:o.name)||`pz-${n}-${e.type}`;return{...e,id:r,pz:o}}):[]}function et(t){return t?t.map((e,n)=>{var s,i,p;let o=(i=(s=e.parameters)==null?void 0:s[z])==null?void 0:i.value,r=(p=o==null?void 0:o.id)!=null?p:"testId"in e?e.testId:`ab-${n}-${e.type}`;return{...e,id:r}}):[]}var Y=require("@uniformdev/context/api"),tt=Y.ApiClientError;0&&(module.exports={ApiClientError,BatchEntry,CANVAS_DRAFT_STATE,CANVAS_ENRICHMENT_TAG_PARAM,CANVAS_INTENT_TAG_PARAM,CANVAS_LOCALE_TAG_PARAM,CANVAS_LOCALIZATION_SLOT,CANVAS_LOCALIZATION_TYPE,CANVAS_PERSONALIZATION_PARAM,CANVAS_PERSONALIZE_SLOT,CANVAS_PERSONALIZE_TYPE,CANVAS_PUBLISHED_STATE,CANVAS_TEST_SLOT,CANVAS_TEST_TYPE,CANVAS_TEST_VARIANT_PARAM,CanvasClient,CanvasClientError,ChildEnhancerBuilder,DataSourceClient,DataTypeClient,EnhancerBuilder,IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,PLACEHOLDER_ID,UncachedCanvasClient,UniqueBatchEntries,compose,createBatchEnhancer,createCanvasChannel,createEventBus,createLimitPolicy,enhance,extractLocales,generateHash,getChannelName,getComponentJsonPointer,getComponentPath,isAddComponentMessage,isDismissPlaceholderMessage,isMovingComponentMessage,isReadyMessage,isSelectComponentMessage,isSystemComponentDefinition,isUpdateCompositionMessage,localize,mapSlotToPersonalizedVariations,mapSlotToTestVariations,nullLimitPolicy,subscribeToComposition,walkComponentTree});
4
+ `))}}){let r=[],s=new Set,i=new Set;_(t,(a,d)=>{var c;Object.entries((c=a.parameters)!=null?c:{}).forEach(([u,f])=>{let C=e.resolveParameterEnhancer(a,u,f);C&&(i.add(C),r.push(De(a,d,u,f,C,n)))});let l=e.resolveComponentEnhancers(a);r.push(Oe(a,d,l,n)),s.add(l)}),r.push(...Array.from(s).flatMap(a=>Array.from(a).map(async([,d])=>{var l;try{d.completeAll&&await((l=d.limitPolicy)!=null?l:P)(()=>d.completeAll())}catch(c){return{error:c,message:"Batch component enhancer failed. Individual failed components should receive their own rejections."}}}))),r.push(...Array.from(i).map(async a=>{var d;try{a.completeAll&&await((d=a.limitPolicy)!=null?d:P)(()=>a.completeAll())}catch(l){return{error:l,message:"Batch parameter enhancer failed. Individual failed parameters should receive their own rejections."}}}));let p=(await Promise.all(r)).flatMap(a=>Array.isArray(a)?a:[a]).filter(a=>a);p.length&&o(p)}async function Oe(t,e,n,o){return n.size&&(t.data={}),await Promise.all(Array.from(n).map(async([r,s])=>{var i;try{let a=await(s.completeAll?P:(i=s.limitPolicy)!=null?i:P)(async()=>s.enhanceOne({component:t,context:o}));a!=null&&(t.data[r]=a)}catch(p){let a=`Component ${O(e)} (type: ${t.type}): data.${r} enhancer threw exception. Data key will not be present.`;return delete t.data[r],{message:a,error:p}}}))}async function De(t,e,n,o,r,s){var i;try{let a=await(r.completeAll?P:(i=r.limitPolicy)!=null?i:P)(async()=>r.enhanceOne({parameter:o,parameterName:n,component:t,context:s}));a===null?delete t.parameters[n]:typeof a=="undefined"?t.parameters[n]={...o,value:o.value}:t.parameters[n]={...o,value:a}}catch(p){let a=`Component ${O(e)} (type: ${t.type}): enhancing parameter ${n} (type: ${o.type}) threw exception. Parameter will be removed.`;return delete t.parameters[n],{message:a,error:p}}}var v=class{constructor(){this._paramMatches=Array();this._dataMatches=new Map}parameter(e){return this._paramMatches.push({enhancer:this._resolveParameterEnhancer(e)}),this}parameterName(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({name:r,enhancer:this._resolveParameterEnhancer(n)})),this}parameterType(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({type:r,enhancer:this._resolveParameterEnhancer(n)})),this}data(e,n){if(this._dataMatches.has(e))throw new Error(`${e} enhancer data key has been used more than once. This will cause data loss.`);return this._dataMatches.set(e,typeof n=="function"?{enhanceOne:n}:n),this}resolveParameterEnhancer(e,n){var o;return(o=this._paramMatches.find(r=>r.name&&r.name===e||r.type&&r.type===n.type||!r.type&&!r.name))==null?void 0:o.enhancer}resolveComponentEnhancers(){return this._dataMatches}_resolveParameterEnhancer(e){return typeof e=="function"?{enhanceOne:e}:e}},V=class{constructor(){this._componentIndex={};this._rootBuilder=new v}parameter(e){return this._rootBuilder.parameter(e),this}parameterName(e,n){return this._rootBuilder.parameterName(e,n),this}parameterType(e,n){return this._rootBuilder.parameterType(e,n),this}data(e,n){return this._rootBuilder.data(e,n),this}component(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>{this._componentIndex[r]=this._componentIndex[r]||new v,n(this._componentIndex[r])}),this}resolveParameterEnhancer(e,n,o){let r=this._componentIndex[e.type];if(r){let s=r.resolveParameterEnhancer(n,o);if(s)return s}return this._rootBuilder.resolveParameterEnhancer(n,o)}resolveComponentEnhancers(e){let n=this._rootBuilder.resolveComponentEnhancers(),o=this._componentIndex[e.type];if(o){n=new Map(n);for(let[r,s]of o.resolveComponentEnhancers())n.set(r,s)}return n}};var be="$personalization",Me="$test",$="$localization",Ne="intentTag",F="locale",Be="pz",Ge="test",k="localized",bt=0,Mt=64,H="$pzCrit",J="$tstVrnt",Le="$enr",Ue="is_incontext_editing_mode",je="uniform-component-start",Ve="placeholder",Nt=15,Bt=600,Gt=30,Lt=-1;function ce({component:t}){var o;let e={},n=(o=t.slots)==null?void 0:o[k];return n==null||n.forEach(r=>{var i;let s=(i=r.parameters)==null?void 0:i[F];(s==null?void 0:s.value)&&typeof s.value=="string"&&(e[s.value]=e[s.value]||[],e[s.value].push(r))}),e}function $e({composition:t,locale:e}){_(t,(n,o,r)=>{if(n.type===$){let s=ce({component:n}),i=typeof e=="string"?e:e({component:n,locales:s}),p;if(i&&(p=s[i]),p!=null&&p.length){let[a,...d]=p;r.replaceComponent(a),d.length&&r.insertAfter(d)}else r.removeComponent()}})}var z=class{constructor(e,n){this.groups=e.reduce((o,r)=>{var i;let s=n(r.args);return o[s]=(i=o[s])!=null?i:[],o[s].push(r),o},{})}resolveKey(e,n){this.groups[e].forEach(o=>o.resolve(n))}resolveRemaining(e){Object.keys(this.groups).forEach(n=>{this.groups[n].forEach(o=>{o.isCompleted||o.resolve(e)})})}};var W=({composition:t,secret:e})=>{if(!e)return;let n=`${JSON.stringify(t)}-${e}`,o=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);o=(o<<5)-o+s,o|=0}return o};var Fe=t=>t.type==="select-component"&&t.id!==void 0,ke=t=>t.type==="ready",He=t=>t.type==="update-composition",Je=t=>t.type==="add-component",ze=t=>t.type==="move-component",We=t=>t.type==="dismiss-placeholder",Ze=({listenTo:t,broadcastTo:e})=>{let n=0,o={},r=[...e],s=m=>{r.forEach(h=>h.postMessage(JSON.stringify(m),"*"))},i=m=>{s({type:"select-component",id:m})},p=()=>{s({type:"ready"})},a=(m,h)=>{let y=++n;return o[y]={types:Array.isArray(m)?m:[m],handler:h},()=>{delete o[y]}},d=(m,h)=>{let y={type:"update-composition",composition:m,hash:W({composition:m,secret:h})};s(y)},l=m=>{let h={...m,type:"add-component"};s(h)},c=m=>{let h={...m,type:"move-component"};s(h)},u=m=>{let h={...m,type:"dismiss-placeholder"};s(h)},f=m=>{if(typeof m.data!="string"||m.source===window)return;let h=null;try{let y=JSON.parse(m.data);Object.hasOwn(y,"type")&&(h=y)}catch(y){}if(!!h)for(let y in o){let q=o[y];q.types.includes(h.type)&&q.handler(h,m)}};return t.forEach(m=>m.addEventListener("message",f)),{ready:p,destroy:()=>{t.forEach(m=>m.removeEventListener("message",f))},selectComponent:i,updateComposition:d,on:a,addComponent:l,moveComponent:c,dismissPlaceholder:u}};var me="https://js.pusher.com/7.0.3/pusher.min.js";async function Ye(){if(!(typeof document=="undefined"||typeof window=="undefined"))return window.Pusher?window.Pusher:new Promise((t,e)=>{let n=setTimeout(()=>{window.Pusher&&t(window.Pusher),e(`Unable to load pusher.js; Uniform Canvas live preview disabled. Consider adding <script src="${me}"><\/script> manually.`)},5e3),o=document.createElement("script");o.src=me,o.addEventListener("load",()=>{clearTimeout(n),t(window.Pusher)}),document.head.appendChild(o)})}async function qe(){let t=await Ye();if(!t)return;let e=window.__UNIFORM_EVENT_BUS__;if(!e){let n=new t("7b5f5abd160fea549ffe",{cluster:"mt1"});n.connect(),console.log("[canvas] \u{1F525} preview connected"),e=window.__UNIFORM_EVENT_BUS__={subscribe:o=>{let r=n.subscribe(o);return{unsubscribe:()=>n.unsubscribe(o),addEventHandler:(s,i)=>(r.bind(s,i),()=>r.unbind(s,i))}}}}return e}function Z(t,e,n){return`${t}.${e}@${n}`}function Qe({projectId:t,compositionId:e,compositionState:n=0,eventBus:{subscribe:o},callback:r,event:s="updated"}){let i=Z(t,e,n),p=o(i),a=p.addEventHandler(s,r);return()=>{a(),p.unsubscribe()}}var Ke=t=>t.startsWith("$");function Xe(t){return t?t.map((e,n)=>{var s,i;let o=(i=(s=e.parameters)==null?void 0:s[H])==null?void 0:i.value,r=(o==null?void 0:o.name)||`pz-${n}-${e.type}`;return{...e,id:r,pz:o}}):[]}function et(t){return t?t.map((e,n)=>{var s,i,p;let o=(i=(s=e.parameters)==null?void 0:s[J])==null?void 0:i.value,r=(p=o==null?void 0:o.id)!=null?p:"testId"in e?e.testId:`ab-${n}-${e.type}`;return{...e,id:r}}):[]}var Y=require("@uniformdev/context/api"),tt=Y.ApiClientError;0&&(module.exports={ApiClientError,BatchEntry,CANVAS_DRAFT_STATE,CANVAS_ENRICHMENT_TAG_PARAM,CANVAS_INTENT_TAG_PARAM,CANVAS_LOCALE_TAG_PARAM,CANVAS_LOCALIZATION_SLOT,CANVAS_LOCALIZATION_TYPE,CANVAS_PERSONALIZATION_PARAM,CANVAS_PERSONALIZE_SLOT,CANVAS_PERSONALIZE_TYPE,CANVAS_PUBLISHED_STATE,CANVAS_TEST_SLOT,CANVAS_TEST_TYPE,CANVAS_TEST_VARIANT_PARAM,CanvasClient,CanvasClientError,ChildEnhancerBuilder,DataSourceClient,DataTypeClient,EDGE_CACHE_DISABLED,EDGE_DEFAULT_CACHE_TTL,EDGE_MAX_CACHE_TTL,EDGE_MIN_CACHE_TTL,EnhancerBuilder,IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,PLACEHOLDER_ID,UncachedCanvasClient,UniqueBatchEntries,compose,createBatchEnhancer,createCanvasChannel,createEventBus,createLimitPolicy,enhance,extractLocales,generateHash,getChannelName,getComponentJsonPointer,getComponentPath,isAddComponentMessage,isDismissPlaceholderMessage,isMovingComponentMessage,isReadyMessage,isSelectComponentMessage,isSystemComponentDefinition,isUpdateCompositionMessage,localize,mapSlotToPersonalizedVariations,mapSlotToTestVariations,nullLimitPolicy,subscribeToComposition,walkComponentTree});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{$ as Q,A as p,B as q,C as r,D as s,E as t,F as u,G as v,H as w,I as x,J as y,K as z,L as A,M as B,N as C,O as D,P as E,Q as F,R as G,S as H,T as I,U as J,V as K,W as L,X as M,Y as N,Z as O,_ as P,aa as R,ba as S,ca as T,da as U,ea as V,fa as W,ga as X,l as a,m as b,n as c,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-VKEQONOQ.mjs";export{W as ApiClientError,g as BatchEntry,x as CANVAS_DRAFT_STATE,B as CANVAS_ENRICHMENT_TAG_PARAM,s as CANVAS_INTENT_TAG_PARAM,t as CANVAS_LOCALE_TAG_PARAM,w as CANVAS_LOCALIZATION_SLOT,r as CANVAS_LOCALIZATION_TYPE,z as CANVAS_PERSONALIZATION_PARAM,u as CANVAS_PERSONALIZE_SLOT,p as CANVAS_PERSONALIZE_TYPE,y as CANVAS_PUBLISHED_STATE,v as CANVAS_TEST_SLOT,q as CANVAS_TEST_TYPE,A as CANVAS_TEST_VARIANT_PARAM,c as CanvasClient,X as CanvasClientError,n as ChildEnhancerBuilder,e as DataSourceClient,f as DataTypeClient,o as EnhancerBuilder,D as IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,C as IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,E as PLACEHOLDER_ID,d as UncachedCanvasClient,H as UniqueBatchEntries,i as compose,h as createBatchEnhancer,P as createCanvasChannel,Q as createEventBus,a as createLimitPolicy,m as enhance,F as extractLocales,I as generateHash,R as getChannelName,l as getComponentJsonPointer,k as getComponentPath,M as isAddComponentMessage,O as isDismissPlaceholderMessage,N as isMovingComponentMessage,K as isReadyMessage,J as isSelectComponentMessage,T as isSystemComponentDefinition,L as isUpdateCompositionMessage,G as localize,U as mapSlotToPersonalizedVariations,V as mapSlotToTestVariations,b as nullLimitPolicy,S as subscribeToComposition,j as walkComponentTree};
1
+ import{$ as Q,A as p,B as q,C as r,D as s,E as t,F as u,G as v,H as w,I as x,J as y,K as z,L as A,M as B,N as C,O as D,P as E,Q as F,R as G,S as H,T as I,U as J,V as K,W as L,X as M,Y as N,Z as O,_ as P,aa as R,ba as S,ca as T,da as U,ea as V,fa as W,ga as X,ha as Y,ia as Z,ja as _,ka as $,l as a,m as b,n as c,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-62Q2UUAR.mjs";export{_ as ApiClientError,g as BatchEntry,x as CANVAS_DRAFT_STATE,B as CANVAS_ENRICHMENT_TAG_PARAM,s as CANVAS_INTENT_TAG_PARAM,t as CANVAS_LOCALE_TAG_PARAM,w as CANVAS_LOCALIZATION_SLOT,r as CANVAS_LOCALIZATION_TYPE,z as CANVAS_PERSONALIZATION_PARAM,u as CANVAS_PERSONALIZE_SLOT,p as CANVAS_PERSONALIZE_TYPE,y as CANVAS_PUBLISHED_STATE,v as CANVAS_TEST_SLOT,q as CANVAS_TEST_TYPE,A as CANVAS_TEST_VARIANT_PARAM,c as CanvasClient,$ as CanvasClientError,n as ChildEnhancerBuilder,e as DataSourceClient,f as DataTypeClient,I as EDGE_CACHE_DISABLED,H as EDGE_DEFAULT_CACHE_TTL,G as EDGE_MAX_CACHE_TTL,F as EDGE_MIN_CACHE_TTL,o as EnhancerBuilder,D as IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,C as IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,E as PLACEHOLDER_ID,d as UncachedCanvasClient,L as UniqueBatchEntries,i as compose,h as createBatchEnhancer,T as createCanvasChannel,U as createEventBus,a as createLimitPolicy,m as enhance,J as extractLocales,M as generateHash,V as getChannelName,l as getComponentJsonPointer,k as getComponentPath,Q as isAddComponentMessage,S as isDismissPlaceholderMessage,R as isMovingComponentMessage,O as isReadyMessage,N as isSelectComponentMessage,X as isSystemComponentDefinition,P as isUpdateCompositionMessage,K as localize,Y as mapSlotToPersonalizedVariations,Z as mapSlotToTestVariations,b as nullLimitPolicy,W as subscribeToComposition,j as walkComponentTree};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "17.5.1-alpha.130+3fac779b1",
3
+ "version": "17.5.1-alpha.135+34befe009",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -49,7 +49,7 @@
49
49
  "devDependencies": {
50
50
  "@types/retry": "0.12.1",
51
51
  "@types/yargs": "17.0.14",
52
- "@uniformdev/cli": "^17.5.1-alpha.130+3fac779b1",
52
+ "@uniformdev/cli": "^17.5.1-alpha.135+34befe009",
53
53
  "p-limit": "4.0.0",
54
54
  "p-retry": "5.1.1",
55
55
  "p-throttle": "5.0.0",
@@ -57,7 +57,7 @@
57
57
  "yargs": "17.6.2"
58
58
  },
59
59
  "dependencies": {
60
- "@uniformdev/context": "^17.5.1-alpha.130+3fac779b1"
60
+ "@uniformdev/context": "^17.5.1-alpha.135+34befe009"
61
61
  },
62
62
  "files": [
63
63
  "/dist"
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "3fac779b1b42a1afeb05156cb51768a98573438f"
68
+ "gitHead": "34befe00943e830990ba91f431a2b064f29e097c"
69
69
  }