@uniformdev/canvas 16.2.1-alpha.106 → 16.2.1-nuxt.249

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.
@@ -0,0 +1,11 @@
1
+ var pe=Object.create;var T=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var fe=(t,e,n)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Le=(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 Ne=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),$e=(t,e)=>{for(var n in e)T(t,n,{get:e[n],enumerable:!0})},N=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of le(e))!he.call(t,o)&&o!==n&&T(t,o,{get:()=>e[o],enumerable:!(r=me(e,o))||r.enumerable});return t};var de=(t,e,n)=>(n=t!=null?pe(ue(t)):{},N(e||!t||!t.__esModule?T(n,"default",{value:t,enumerable:!0}):n,t)),Be=t=>N(T({},"__esModule",{value:!0}),t);var Me=(t,e,n)=>(fe(t,typeof e!="symbol"?e+"":e,n),n),$=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var ye=(t,e,n)=>($(t,e,"read from private field"),n?n.call(t):e.get(t)),Ve=(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)},Ce=(t,e,n,r)=>($(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),ke=(t,e,n,r)=>({set _(o){Ce(t,e,o,n)},get _(){return ye(t,e,r)}});var k=x((Je,V)=>{function h(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))}V.exports=h;h.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};h.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};h.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 r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0};h.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)};h.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};h.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};h.prototype.start=h.prototype.try;h.prototype.errors=function(){return this._errors};h.prototype.attempts=function(){return this._attempts};h.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,s=(t[i]||0)+1;t[i]=s,s>=n&&(e=o,n=s)}return e}});var j=x(E=>{var Ee=k();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 r=[],o=0;o<e.retries;o++)r.push(this.createTimeout(o,e));return t&&t.forever&&!r.length&&r.push(this.createTimeout(o,e)),r.sort(function(i,s){return i-s}),r};E.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,r=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return r=Math.min(r,e.maxTimeout),r};E.wrap=function(t,e,n){if(e instanceof Array&&(n=e,e=null),!n){n=[];for(var r in t)typeof t[r]=="function"&&n.push(r)}for(var o=0;o<n.length;o++){var i=n[o],s=t[i];t[i]=function(a){var p=E.operation(e),m=Array.prototype.slice.call(arguments,1),l=m.pop();m.push(function(u){p.retry(u)||(u&&(arguments[0]=p.mainError()),l.apply(this,arguments))}),p.attempt(function(){a.apply(t,m)})}.bind(t,s),t[i].options=e}}});var D=x((Ye,U)=>{U.exports=j()});function g(t,e){let n=[{ancestorsAndSelf:[{component:t,parentSlot:void 0,parentSlotIndex:void 0}]}];do{let r=n.pop();if(!r)continue;let o=r.ancestorsAndSelf[0],i=!0;e(o.component,r.ancestorsAndSelf,{replaceComponent:c=>{Object.assign(o.component,c),["parameters","variant","slots","data","_pattern","_patternError"].forEach(p=>{c[p]||delete o.component[p]})},removeComponent:()=>{let{parentSlot:c,parentSlotIndex:a}=r.ancestorsAndSelf[0],p=r.ancestorsAndSelf[1];if(c&&typeof a!="undefined")p.component.slots[c].splice(a,1);else throw new Error("Unable to delete composition.")},insertAfter:c=>{let a=Array.isArray(c)?c:[c],{parentSlot:p,parentSlotIndex:m}=r.ancestorsAndSelf[0],l=r.ancestorsAndSelf[1];if(p&&typeof m!="undefined")l.component.slots[p].splice(m+1,0,...a);else throw new Error("Unable to insert after a component not in a slot.")},stopProcessingDescendants(){i=!1}});let s=o.component.slots;if(i&&s){let c=Object.keys(s);for(let a=c.length-1;a>=0;a--){let p=c[a],m=s[p];for(let l=m.length-1;l>=0;l--)n.push({ancestorsAndSelf:[{component:m[l],parentSlot:p,parentSlotIndex:l},...r.ancestorsAndSelf]})}}}while(n.length>0)}function A(t){let e=[];for(let n=t.length-1;n>=0;n--){let{parentSlot:r,parentSlotIndex:o}=t[n];r&&o!==void 0&&e.push(`${r}[${o}]`)}return`.${e.join(".")}`}var B=class{constructor(e,n){this.groups=e.reduce((r,o)=>{var s;let i=n(o.args);return r[i]=(s=r[i])!=null?s:[],r[i].push(o),r},{})}resolveKey(e,n){this.groups[e].forEach(r=>r.resolve(n))}resolveRemaining(e){Object.keys(this.groups).forEach(n=>{this.groups[n].forEach(r=>{r.isCompleted||r.resolve(e)})})}};var b=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(o=>this._paramMatches.push({name:o,enhancer:this._resolveParameterEnhancer(n)})),this}parameterType(e,n){return(Array.isArray(e)?e:[e]).forEach(o=>this._paramMatches.push({type:o,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 r;return(r=this._paramMatches.find(o=>o.name&&o.name===e||o.type&&o.type===n.type||!o.type&&!o.name))==null?void 0:r.enhancer}resolveComponentEnhancers(){return this._dataMatches}_resolveParameterEnhancer(e){return typeof e=="function"?{enhanceOne:e}:e}},M=class{constructor(){this._componentIndex={};this._rootBuilder=new b}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(o=>{this._componentIndex[o]=this._componentIndex[o]||new b,n(this._componentIndex[o])}),this}resolveParameterEnhancer(e,n,r){let o=this._componentIndex[e.type];if(o){let i=o.resolveParameterEnhancer(n,r);if(i)return i}return this._rootBuilder.resolveParameterEnhancer(n,r)}resolveComponentEnhancers(e){let n=this._rootBuilder.resolveComponentEnhancers(),r=this._componentIndex[e.type];if(r){n=new Map(n);for(let[o,i]of r.resolveComponentEnhancers())n.set(o,i)}return n}};var R=class{constructor(e,n,r){this._resolve=e;this._reject=n;this.args=r;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 Ge({handleBatch:t,shouldQueue:e,limitPolicy:n}){let r=[];return{enhanceOne:async s=>{if(!e||e(s))return new Promise((c,a)=>{r.push(new R(c,a,s))})},completeAll:async()=>{if(r.length>0){try{await t(r)}catch(c){r.forEach(a=>a.reject(c))}if(r.some(c=>!c.isCompleted))throw new Error("The completeAll() function failed to resolve or reject all promises in the batch!")}let s=r.length;return r=[],s},limitPolicy:n}}var I=class extends Error{constructor(){super("Throttled function aborted"),this.name="AbortError"}};function O({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 r=new Map,o=0,i=0;function s(){let m=Date.now();return m-o>e?(i=1,o=m,0):(i<t?i++:(o+=e,i=1),o-m)}let c=[];function a(){let m=Date.now();if(c.length<t)return c.push(m),0;let l=c.shift()+e;return m>=l?(c.push(m),0):(c.push(l),l-m)}let p=n?a:s;return m=>{let l=function(...u){if(!l.isEnabled)return(async()=>m.apply(this,u))();let d;return new Promise((f,y)=>{d=setTimeout(()=>{f(m.apply(this,u)),r.delete(d)},p()),r.set(d,y)})};return l.abort=()=>{for(let u of r.keys())clearTimeout(u),r.get(u)(new I);r.clear(),c.splice(0,c.length)},l.isEnabled=!0,l}}var G=de(D(),1),Pe=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"]),S=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}},ge=(t,e,n)=>{let r=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=r,t},Ae=t=>Pe.has(t),F=t=>globalThis.DOMException===void 0?new Error(t):new DOMException(t);async function L(t,e){return new Promise((n,r)=>{e={onFailedAttempt(){},retries:10,...e};let o=G.default.operation(e);o.attempt(async i=>{try{n(await t(i))}catch(s){if(!(s instanceof Error)){r(new TypeError(`Non-error was thrown: "${s}". You should only throw errors.`));return}if(s instanceof S)o.stop(),r(s.originalError);else if(s instanceof TypeError&&!Ae(s.message))o.stop(),r(s);else{ge(s,i,e);try{await e.onFailedAttempt(s)}catch(c){r(c);return}o.retry(s)||r(o.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{o.stop();let i=e.signal.reason===void 0?F("The operation was aborted."):e.signal.reason;r(i instanceof Error?i:F(i))},{once:!0})})}function z({throttle:t={interval:1e3,limit:10},retry:e={retries:1,factor:1.66}}){let n=t?O(t):null;return function(o){let i=async()=>await o();if(n&&(i=n(i)),e){let s=i;i=()=>L(s,e)}return i()}}var P=async t=>await t();async function ot({composition:t,enhancers:e,context:n,onErrors:r=o=>{throw new Error(o.map(i=>`${i.message}
2
+ ${typeof i.error=="object"&&"stack"in i.error?i.error.stack:i.error}`).join(`
3
+
4
+ `))}}){let o=[],i=new Set,s=new Set;g(t,(a,p)=>{var l;Object.entries((l=a.parameters)!=null?l:{}).forEach(([u,d])=>{let f=e.resolveParameterEnhancer(a,u,d);f&&(s.add(f),o.push(_e(a,p,u,d,f,n)))});let m=e.resolveComponentEnhancers(a);o.push(Te(a,p,m,n)),i.add(m)}),o.push(...Array.from(i).flatMap(a=>Array.from(a).map(async([,p])=>{var m;try{p.completeAll&&await((m=p.limitPolicy)!=null?m:P)(()=>p.completeAll())}catch(l){return{error:l,message:"Batch component enhancer failed. Individual failed components should receive their own rejections."}}}))),o.push(...Array.from(s).map(async a=>{var p;try{a.completeAll&&await((p=a.limitPolicy)!=null?p:P)(()=>a.completeAll())}catch(m){return{error:m,message:"Batch parameter enhancer failed. Individual failed parameters should receive their own rejections."}}}));let c=(await Promise.all(o)).flatMap(a=>Array.isArray(a)?a:[a]).filter(a=>a);c.length&&r(c)}async function Te(t,e,n,r){return n.size&&(t.data={}),await Promise.all(Array.from(n).map(async([o,i])=>{var s;try{let a=await(i.completeAll?P:(s=i.limitPolicy)!=null?s:P)(async()=>i.enhanceOne({component:t,context:r}));a!=null&&(t.data[o]=a)}catch(c){let a=`Component ${A(e)} (type: ${t.type}): data.${o} enhancer threw exception. Data key will not be present.`;return delete t.data[o],{message:a,error:c}}}))}async function _e(t,e,n,r,o,i){var s;try{let a=await(o.completeAll?P:(s=o.limitPolicy)!=null?s:P)(async()=>o.enhanceOne({parameter:r,parameterName:n,component:t,context:i}));a===null?delete t.parameters[n]:typeof a=="undefined"?t.parameters[n]={...r,value:r.value}:t.parameters[n]={...r,value:a}}catch(c){let a=`Component ${A(e)} (type: ${t.type}): enhancing parameter ${n} (type: ${r.type}) threw exception. Parameter will be removed.`;return delete t.parameters[n],{message:a,error:c}}}var st=(t,...e)=>({enhanceOne:r=>{let o="enhanceOne"in t?t.enhanceOne(r):t(r);for(let i of e){let s=ve(o)?o:Promise.resolve(o),c="enhanceOne"in i?i.enhanceOne:i;o=s.then(a=>c({...r,parameter:{type:r.parameter.type,value:a}}))}return o},completeAll:async()=>{var r,o;for(let i of e)if("completeAll"in i)throw new Error("Only the first enhancer in a compose chain can use the completeAll function (batching)");return(o="completeAll"in t?(r=t.completeAll)==null?void 0:r.call(t):0)!=null?o:0}});function ve(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}var _=class extends Error{constructor(n,r,o,i,s,c){super(`${n}
5
+ ${i}${s?" "+s:""} (${r} ${o}${c?` Request ID: ${c}`:""})`);this.errorMessage=n;this.fetchMethod=r;this.fetchUri=o;this.statusCode=i;this.statusText=s;this.requestId=c;Object.setPrototypeOf(this,_.prototype)}},v=class{constructor(e){var r,o,i,s,c,a;if(!e.apiKey&&!e.bearerToken)throw new Error("You must provide an API key or a bearer token");let n=e.fetch;if(!n)if(typeof globalThis!="undefined"&&typeof globalThis.fetch!="undefined")n=globalThis.fetch.bind(globalThis);else if(typeof fetch!="undefined")n=fetch;else throw new Error("You must provide or polyfill a fetch implementation when not in a browser");this.options={...e,fetch:n,apiHost:(r=e.apiHost)!=null?r:"https://uniform.app",apiKey:(o=e.apiKey)!=null?o:null,projectId:(i=e.projectId)!=null?i:null,bearerToken:(s=e.bearerToken)!=null?s:null,limitPolicy:(c=e.limitPolicy)!=null?c:z({}),bypassCache:(a=e.bypassCache)!=null?a:!1}}async getCompositionList(e){let{projectId:n}=this.options,r=this.createUrl("/api/v1/canvas",{...e,projectId:n});return await this.apiClient(r)}async getCompositionBySlug(e){let{projectId:n}=this.options,r=this.createUrl("/api/v1/canvas",{...e,projectId:n});return await this.apiClient(r)}async getCompositionById(e){let{projectId:n}=this.options,r=this.createUrl("/api/v1/canvas",{...e,projectId:n});return await this.apiClient(r)}async updateComposition(e){let n=this.createUrl("/api/v1/canvas");await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeComposition(e){let n=this.createUrl("/api/v1/canvas"),{projectId:r}=this.options;await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:r}),expectNoContent:!0})}async getComponentDefinitions(e){let{projectId:n}=this.options,r=this.createUrl("/api/v1/canvas-definitions",{...e,projectId:n});return await this.apiClient(r)}async updateComponentDefinition(e){let n=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeComponentDefinition(e){let n=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async apiClient(e,n){return this.options.limitPolicy(async()=>{var i;let r=this.options.apiKey?{"x-api-key":this.options.apiKey}:{Authorization:`Bearer ${this.options.bearerToken}`},o=await this.options.fetch(e.toString(),{...n,headers:{"x-bypass-cache":this.options.bypassCache.toString(),...n==null?void 0:n.headers,...r}});if(!o.ok){let s="";try{let c=await o.text();try{let a=JSON.parse(c);a.errorMessage?s=Array.isArray(a.errorMessage)?a.errorMessage.join(", "):a.errorMessage:s=c}catch(a){s=c}}catch(c){s="General error"}throw new _(s,(i=n==null?void 0:n.method)!=null?i:"GET",e.toString(),o.status,o.statusText,v.getRequestId(o))}return n!=null&&n.expectNoContent?null:await o.json()})}createUrl(e,n){let r=new URL(`${this.options.apiHost}${e}`);return Object.entries(n!=null?n:{}).forEach(([o,i])=>{var s;typeof i!==void 0&&i!==null&&r.searchParams.append(o,(s=i==null?void 0:i.toString())!=null?s:"")}),r}static getRequestId(e){let n=e.headers.get("apigw-requestid");if(n)return n}},H=class extends v{constructor(e){super({...e,bypassCache:!0})}};var lt="$personalization",ut="$test",J="$localization",ht="intentTag",K="locale",ft="pz",dt="test",Y="localized",yt=0,Ct=64,Z="$pzCrit",q="$tstVrnt",Et="$enr",W="$loop",Q="$loopResource",X="$loopBinding",ee="body";var gt=t=>t.startsWith("$");function _t(t){return t?t.map((e,n)=>{var i,s;let r=(s=(i=e.parameters)==null?void 0:i[Z])==null?void 0:s.value,o=(r==null?void 0:r.name)||`pz-${n}-${e.type}`;return{...e,id:o,pz:r}}):[]}function wt(t){return t?t.map((e,n)=>{var i,s,c;let r=(s=(i=e.parameters)==null?void 0:i[q])==null?void 0:s.value,o=(c=r==null?void 0:r.id)!=null?c:"testId"in e?e.testId:`ab-${n}-${e.type}`;return{...e,id:o}}):[]}var te="https://js.pusher.com/7.0.3/pusher.min.js";async function be(){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="${te}"><\/script> manually.`)},5e3),r=document.createElement("script");r.src=te,r.addEventListener("load",()=>{clearTimeout(n),t(window.Pusher)}),document.head.appendChild(r)})}async function Rt(){let t=await be();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:r=>{let o=n.subscribe(r);return{unsubscribe:()=>n.unsubscribe(r),addEventHandler:(i,s)=>(o.bind(i,s),()=>o.unbind(i,s))}}}}return e}function ne(t,e,n){return`${t}.${e}@${n}`}function Lt({projectId:t,compositionId:e,compositionState:n=0,eventBus:{subscribe:r},callback:o,event:i="updated"}){let s=ne(t,e,n),c=r(s),a=c.addEventHandler(i,o);return()=>{a(),c.unsubscribe()}}function we({component:t}){var r;let e={},n=(r=t.slots)==null?void 0:r[Y];return n==null||n.forEach(o=>{var s;let i=(s=o.parameters)==null?void 0:s[K];(i==null?void 0:i.value)&&typeof i.value=="string"&&(e[i.value]=e[i.value]||[],e[i.value].push(o))}),e}function Mt({composition:t,locale:e}){g(t,(n,r,o)=>{if(n.type===J){let i=we({component:n}),s=typeof e=="string"?e:e({component:n,locales:i}),c;if(s&&(c=i[s]),c!=null&&c.length){let[a,...p]=c;o.replaceComponent(a),p.length&&o.insertAfter(p)}else o.removeComponent()}})}import{get as xe,set as Re}from"json-pointer";function oe(t,e){if(typeof t.pointer=="string")return re(e,t.pointer);let n={};return Object.entries(t.pointer).forEach(([r,o])=>{Re(n,r,re(e,o))}),n}function re(t,e){try{return xe(t,e)}catch(n){throw new Error(`Unable to resolve resource pointer '${e}': ${n.message}
6
+
7
+ Resources:
8
+ ${JSON.stringify(t,null,2)}`)}}function ie(t,e){if(!(t!=null&&t.binding))return{bound:!1};switch(t.binding.syntax){case"jptr":return{bound:!0,value:oe(t.binding,e)};default:throw new Error(`Unsupported binding syntax '${t.binding.syntax}'`)}}import Ie from"rfdc";var Oe=Ie();function Se(t,e,n){let{throwErrors:r=!0,expandLoops:o=!0,preserveBindings:i=!1}=n||{},s=Oe(t),c=!1,a=[];if(g(s,(p,m,l)=>{var u,d;if(!!p.parameters&&(Object.entries(p.parameters).forEach(([f,y])=>{try{let C=ie(y,e);C.bound&&(c=!0,y.value=C.value,i||delete y.binding)}catch(C){a.push(new Error(`Failed to bind parameter ${f} in component ${A(m)}: ${C.message}`)),delete p.parameters[f]}}),p.type===W&&(l.stopProcessingDescendants(),o))){let f=(d=(u=p.slots)==null?void 0:u[ee])!=null?d:[],y=p.parameters[X].value;if(!Array.isArray(y)){a.push(new Error(`Failed to bind loop component ${A(m)}: loop is not bound to an array of data`));return}let C={...n,throwErrors:!1};y.reverse().forEach(se=>{let ae={...e,[p.parameters[Q].value]:se};f.forEach(ce=>{let w=Se(ce,ae,C);w.errors.length>0?a.push(...w.errors):l.insertAfter(w.result)})}),l.removeComponent()}}),r&&a.length>0)throw new Error(`${a.length} error${a.length!==1?"s":""} occurred while binding parameters to resources.
9
+
10
+ ${a.map(p=>p.message).join(`
11
+ `)}`);return{hasBindings:c,errors:a,result:s}}export{Le as a,Ne as b,x as c,$e as d,de as e,Be as f,Me as g,ye as h,Ve as i,Ce as j,ke as k,g as l,A as m,B as n,b as o,M as p,R as q,Ge as r,z as s,P as t,ot as u,st as v,_ as w,v as x,H as y,lt as z,ut as A,J as B,ht as C,K as D,ft as E,dt as F,Y as G,yt as H,Ct as I,Z as J,q as K,Et as L,W as M,Q as N,X as O,ee as P,gt as Q,_t as R,wt as S,Rt as T,ne as U,Lt as V,we as W,Mt as X,ie as Y,Se as Z};
package/dist/cli/cli.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { UniformCLIPlugin } from '@uniformdev/cli';
2
- import { r as ComponentDefinition, v as CompositionAPIResponse } from '../createEventBus-3af5b249.js';
2
+ import { r as ComponentDefinition, v as CompositionAPIResponse } from '../createEventBus-c826147a.js';
3
3
  import { UniformPackage } from '@uniformdev/cli/sync';
4
4
  import 'pusher-js';
5
5