@datocms/cma-client-browser 5.2.0-alpha.3 → 5.2.0-alpha.5
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.
- package/dist/browser/index.js +4 -4
- package/dist/browser/index.js.map +3 -3
- package/dist/cjs/generated/resources.js +3 -3
- package/dist/cjs/generated/resources.js.map +1 -1
- package/dist/esm/generated/resources.d.ts +2 -2
- package/dist/esm/generated/resources.js +2 -2
- package/dist/esm/generated/resources.js.map +1 -1
- package/dist/types/generated/resources.d.ts +2 -2
- package/package.json +3 -3
- package/src/generated/resources.ts +2 -2
package/dist/browser/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Zr=Object.create;var Bi=Object.defineProperty;var es=Object.getOwnPropertyDescriptor;var ts=Object.getOwnPropertyNames;var is=Object.getPrototypeOf,rs=Object.prototype.hasOwnProperty;var Ze=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),sr=(t,e)=>{for(var i in e)Bi(t,i,{get:e[i],enumerable:!0})},ss=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ts(e))!rs.call(t,n)&&n!==i&&Bi(t,n,{get:()=>e[n],enumerable:!(r=es(e,n))||r.enumerable});return t};var ns=(t,e,i)=>(i=t!=null?Zr(is(t)):{},ss(e||!t||!t.__esModule?Bi(i,"default",{value:t,enumerable:!0}):i,t));var Fi=Ze(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.TaskCollisionStrategy=void 0;var us;(function(t){t[t.DEFAULT=0]="DEFAULT",t[t.KEEP_THIS=1]="KEEP_THIS",t[t.KEEP_OTHER=2]="KEEP_OTHER",t[t.KEEP_BOTH=3]="KEEP_BOTH",t[t.RESOLVE_THIS=4]="RESOLVE_THIS",t[t.RESOLVE_OTHER=5]="RESOLVE_OTHER"})(us=It.TaskCollisionStrategy||(It.TaskCollisionStrategy={}))});var ki=Ze(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});var Si=class{constructor(e,i){this._code=e,this._message=i}get code(){return this._code}get message(){return this._message}};Pi.default=Si});var zi=Ze(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.mutexEquality=rt.mutexBitwiseAnd=void 0;function ds(t,e){return(t&e)!==0}rt.mutexBitwiseAnd=ds;function cs(t,e){return t===e}rt.mutexEquality=cs});var ar=Ze(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});var qi=class{constructor(e,i){this._meta=void 0,this._task=e,this._scheduler=i}withDescriptor(e){return this._descriptor=e,this}withMutex(e){return this._mutex=e,this}withMeta(e){return this._meta=e,this}runBeforeExecuting(e){return this._onPreExecute=e,this}handleCollisions(e){return this._onTaskCollision=e,this}execute(e){return this._scheduler.enqueue({priority:e,mutex:this._mutex,descriptor:this._descriptor,meta:this._meta,execute:this._task,onPreExecute:this._onPreExecute,onTaskCollision:this._onTaskCollision})}};Oi.default=qi});var cr=Ze(Me=>{"use strict";var fs=Me&&Me.__awaiter||function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(d){try{a(r.next(d))}catch(h){o(h)}}function f(d){try{a(r.throw(d))}catch(h){o(h)}}function a(d){d.done?s(d.value):n(d.value).then(l,f)}a((r=r.apply(t,e||[])).next())})},dr=Me&&Me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Me,"__esModule",{value:!0});var W=Fi(),hs=dr(ki()),ps=zi(),ms=dr(ar()),D;(function(t){t[t.PENDING=0]="PENDING",t[t.EXECUTING=1]="EXECUTING",t[t.TERMINATED=2]="TERMINATED"})(D||(D={}));function ur(t,e){for(let i of t.listeners)i.reject(e)}var Vi=class{constructor(e,i={}){this._queue=[],this._isExecuting=!1,this._idleListeners=[],this._maxConcurrentTasks=e,this._samePriorityMutex=!!i.samePriorityMutex,this._mutexStrategy=i.mutexStrategy||ps.mutexEquality,i.disableLogging?this._errorLog=()=>{}:this._errorLog=console.error}enqueue(e){return new Promise((i,r)=>{typeof e=="function"&&(e={priority:0,execute:e});let n=this._checkMutexes(e,i,r);n.task?this._addTask(n.task):n.canceled&&r(this.createCanceledError())})}prepare(e){return new ms.default(e,this)}_addTask(e){this._queue.push(e),this._applyPriorities(),this._isExecuting||(this._isExecuting=!0,setTimeout(this._executeNextTasks.bind(this)))}get executingTasks(){return this._queue.reduce((e,i)=>i.state===D.EXECUTING?e+1:e,0)}createCanceledError(){return new hs.default(50,"Task has been canceled in favor of another task")}_findFirstPendingTask(){return this._queue.find(e=>e.state===D.PENDING)}_isIdle(){return this._queue.length===0||!this._queue.find(e=>e.state!==D.TERMINATED)}_removeTaskAt(e){this._queue.splice(e,1)}_executeTask(e){return fs(this,void 0,void 0,function*(){try{return e.task.onPreExecute&&e.task.onPreExecute(),yield e.task.execute()}catch(i){throw i}finally{e.state=D.TERMINATED;let i=this._queue.indexOf(e);this._removeTaskAt(i),this._executeNextTasks()}})}_executeNextTasks(){let e=this.executingTasks;if(e>=this._maxConcurrentTasks)return;let i=this._maxConcurrentTasks-e;for(let r=0;r<i;r++){let n=this._findFirstPendingTask();if(!n){this._isIdle()&&this._switchToIdle();return}n.state=D.EXECUTING,this._executeTask(n).then(s=>{for(let{resolve:o}of n.listeners)try{o(s)}catch(l){this._errorLog("An error occurred while resolving listener",l)}}).catch(s=>{for(let{reject:o}of n.listeners)try{o(s)}catch(l){this._errorLog("An error occurred while rejecting listener",l)}})}}_switchToIdle(){this._isExecuting=!1;let e=this._idleListeners;this._idleListeners=[];for(let{resolve:i}of e)try{i()}catch(r){}}waitForIdle(){return this._isExecuting?new Promise((e,i)=>{this._idleListeners.push({resolve:e,reject:i})}):Promise.resolve()}_applyPriorities(){this._queue.sort((e,i)=>i.task.priority-e.task.priority)}_checkMutexes(e,i,r){for(let n=0;n<this._queue.length;n++){let s=this._queue[n];if(s.state===D.TERMINATED||this._samePriorityMutex&&s.task.priority!=e.priority||!s.task.mutex||!e.mutex||!this._mutexStrategy(s.task.mutex,e.mutex))continue;let o,l;if(s.task.onTaskCollision)if(o=s.task.onTaskCollision(e),o===W.TaskCollisionStrategy.KEEP_OTHER&&s.state!==D.EXECUTING){this._removeTaskAt(n--),ur(s,this.createCanceledError());continue}else{if(o===W.TaskCollisionStrategy.KEEP_THIS)return{canceled:!0};if(o===W.TaskCollisionStrategy.RESOLVE_OTHER)return this._removeTaskAt(n--),{canceled:!1,task:{task:e,state:D.PENDING,listeners:[{resolve:i,reject:r},...s.listeners]}};if(o===W.TaskCollisionStrategy.RESOLVE_THIS)return s.listeners=[...s.listeners,{resolve:i,reject:r}],{canceled:!1}}if(e.onTaskCollision){if(l=e.onTaskCollision(s.task),l===W.TaskCollisionStrategy.KEEP_OTHER)return{canceled:!0};if(l===W.TaskCollisionStrategy.KEEP_THIS){this._removeTaskAt(n--),ur(s,this.createCanceledError());continue}else{if(l===W.TaskCollisionStrategy.RESOLVE_OTHER)return s.listeners=[...s.listeners,{resolve:i,reject:r}],{canceled:!1};if(l===W.TaskCollisionStrategy.RESOLVE_THIS)return this._removeTaskAt(n--),{canceled:!1,task:{task:e,state:D.PENDING,listeners:[{resolve:i,reject:r},...s.listeners]}}}}if(!(o===W.TaskCollisionStrategy.KEEP_BOTH&&l===W.TaskCollisionStrategy.KEEP_BOTH))return{canceled:!0}}return{canceled:!1,task:{task:e,state:D.PENDING,listeners:[{resolve:i,reject:r}]}}}};Me.default=Vi});var pr=Ze(V=>{"use strict";var fr=V&&V.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(V,"__esModule",{value:!0});V.mutexEquality=V.mutexBitwiseAnd=V.SchedulerError=V.TaskCollisionStrategy=V.Scheduler=void 0;var ys=fr(cr());V.Scheduler=ys.default;var _s=Fi();Object.defineProperty(V,"TaskCollisionStrategy",{enumerable:!0,get:function(){return _s.TaskCollisionStrategy}});var gs=fr(ki());V.SchedulerError=gs.default;var hr=zi();Object.defineProperty(V,"mutexBitwiseAnd",{enumerable:!0,get:function(){return hr.mutexBitwiseAnd}});Object.defineProperty(V,"mutexEquality",{enumerable:!0,get:function(){return hr.mutexEquality}})});function nr(t){return typeof t=="object"&&!!t&&"data"in t}function os(t){return typeof t=="object"&&!!t&&"included"in t}function R({__itemTypeId:t,id:e,type:i,attributes:r,relationships:n,meta:s}){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t?{__itemTypeId:t}:{}),e?{id:e}:{}),i?{type:i}:{}),r||{}),n?Object.fromEntries(Object.entries(n).map(([o,l])=>[o,l==null?void 0:l.data])):{}),s?{meta:s}:{})}function c(t){if(!nr(t))throw new Error("Invalid body!");return Array.isArray(t.data)?t.data.map(R):R(t.data)}function or(t){return Boolean(t&&typeof t=="object"&&"type"in t&&t.type==="item")}function Ei(t){if(Array.isArray(t))return t.map(Ei);if(t&&typeof t=="object"){if(or(t))return et(t);let e={};for(let[i,r]of Object.entries(t))e[i]=Ei(r);return e}return t}function et(t){if(!or(t))return t;let e=t.attributes?Ei(t.attributes):t.attributes;return Object.assign(Object.assign({},t),{attributes:e,__itemTypeId:t.relationships.item_type.data.id})}function P(t){if(!nr(t))throw new Error("Invalid body!");let e;Array.isArray(t.data)?e=t.data.map(et):e=et(t.data);let i;return os(t)&&(i=t.included.map(et)),Object.assign(Object.assign(Object.assign({},t),{data:e}),i?{included:i}:{})}function ls(t){if(typeof t!="object"||t===null||!("data"in t))return!1;let e=t;if(!Array.isArray(e.data))return!1;let i=e;if(i.data.length===0)return!1;let r=i.data[0];return!(typeof r!="object"||r===null||!("id"in r)||!("type"in r)||!("attributes"in r)||r.type!=="api_error")}var tt=class extends Error{constructor(e){super("API Error!"),Object.setPrototypeOf(this,new.target.prototype),"captureStackTrace"in Error?Error.captureStackTrace(this,N):this.stack=new Error().stack,this.request=e.request,this.preCallStack=e.preCallStack,this.message=`${e.request.method} ${e.request.url}: Timeout error`,this.preCallStack&&(this.stack+=`
|
|
2
2
|
Caused By:
|
|
3
3
|
${this.preCallStack}`)}},N=class extends Error{constructor(e){super("API Error!"),Object.setPrototypeOf(this,new.target.prototype),"captureStackTrace"in Error?Error.captureStackTrace(this,N):this.stack=new Error().stack,this.request=e.request,this.response=e.response,this.preCallStack=e.preCallStack;let i=`${e.request.method} ${e.request.url}: ${this.response.status} ${this.response.statusText}`;this.errors.length>0&&(i+=`
|
|
4
4
|
|
|
5
5
|
${JSON.stringify(this.errors,null,2)}`),this.message=i,this.preCallStack&&(this.stack+=`
|
|
6
6
|
Caused By:
|
|
7
|
-
${this.preCallStack}`)}get errors(){return os(this.response.body)?this.response.body.data:[]}findError(e,i){let r=Array.isArray(e)?e:[e];return this.errors.find(n=>r.includes(n.attributes.code)&&(!i||(typeof i=="function"?i(n.attributes.details):Object.entries(i).every(([s,o])=>n.attributes.details[s]===o))))}};var C=class extends Error{constructor(){super("Promise canceled!"),Object.setPrototypeOf(this,new.target.prototype)}};function G(t,e){let i=null,r=new Promise((n,s)=>{i=()=>{try{e&&e(),s(new C)}catch(a){s(a)}},(typeof t=="function"?t():t).then(n,s)});return i&&(r.cancel=i),r}function it(t){return new Promise(e=>{setTimeout(e,t)})}var as=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(d){try{l(r.next(d))}catch(p){o(p)}}function f(d){try{l(r.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):n(d.value).then(a,f)}l((r=r.apply(t,e||[])).next())})};function or(t){return as(this,void 0,void 0,function*(){let e,i=0;do try{i+=1,yield it(i*1e3),e=yield t()}catch(r){if(!(r instanceof N)||r.response.status!==404)throw r}while(!e);return e})}var hr=ss(pr());var We=function(t){return this instanceof We?(this.v=t,this):new We(t)},gs=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||a(u,m)})})}function a(u,m){try{f(r[u](m))}catch(g){p(s[0][3],g)}}function f(u){u.value instanceof We?Promise.resolve(u.value.v).then(l,d):p(s[0][2],u)}function l(u){a("next",u)}function d(u){a("throw",u)}function p(u,m){u(m),s.shift(),s.length&&a(s[0][0],s[0][1])}};function R(t,e,i,r){return gs(this,arguments,function*(){let s=(i==null?void 0:i.perPage)||t.defaultLimit;if(s>t.maxLimit)throw new Error(`perPage option cannot exceed maximum value of ${t.maxLimit}`);let o=(i==null?void 0:i.concurrency)||1;if(o>10)throw new Error("concurrency option cannot exceed maximum value of 10");let a=yield We(e({limit:s,offset:0}));for(let p of a.data)yield yield We(p);let f=a.meta.total_count,l=new hr.Scheduler(o),d=[];for(let p=s;p<f;p+=s)d.push(l.enqueue(()=>e({limit:s,offset:p})));for(;d.length>0;){let p=yield We(d.shift());for(let u of p.data)yield yield We(r?et(u):u)}})}function B(t){t&&"page"in t&&console.warn("Passing a `page` query param on paged iterators has no effect: use the `perPage` option instead.")}var mr="__ARRAY_INDEX__";function ws(t){return t.reduce((e,i,r)=>r===0?i:i===mr?`${e}[]`:`${e}[${i}]`,"")}function bs(t){if(typeof t=="number"||typeof t=="string")return t.toString();if(t===!0)return"true";if(t===!1)return"false";throw`Don't know how to serialize param value ${JSON.stringify(t)}`}function At(t,e=[]){let i=[];if(typeof t=="number"||typeof t=="string"||typeof t=="boolean")i.push([ws(e),bs(t)]);else if(typeof t=="object"){if(Array.isArray(t))for(let r of t)for(let n of At(r,[...e,mr]))i.push(n);else if(t)for(let[r,n]of Object.entries(t))for(let s of At(n,[...e,r]))i.push(s)}return i}var vs=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(d){try{l(r.next(d))}catch(p){o(p)}}function f(d){try{l(r.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):n(d.value).then(a,f)}l((r=r.apply(t,e||[])).next())})},xs=typeof window!="undefined"&&typeof window.document!="undefined",Is=5,L;(function(t){t[t.NONE=0]="NONE",t[t.BASIC=1]="BASIC",t[t.BODY=2]="BODY",t[t.BODY_AND_HEADERS=3]="BODY_AND_HEADERS"})(L||(L={}));function Us(t){let e={};return t.forEach((i,r)=>{e[r]=i}),e}function yr(t,e,i,r,n,s,o){return{request:{url:e,method:t,headers:i,body:r},response:{status:n.status,statusText:n.statusText,headers:Us(n.headers),body:s},preCallStack:o}}function Ts(t,e,i,r,n){return{request:{url:e,method:t,headers:i,body:r},preCallStack:n}}function Rs(t,e,i,r,n,s,o){return{request:{url:e,method:t,headers:i,body:r},response:{status:n,statusText:"N/A",headers:{},body:s},preCallStack:o}}function Bs(t){return typeof t=="object"&&!!t&&"code"in t}function Es(t){return Object.fromEntries(Object.entries(t).map(([e,i])=>[e.toLowerCase(),i]))}var _r=1;function Fs(t){let e=t||(typeof fetch=="undefined"?void 0:fetch)||(typeof globalThis=="undefined"?void 0:globalThis.fetch);if(typeof e=="undefined")throw new Error("fetch() is not available: either polyfill it globally, or provide it as fetchFn option.");return e}function Ut(t){var e;return vs(this,void 0,void 0,function*(){let i=_r;_r+=1;let r=Fs(t.fetchFn),n=t.preCallStack,s=t.userAgent||"@datocms/rest-client-utils",o=t.retryCount||1,a=t.logLevel||L.NONE,f="autoRetry"in t?t.autoRetry:!0,l=t.logFn||(()=>!0),d=Object.assign({"content-type":"application/json",accept:"application/json",authorization:`Bearer ${t.apiToken}`,"user-agent":s},t.extraHeaders?Es(t.extraHeaders):{});xs&&delete d["user-agent"];let p=t.baseUrl.replace(/\/$/,""),u=t.body?JSON.stringify(t.body,null,2):void 0,m=t.queryParams&&Object.keys(t.queryParams).length>0?`?${new URLSearchParams(At(t.queryParams)).toString()}`:"",g=`${p}${t.url}${m}`;if(a>=L.BASIC){if(l(`[${i}] ${t.method} ${g}`),a>=L.BODY_AND_HEADERS)for(let[v,F]of Object.entries(d||{}))l(`[${i}] ${v}: ${F}`);a>=L.BODY&&u&&l(`[${i}] ${u}`)}try{let v=G(r(g,{method:t.method,headers:d,body:u})),F=setTimeout(()=>{v.cancel()},t.requestTimeout||3e4),U=yield v;clearTimeout(F);let A=U.headers.get("Content-Type"),K=A&&!A.includes("application/json");if(U.status===429||K){if(!f||K&&t.method!=="GET")throw new N(yr(t.method,g,d,t.body,U,void 0,n));let O=U.headers.has("X-RateLimit-Reset")?Number.parseInt(U.headers.get("X-RateLimit-Reset"),10):o;return a>=L.BASIC&&(U.status===429?l(`[${i}] Rate limit exceeded, wait ${O} seconds then retry...`):l(`[${i}] Invalid response content type "${A}" (status ${U.status}). Wait ${O} seconds then retry...`)),yield it(O*1e3),Ut(Object.assign(Object.assign({},t),{retryCount:o+1}))}if(a>=L.BASIC&&(l(`[${i}] Status: ${U.status} (${U.statusText})`),a>=L.BODY_AND_HEADERS))for(let O of["x-api-version","x-environment","x-queue-time","x-ratelimit-remaining","x-request-id","cf-ray"]){let ir=U.headers.get(O);ir&&l(`[${i}] ${O}: ${ir}`)}let Ge=U.status===204?void 0:yield U.json();if(a>=L.BODY&&Ge&&l(`[${i}] ${JSON.stringify(Ge,null,2)}`),U.status===202){let O=yield t.fetchJobResult(Ge.data.id);if(O.status<200||O.status>=300)throw new N(Rs(t.method,g,d,t.body,O.status,O.payload,n));Ge=O.payload}if(U.status>=200&&U.status<300)return Ge;let Lt=new N(yr(t.method,g,d,t.body,U,Ge,n)),tr=(e=Lt.errors.find(O=>O.attributes.transient))===null||e===void 0?void 0:e.attributes.code;if(f&&tr)return a>=L.BASIC&&l(`[${i}] ${tr}, wait ${o} seconds then retry...`),yield it(o*1e3),Ut(Object.assign(Object.assign({},t),{retryCount:o+1}));throw Lt}catch(v){if(v instanceof C||Bs(v)&&v.code.includes("ETIMEDOUT")){if(f&&o<Is)return a>=L.BASIC&&l(`[${i}] Timeout error, wait ${o} seconds then retry...`),yield it(o*1e3),Ut(Object.assign(Object.assign({},t),{retryCount:o+1}));throw new tt(Ts(t.method,g,d,t.body,n))}throw v}})}var wr=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]]);return i};function Nt(t){return typeof t=="object"&&!!t&&"id"in t&&"type"in t}function Vi(t){return Array.isArray(t)&&t.every(Nt)}function y(t,e){if(typeof t!="object"||!t)throw new Error("Invalid body!");if(Array.isArray(t))return{data:t.map(l=>{var d;return(d=y(l,e))===null||d===void 0?void 0:d.data})};let i=t,{id:r,type:n,meta:s}=i,o=wr(i,["id","type","meta"]),a={},f={};if(e.attributes==="*")for(let[l,d]of Object.entries(o))if(e.relationships.includes(l))if(Nt(d)){let{id:p,type:u}=d;f[l]={data:{id:p,type:u}}}else Vi(d)?f[l]={data:d.map(({id:p,type:u})=>({id:p,type:u}))}:f[l]={data:null};else a[l]=d;else if(e.relationships==="*")for(let[l,d]of Object.entries(o))if(e.attributes.includes(l))a[l]=d;else if(Nt(d)){let{id:p,type:u}=d;f[l]={data:{id:p,type:u}}}else Vi(d)?f[l]={data:d.map(({id:p,type:u})=>({id:p,type:u}))}:f[l]={data:null};else{for(let[l,d]of Object.entries(o))if(e.attributes.includes(l))a[l]=d;else if(e.relationships.includes(l))if(Nt(d)){let{id:p,type:u}=d;f[l]={data:{id:p,type:u}}}else Vi(d)?f[l]={data:d.map(({id:p,type:u})=>({id:p,type:u}))}:f[l]={data:null};e.attributes.includes("type")&&(a.type=n)}return{data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},r||e.id?{id:r||e.id}:{}),{type:e.type}),Object.keys(a).length>0?{attributes:a}:{}),Object.keys(f).length>0?{relationships:f}:{}),s?{meta:s}:{})}}function Li(t){if(Array.isArray(t))return t.map(Li);if(t&&typeof t=="object"){let e={};for(let[i,r]of Object.entries(t))i!=="__itemTypeId"&&(e[i]=Li(r));return e}return t}function gr(t){if(!t||typeof t!="object")return t;let{__itemTypeId:e}=t,i=wr(t,["__itemTypeId"]),r={};for(let[n,s]of Object.entries(i))r[n]=Li(s);return r}function Tt(t){return!t||!("data"in t)?t:Array.isArray(t.data)?Object.assign(Object.assign({},t),{data:t.data.map(gr)}):Object.assign(Object.assign({},t),{data:gr(t.data)})}function h(t){return typeof t=="string"?t:t.id}var w={};rr(w,{AccessToken:()=>ae,AuditLogEvent:()=>Z,BuildEvent:()=>fe,BuildTrigger:()=>Te,DailyUsage:()=>Ve,EditingSession:()=>Se,EmojiSuggestions:()=>ke,Environment:()=>ve,Field:()=>se,Fieldset:()=>ne,Item:()=>j,ItemType:()=>re,ItemTypeFilter:()=>Be,ItemVersion:()=>he,JobResult:()=>ue,MaintenanceMode:()=>xe,MenuItem:()=>ee,Plugin:()=>le,PublicInfo:()=>Oe,Role:()=>Je,ScheduledPublication:()=>ge,ScheduledUnpublishing:()=>we,SchemaMenuItem:()=>te,SearchResult:()=>be,Session:()=>oe,Site:()=>Ce,SiteInvitation:()=>Fe,SiteSearchSource:()=>Re,SiteSearchSourceEvent:()=>pe,SsoGroup:()=>Pe,SsoSettings:()=>ze,SsoUser:()=>Q,SubscriptionFeature:()=>ce,SubscriptionLimit:()=>de,Upload:()=>me,UploadCollection:()=>ie,UploadFilter:()=>Ee,UploadRequest:()=>ye,UploadSmartTag:()=>Ne,UploadTag:()=>Ae,UploadTrack:()=>_e,UsageCounter:()=>Le,User:()=>X,Webhook:()=>Ie,WebhookCall:()=>Ue,WhiteLabelSettings:()=>qe,Workflow:()=>$e});var _=class{constructor(e){this.client=e}};var st=class extends _{create(e){return this.rawCreate(y(e,{type:"role",attributes:["name","can_edit_favicon","can_edit_site","can_edit_schema","can_manage_menu","can_edit_environment","can_promote_environments","environments_access","can_manage_users","can_manage_shared_filters","can_manage_site_search_sources","can_manage_upload_collections","can_manage_build_triggers","can_manage_webhooks","can_manage_environments","can_manage_sso","can_access_audit_log","can_manage_workflows","can_manage_access_tokens","can_perform_site_search","can_access_build_events_log","can_access_site_search_source_events_log","positive_item_type_permissions","negative_item_type_permissions","positive_upload_permissions","negative_upload_permissions","positive_build_trigger_permissions","negative_build_trigger_permissions","positive_site_search_source_permissions","negative_site_search_source_permissions"],relationships:["inherits_permissions_from"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/roles",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"role",attributes:["name","can_edit_favicon","can_edit_site","can_edit_schema","can_manage_menu","can_edit_environment","can_promote_environments","environments_access","can_manage_users","can_manage_shared_filters","can_manage_site_search_sources","can_manage_upload_collections","can_manage_build_triggers","can_manage_webhooks","can_manage_environments","can_manage_sso","can_access_audit_log","can_manage_workflows","can_manage_access_tokens","can_perform_site_search","can_access_build_events_log","can_access_site_search_source_events_log","positive_item_type_permissions","negative_item_type_permissions","positive_upload_permissions","negative_upload_permissions","positive_build_trigger_permissions","negative_build_trigger_permissions","positive_site_search_source_permissions","negative_site_search_source_permissions"],relationships:["inherits_permissions_from"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/roles/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/roles"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/roles/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/roles/${e}`})}duplicate(e){return this.rawDuplicate(h(e)).then(i=>c(i))}rawDuplicate(e){return this.client.request({method:"POST",url:`/roles/${e}/duplicate`})}};st.TYPE="role";var Ss=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(d){try{l(r.next(d))}catch(p){o(p)}}function f(d){try{l(r.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):n(d.value).then(a,f)}l((r=r.apply(t,e||[])).next())})};function br(t,e){return t==null&&e==null?!0:t===e}function Ps(t,e){for(let i in t)if(!br(t[i],e[i]))return!1;for(let i in e)if(!br(t[i],e[i]))return!1;return!0}function Ct(t,e,i,r){if(!e)return t;let{add:n,remove:s}=e;return[...s?s.reduce((o,a)=>{let f=Object.assign(Object.assign({},a),{environment:i}),l=o.find(d=>Ps(d,f));if(!l)throw new Error(`Cannot find rule ${JSON.stringify(f)} to remove in ${r}!`);return o.filter(d=>d!==l)},t):t,...n?n.map(o=>Object.assign({environment:i},o)):[]]}var Je=class extends st{updateCurrentEnvironmentPermissions(e,i){return Ss(this,void 0,void 0,function*(){let r=this.client.config.environment||(yield this.client.environments.list()).find(f=>f.meta.primary).id,n=yield this.find(e),s=Boolean(i.positive_item_type_permissions||i.negative_item_type_permissions),o=Boolean(i.positive_upload_permissions||i.negative_upload_permissions),a=Object.assign(Object.assign({},s?{positive_item_type_permissions:Ct(n.positive_item_type_permissions,i.positive_item_type_permissions,r,"positive_item_type_permissions"),negative_item_type_permissions:Ct(n.negative_item_type_permissions,i.negative_item_type_permissions,r,"negative_item_type_permissions")}:{}),o?{positive_upload_permissions:Ct(n.positive_upload_permissions,i.positive_upload_permissions,r,"positive_upload_permissions"),negative_upload_permissions:Ct(n.negative_upload_permissions,i.negative_upload_permissions,r,"negative_upload_permissions")}:{});return this.update(e,a)})}};var X=class extends _{update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"user",attributes:["is_active"],relationships:["role"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/users/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/users"})}find(e,i){return this.rawFind(h(e),i).then(r=>c(r))}rawFind(e,i){return this.client.request({method:"GET",url:`/users/${e}`,queryParams:i})}findMe(e){return this.rawFindMe(e).then(i=>c(i))}rawFindMe(e){return this.client.request({method:"GET",url:"/users/me",queryParams:e})}destroy(e,i){return this.rawDestroy(h(e),i).then(r=>c(r))}rawDestroy(e,i){return this.client.request({method:"DELETE",url:`/users/${e}`,queryParams:i})}};X.TYPE="user";var Q=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/sso-users"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/sso-users/${e}`})}copyUsers(){return this.rawCopyUsers().then(e=>c(e))}rawCopyUsers(){return this.client.request({method:"POST",url:"/sso-users/copy-users"})}destroy(e,i){return this.rawDestroy(h(e),i).then(r=>c(r))}rawDestroy(e,i){return this.client.request({method:"DELETE",url:`/sso-users/${e}`,queryParams:i})}};Q.TYPE="sso_user";var Z=class extends _{query(e){return this.rawQuery(y(e,{type:"audit_log_query",attributes:["filter","next_token","detailed_log"],relationships:[]})).then(i=>c(i))}rawQuery(e){return this.client.request({method:"POST",url:"/audit-log-events/query",body:e})}};Z.TYPE="audit_log_event";var ee=class extends _{create(e){return this.rawCreate(y(e,{type:"menu_item",attributes:["label","external_url","position","open_in_new_tab"],relationships:["item_type","item_type_filter","parent"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/menu-items",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"menu_item",attributes:["label","external_url","position","open_in_new_tab"],relationships:["item_type","item_type_filter","parent"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/menu-items/${e}`,body:i})}list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/menu-items",queryParams:e})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/menu-items/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/menu-items/${e}`})}reorder(e){return this.rawReorder(y(e,{type:"menu_item",attributes:["position"],relationships:["parent"]})).then(i=>c(i))}rawReorder(e){return this.client.request({method:"POST",url:"/menu-items/reorder",body:e})}};ee.TYPE="menu_item";var te=class extends _{create(e){return this.rawCreate(y(e,{type:"schema_menu_item",attributes:["label","position","kind"],relationships:["item_type","parent"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/schema-menu-items",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"schema_menu_item",attributes:["label","position","kind"],relationships:["item_type","parent","children"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/schema-menu-items/${e}`,body:i})}list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/schema-menu-items",queryParams:e})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/schema-menu-items/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/schema-menu-items/${e}`})}reorder(e){return this.rawReorder(y(e,{type:"schema_menu_item",attributes:["position"],relationships:["parent"]})).then(i=>c(i))}rawReorder(e){return this.client.request({method:"POST",url:"/schema-menu-items/reorder",body:e})}};te.TYPE="schema_menu_item";var ie=class extends _{create(e){return this.rawCreate(y(e,{type:"upload_collection",attributes:["label","position"],relationships:["parent"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-collections",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"upload_collection",attributes:["label","position"],relationships:["parent","children"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/upload-collections/${e}`,body:i})}list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/upload-collections",queryParams:e})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/upload-collections/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/upload-collections/${e}`})}reorder(e){return this.rawReorder(y(e,{type:"upload_collection",attributes:["position"],relationships:["parent"]})).then(i=>c(i))}rawReorder(e){return this.client.request({method:"POST",url:"/upload-collections/reorder",body:e})}};ie.TYPE="upload_collection";var re=class extends _{create(e,i){return this.rawCreate(y(e,{type:"item_type",attributes:["name","api_key","singleton","all_locales_required","sortable","modular_block","draft_mode_active","draft_saving_active","tree","ordering_direction","ordering_meta","collection_appeareance","collection_appearance","hint","inverse_relationships_enabled"],relationships:["ordering_field","presentation_title_field","presentation_image_field","title_field","image_preview_field","excerpt_field","workflow"]}),i).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:"/item-types",body:e,queryParams:i})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"item_type",attributes:["name","api_key","collection_appeareance","collection_appearance","singleton","all_locales_required","sortable","modular_block","draft_mode_active","draft_saving_active","tree","ordering_direction","ordering_meta","has_singleton_item","hint","inverse_relationships_enabled"],relationships:["ordering_field","presentation_title_field","presentation_image_field","title_field","image_preview_field","excerpt_field","workflow"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/item-types/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/item-types"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/item-types/${e}`})}duplicate(e){return this.rawDuplicate(h(e)).then(i=>c(i))}rawDuplicate(e){return this.client.request({method:"POST",url:`/item-types/${e}/duplicate`})}destroy(e,i){return this.rawDestroy(h(e),i).then(r=>c(r))}rawDestroy(e,i){return this.client.request({method:"DELETE",url:`/item-types/${e}`,queryParams:i})}referencing(e){return this.rawReferencing(h(e)).then(i=>c(i))}rawReferencing(e){return this.client.request({method:"GET",url:`/item-types/${e}/referencing`})}rawReorderFieldsAndFieldsets(e,i){return this.client.request({method:"POST",url:`/item-types/${e}/reorder-fields-and-fieldsets`,body:i})}};re.TYPE="item_type";var se=class extends _{create(e,i){return this.rawCreate(h(e),y(i,{type:"field",attributes:["label","field_type","api_key","localized","validators","appeareance","appearance","position","hint","default_value","deep_filtering_enabled"],relationships:["fieldset"]})).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:`/item-types/${e}/fields`,body:i})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"field",attributes:["default_value","label","api_key","localized","validators","appeareance","appearance","position","field_type","hint","deep_filtering_enabled"],relationships:["fieldset"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/fields/${e}`,body:i})}list(e){return this.rawList(h(e)).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:`/item-types/${e}/fields`})}referencing(e){return this.rawReferencing(h(e)).then(i=>c(i))}rawReferencing(e){return this.client.request({method:"GET",url:`/item-types/${e}/fields/referencing`})}related(e){return this.rawRelated(h(e)).then(i=>c(i))}rawRelated(e){return this.client.request({method:"GET",url:`/item-types/${e}/fields/related`})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/fields/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/fields/${e}`})}duplicate(e){return this.rawDuplicate(h(e)).then(i=>c(i))}rawDuplicate(e){return this.client.request({method:"POST",url:`/fields/${e}/duplicate`})}};se.TYPE="field";var ne=class extends _{create(e,i){return this.rawCreate(h(e),y(i,{type:"fieldset",attributes:["title","hint","position","collapsible","start_collapsed"],relationships:[]})).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:`/item-types/${e}/fieldsets`,body:i})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"fieldset",attributes:["title","hint","position","collapsible","start_collapsed"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/fieldsets/${e}`,body:i})}list(e){return this.rawList(h(e)).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:`/item-types/${e}/fieldsets`})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/fieldsets/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/fieldsets/${e}`})}};ne.TYPE="fieldset";var oe=class extends _{create(e){return this.rawCreate(y(e,{type:"email_credentials",attributes:["email","password","otp_code"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/sessions",body:e})}};oe.TYPE="session";var ae=class extends _{create(e){return this.rawCreate(y(e,{type:"access_token",attributes:["name","can_access_cda","can_access_cda_preview","can_access_cma"],relationships:["role"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/access_tokens",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"access_token",attributes:["name","can_access_cda","can_access_cda_preview","can_access_cma"],relationships:["role"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/access_tokens/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/access_tokens"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/access_tokens/${e}`})}regenerateToken(e){return this.rawRegenerateToken(h(e)).then(i=>c(i))}rawRegenerateToken(e){return this.client.request({method:"POST",url:`/access_tokens/${e}/regenerate_token`})}destroy(e,i){return this.rawDestroy(h(e),i).then(r=>c(r))}rawDestroy(e,i){return this.client.request({method:"DELETE",url:`/access_tokens/${e}`,queryParams:i})}};ae.TYPE="access_token";var le=class extends _{create(e){return this.rawCreate(y(e,{type:"plugin",attributes:["package_name","name","description","url","permissions","plugin_type","field_types","parameter_definitions","package_version"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/plugins",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"plugin",attributes:["name","description","url","parameters","package_version","permissions"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/plugins/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/plugins"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/plugins/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/plugins/${e}`})}fields(e){return this.rawFields(h(e)).then(i=>c(i))}rawFields(e){return this.client.request({method:"GET",url:`/plugins/${e}/fields`})}};le.TYPE="plugin";var ue=class extends _{find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/job-results/${e}`})}};ue.TYPE="job_result";var de=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/subscription-limits"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/subscription-limits/${e}`})}};de.TYPE="subscription_limit";var ce=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/subscription-features"})}};ce.TYPE="subscription_feature";var zs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),n(a,f,o.done,o.value)})}}function n(s,o,a,f){Promise.resolve(f).then(function(l){s({value:l,done:a})},o)}},nt=function(t){return this instanceof nt?(this.v=t,this):new nt(t)},ks=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||a(u,m)})})}function a(u,m){try{f(r[u](m))}catch(g){p(s[0][3],g)}}function f(u){u.value instanceof nt?Promise.resolve(u.value.v).then(l,d):p(s[0][2],u)}function l(u){a("next",u)}function d(u){a("throw",u)}function p(u,m){u(m),s.shift(),s.length&&a(s[0][0],s[0][1])}},fe=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/build-events",queryParams:e})}listPagedIterator(e,i){return ks(this,arguments,function*(){var n,s,o,a;try{for(var f=!0,l=zs(this.rawListPagedIterator(e,i)),d;d=yield nt(l.next()),n=d.done,!n;){a=d.value,f=!1;try{yield yield nt(T(a))}finally{f=!0}}}catch(p){s={error:p}}finally{try{!f&&!n&&(o=l.return)&&(yield nt(o.call(l)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),R({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/build-events/${e}`})}};fe.TYPE="build_event";var qs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),n(a,f,o.done,o.value)})}}function n(s,o,a,f){Promise.resolve(f).then(function(l){s({value:l,done:a})},o)}},ot=function(t){return this instanceof ot?(this.v=t,this):new ot(t)},Os=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||a(u,m)})})}function a(u,m){try{f(r[u](m))}catch(g){p(s[0][3],g)}}function f(u){u.value instanceof ot?Promise.resolve(u.value.v).then(l,d):p(s[0][2],u)}function l(u){a("next",u)}function d(u){a("throw",u)}function p(u,m){u(m),s.shift(),s.length&&a(s[0][0],s[0][1])}},pe=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/site-search-source-events",queryParams:e})}listPagedIterator(e,i){return Os(this,arguments,function*(){var n,s,o,a;try{for(var f=!0,l=qs(this.rawListPagedIterator(e,i)),d;d=yield ot(l.next()),n=d.done,!n;){a=d.value,f=!1;try{yield yield ot(T(a))}finally{f=!0}}}catch(p){s={error:p}}finally{try{!f&&!n&&(o=l.return)&&(yield ot(o.call(l)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),R({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/site-search-source-events/${e}`})}};pe.TYPE="site_search_source_event";var Vs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),n(a,f,o.done,o.value)})}}function n(s,o,a,f){Promise.resolve(f).then(function(l){s({value:l,done:a})},o)}},at=function(t){return this instanceof at?(this.v=t,this):new at(t)},Ls=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||a(u,m)})})}function a(u,m){try{f(r[u](m))}catch(g){p(s[0][3],g)}}function f(u){u.value instanceof at?Promise.resolve(u.value.v).then(l,d):p(s[0][2],u)}function l(u){a("next",u)}function d(u){a("throw",u)}function p(u,m){u(m),s.shift(),s.length&&a(s[0][0],s[0][1])}},j=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/items",queryParams:e}).then(P)}listPagedIterator(e,i){return Ls(this,arguments,function*(){var n,s,o,a;try{for(var f=!0,l=Vs(this.rawListPagedIterator(e,i)),d;d=yield at(l.next()),n=d.done,!n;){a=d.value,f=!1;try{yield yield at(T(a))}finally{f=!0}}}catch(p){s={error:p}}finally{try{!f&&!n&&(o=l.return)&&(yield at(o.call(l)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),R({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i,!0)}validateExisting(e,i){return this.rawValidateExisting(h(e),y(i,{id:h(e),type:"item",attributes:"*",relationships:["item_type","creator"]}))}rawValidateExisting(e,i){return this.client.request({method:"POST",url:`/items/${e}/validate`,body:Tt(i)})}validateNew(e){return this.rawValidateNew(y(e,{type:"item",attributes:"*",relationships:["item_type","creator"]}))}rawValidateNew(e){return this.client.request({method:"POST",url:"/items/validate",body:Tt(e)})}create(e){return this.rawCreate(y(e,{type:"item",attributes:"*",relationships:["item_type","creator"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/items",body:Tt(e)}).then(P)}duplicate(e){return this.rawDuplicate(h(e)).then(i=>c(i))}rawDuplicate(e){return this.client.request({method:"POST",url:`/items/${e}/duplicate`}).then(P)}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"item",attributes:"*",relationships:["item_type","creator"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/items/${e}`,body:Tt(i)}).then(P)}references(e,i){return this.rawReferences(h(e),i).then(r=>c(r))}rawReferences(e,i){return this.client.request({method:"GET",url:`/items/${e}/references`,queryParams:i}).then(P)}find(e,i){return this.rawFind(h(e),i).then(r=>c(r))}rawFind(e,i){return this.client.request({method:"GET",url:`/items/${e}`,queryParams:i}).then(P)}currentVsPublishedState(e){return this.rawCurrentVsPublishedState(h(e)).then(i=>c(i))}rawCurrentVsPublishedState(e){return this.client.request({method:"GET",url:`/items/${e}/current-vs-published-state`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/items/${e}`}).then(P)}publish(e,i,r){return this.rawPublish(h(e),i?y(i,{type:"selective_publish_operation",attributes:["content_in_locales","non_localized_content"],relationships:[]}):null,r).then(n=>c(n))}rawPublish(e,i,r){return this.client.request({method:"PUT",url:`/items/${e}/publish`,body:i,queryParams:r}).then(P)}unpublish(e,i,r){return this.rawUnpublish(h(e),i?y(i,{type:"selective_unpublish_operation",attributes:["content_in_locales"],relationships:[]}):null,r).then(n=>c(n))}rawUnpublish(e,i,r){return this.client.request({method:"PUT",url:`/items/${e}/unpublish`,body:i,queryParams:r}).then(P)}bulkPublish(e){return this.rawBulkPublish(y(e,{type:"item_bulk_publish_operation",attributes:[],relationships:["items"]})).then(i=>c(i))}rawBulkPublish(e){return this.client.request({method:"POST",url:"/items/bulk/publish",body:e})}bulkUnpublish(e){return this.rawBulkUnpublish(y(e,{type:"item_bulk_unpublish_operation",attributes:[],relationships:["items"]})).then(i=>c(i))}rawBulkUnpublish(e){return this.client.request({method:"POST",url:"/items/bulk/unpublish",body:e})}bulkDestroy(e){return this.rawBulkDestroy(y(e,{type:"item_bulk_destroy_operation",attributes:[],relationships:["items"]})).then(i=>c(i))}rawBulkDestroy(e){return this.client.request({method:"POST",url:"/items/bulk/destroy",body:e})}bulkMoveToStage(e){return this.rawBulkMoveToStage(y(e,{type:"item_bulk_move_to_stage_operation",attributes:["stage"],relationships:["items"]})).then(i=>c(i))}rawBulkMoveToStage(e){return this.client.request({method:"POST",url:"/items/bulk/move-to-stage",body:e})}};j.TYPE="item";var As=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),n(a,f,o.done,o.value)})}}function n(s,o,a,f){Promise.resolve(f).then(function(l){s({value:l,done:a})},o)}},lt=function(t){return this instanceof lt?(this.v=t,this):new lt(t)},Ns=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||a(u,m)})})}function a(u,m){try{f(r[u](m))}catch(g){p(s[0][3],g)}}function f(u){u.value instanceof lt?Promise.resolve(u.value.v).then(l,d):p(s[0][2],u)}function l(u){a("next",u)}function d(u){a("throw",u)}function p(u,m){u(m),s.shift(),s.length&&a(s[0][0],s[0][1])}},he=class extends _{restore(e){return this.rawRestore(h(e)).then(i=>c(i))}rawRestore(e){return this.client.request({method:"POST",url:`/versions/${e}/restore`})}list(e,i){return this.rawList(h(e),i).then(r=>c(r))}rawList(e,i){return this.client.request({method:"GET",url:`/items/${e}/versions`,queryParams:i})}listPagedIterator(e,i,r){return Ns(this,arguments,function*(){var s,o,a,f;try{for(var l=!0,d=As(this.rawListPagedIterator(h(e),i,r)),p;p=yield lt(d.next()),s=p.done,!s;){f=p.value,l=!1;try{yield yield lt(T(f))}finally{l=!0}}}catch(u){o={error:u}}finally{try{!l&&!s&&(a=d.return)&&(yield lt(a.call(d)))}finally{if(o)throw o.error}}})}rawListPagedIterator(e,i,r){return B(i),R({defaultLimit:15,maxLimit:50},n=>this.rawList(e,Object.assign(Object.assign({},i),{page:n})),r)}find(e,i){return this.rawFind(h(e),i).then(r=>c(r))}rawFind(e,i){return this.client.request({method:"GET",url:`/versions/${e}`,queryParams:i})}};he.TYPE="item_version";var Cs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),n(a,f,o.done,o.value)})}}function n(s,o,a,f){Promise.resolve(f).then(function(l){s({value:l,done:a})},o)}},ut=function(t){return this instanceof ut?(this.v=t,this):new ut(t)},$s=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||a(u,m)})})}function a(u,m){try{f(r[u](m))}catch(g){p(s[0][3],g)}}function f(u){u.value instanceof ut?Promise.resolve(u.value.v).then(l,d):p(s[0][2],u)}function l(u){a("next",u)}function d(u){a("throw",u)}function p(u,m){u(m),s.shift(),s.length&&a(s[0][0],s[0][1])}},me=class extends _{create(e){return this.rawCreate(y(e,{type:"upload",attributes:["path","copyright","author","notes","default_field_metadata","tags"],relationships:["upload_collection"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/uploads",body:e})}list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/uploads",queryParams:e})}listPagedIterator(e,i){return $s(this,arguments,function*(){var n,s,o,a;try{for(var f=!0,l=Cs(this.rawListPagedIterator(e,i)),d;d=yield ut(l.next()),n=d.done,!n;){a=d.value,f=!1;try{yield yield ut(T(a))}finally{f=!0}}}catch(p){s={error:p}}finally{try{!f&&!n&&(o=l.return)&&(yield ut(o.call(l)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),R({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/uploads/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/uploads/${e}`})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"upload",attributes:["path","basename","copyright","author","notes","tags","default_field_metadata"],relationships:["creator","upload_collection"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/uploads/${e}`,body:i})}references(e,i){return this.rawReferences(h(e),i).then(r=>c(r))}rawReferences(e,i){return this.client.request({method:"GET",url:`/uploads/${e}/references`,queryParams:i}).then(P)}bulkTag(e){return this.rawBulkTag(y(e,{type:"upload_bulk_tag_operation",attributes:["tags"],relationships:["uploads"]})).then(i=>c(i))}rawBulkTag(e){return this.client.request({method:"POST",url:"/uploads/bulk/tag",body:e})}bulkSetUploadCollection(e){return this.rawBulkSetUploadCollection(y(e,{type:"upload_bulk_set_upload_collection_operation",attributes:[],relationships:["upload_collection","uploads"]})).then(i=>c(i))}rawBulkSetUploadCollection(e){return this.client.request({method:"POST",url:"/uploads/bulk/set-upload-collection",body:e})}bulkDestroy(e){return this.rawBulkDestroy(y(e,{type:"upload_bulk_destroy_operation",attributes:[],relationships:["uploads"]})).then(i=>c(i))}rawBulkDestroy(e){return this.client.request({method:"POST",url:"/uploads/bulk/destroy",body:e})}};me.TYPE="upload";var ye=class extends _{create(e){return this.rawCreate(y(e,{type:"upload_request",attributes:["filename"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-requests",body:e})}};ye.TYPE="upload_request";var _e=class extends _{create(e,i){return this.rawCreate(h(e),y(i,{type:"upload_track",attributes:["url_or_upload_request_id","type","name","language_code","closed_captions"],relationships:[]})).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:`/uploads/${e}/tracks`,body:i})}list(e){return this.rawList(h(e)).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:`/uploads/${e}/tracks`})}destroy(e,i){return this.rawDestroy(h(e),h(i)).then(r=>c(r))}rawDestroy(e,i){return this.client.request({method:"DELETE",url:`/uploads/${e}/tracks/${i}`})}generateSubtitles(e,i){return this.rawGenerateSubtitles(h(e),y(i,{type:"upload_track",attributes:["name","language_code"],relationships:[]})).then(r=>c(r))}rawGenerateSubtitles(e,i){return this.client.request({method:"POST",url:`/uploads/${e}/tracks/generate-subtitles`,body:i})}};_e.TYPE="upload_track";var ge=class extends _{create(e,i){return this.rawCreate(h(e),y(i,{type:"scheduled_publication",attributes:["publication_scheduled_at","selective_publication"],relationships:[]})).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:`/items/${e}/scheduled-publication`,body:i})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/items/${e}/scheduled-publication`}).then(P)}};ge.TYPE="scheduled_publication";var we=class extends _{create(e,i){return this.rawCreate(h(e),y(i,{type:"scheduled_unpublishing",attributes:["unpublishing_scheduled_at","content_in_locales"],relationships:[]})).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:`/items/${e}/scheduled-unpublishing`,body:i})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/items/${e}/scheduled-unpublishing`}).then(P)}};we.TYPE="scheduled_unpublishing";var Ds=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),n(a,f,o.done,o.value)})}}function n(s,o,a,f){Promise.resolve(f).then(function(l){s({value:l,done:a})},o)}},dt=function(t){return this instanceof dt?(this.v=t,this):new dt(t)},js=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||a(u,m)})})}function a(u,m){try{f(r[u](m))}catch(g){p(s[0][3],g)}}function f(u){u.value instanceof dt?Promise.resolve(u.value.v).then(l,d):p(s[0][2],u)}function l(u){a("next",u)}function d(u){a("throw",u)}function p(u,m){u(m),s.shift(),s.length&&a(s[0][0],s[0][1])}},be=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/search-results",queryParams:e})}listPagedIterator(e,i){return js(this,arguments,function*(){var n,s,o,a;try{for(var f=!0,l=Ds(this.rawListPagedIterator(e,i)),d;d=yield dt(l.next()),n=d.done,!n;){a=d.value,f=!1;try{yield yield dt(T(a))}finally{f=!0}}}catch(p){s={error:p}}finally{try{!f&&!n&&(o=l.return)&&(yield dt(o.call(l)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),R({defaultLimit:20,maxLimit:100},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}};be.TYPE="search_result";var ve=class extends _{fork(e,i,r){return this.rawFork(h(e),y(i,{id:h(e),type:"environment",attributes:[],relationships:[]}),r).then(n=>c(n))}rawFork(e,i,r){return this.client.request({method:"POST",url:`/environments/${e}/fork`,body:i,queryParams:r})}promote(e){return this.rawPromote(h(e)).then(i=>c(i))}rawPromote(e){return this.client.request({method:"PUT",url:`/environments/${e}/promote`})}rename(e,i){return this.rawRename(h(e),y(i,{id:h(e),type:"environment",attributes:[],relationships:[]})).then(r=>c(r))}rawRename(e,i){return this.client.request({method:"PUT",url:`/environments/${e}/rename`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/environments"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/environments/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/environments/${e}`})}};ve.TYPE="environment";var xe=class extends _{find(){return this.rawFind().then(e=>c(e))}rawFind(){return this.client.request({method:"GET",url:"/maintenance-mode"})}activate(e){return this.rawActivate(e).then(i=>c(i))}rawActivate(e){return this.client.request({method:"PUT",url:"/maintenance-mode/activate",queryParams:e})}deactivate(){return this.rawDeactivate().then(e=>c(e))}rawDeactivate(){return this.client.request({method:"PUT",url:"/maintenance-mode/deactivate"})}};xe.TYPE="maintenance_mode";var Ie=class extends _{create(e){return this.rawCreate(y(e,{type:"webhook",attributes:["name","url","custom_payload","headers","events","http_basic_user","http_basic_password","enabled","payload_api_version","nested_items_in_payload","auto_retry"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/webhooks",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"webhook",attributes:["name","url","custom_payload","headers","events","http_basic_user","http_basic_password","enabled","payload_api_version","nested_items_in_payload","auto_retry"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/webhooks/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/webhooks"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/webhooks/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/webhooks/${e}`})}};Ie.TYPE="webhook";var Gs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),n(a,f,o.done,o.value)})}}function n(s,o,a,f){Promise.resolve(f).then(function(l){s({value:l,done:a})},o)}},ct=function(t){return this instanceof ct?(this.v=t,this):new ct(t)},Ms=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||a(u,m)})})}function a(u,m){try{f(r[u](m))}catch(g){p(s[0][3],g)}}function f(u){u.value instanceof ct?Promise.resolve(u.value.v).then(l,d):p(s[0][2],u)}function l(u){a("next",u)}function d(u){a("throw",u)}function p(u,m){u(m),s.shift(),s.length&&a(s[0][0],s[0][1])}},Ue=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/webhook_calls",queryParams:e})}listPagedIterator(e,i){return Ms(this,arguments,function*(){var n,s,o,a;try{for(var f=!0,l=Gs(this.rawListPagedIterator(e,i)),d;d=yield ct(l.next()),n=d.done,!n;){a=d.value,f=!1;try{yield yield ct(T(a))}finally{f=!0}}}catch(p){s={error:p}}finally{try{!f&&!n&&(o=l.return)&&(yield ct(o.call(l)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),R({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/webhook_calls/${e}`})}resendWebhook(e){return this.rawResendWebhook(h(e))}rawResendWebhook(e){return this.client.request({method:"POST",url:`/webhook_calls/${e}/resend_webhook`})}};Ue.TYPE="webhook_call";var Te=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/build-triggers"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/build-triggers/${e}`})}create(e){return this.rawCreate(y(e,{type:"build_trigger",attributes:["name","webhook_token","adapter","indexing_enabled","enabled","frontend_url","autotrigger_on_scheduled_publications","adapter_settings"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/build-triggers",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"build_trigger",attributes:["name","adapter","indexing_enabled","enabled","frontend_url","autotrigger_on_scheduled_publications","adapter_settings"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/build-triggers/${e}`,body:i})}trigger(e){return this.rawTrigger(h(e))}rawTrigger(e){return this.client.request({method:"POST",url:`/build-triggers/${e}/trigger`})}abort(e){return this.rawAbort(h(e))}rawAbort(e){return this.client.request({method:"DELETE",url:`/build-triggers/${e}/abort`})}abortIndexing(e){return this.rawAbortIndexing(h(e))}rawAbortIndexing(e){return this.client.request({method:"DELETE",url:`/build-triggers/${e}/abort_indexing`})}reindex(e){return this.rawReindex(h(e))}rawReindex(e){return this.client.request({method:"PUT",url:`/build-triggers/${e}/reindex`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/build-triggers/${e}`})}};Te.TYPE="build_trigger";var Re=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/site-search-sources"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/site-search-sources/${e}`})}create(e){return this.rawCreate(y(e,{type:"site_search_source",attributes:["name","enabled","build_trigger_indexing_enabled","frontend_url","user_agent_suffix"],relationships:["build_triggers"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/site-search-sources",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"site_search_source",attributes:["name","enabled","build_trigger_indexing_enabled","frontend_url","user_agent_suffix"],relationships:["build_triggers"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/site-search-sources/${e}`,body:i})}trigger(e){return this.rawTrigger(h(e))}rawTrigger(e){return this.client.request({method:"POST",url:`/site-search-sources/${e}/trigger`})}abort(e){return this.rawAbort(h(e))}rawAbort(e){return this.client.request({method:"DELETE",url:`/site-search-sources/${e}/abort`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/site-search-sources/${e}`})}};Re.TYPE="site_search_source";var Be=class extends _{create(e){return this.rawCreate(y(e,{type:"item_type_filter",attributes:["name","filter","columns","order_by","shared"],relationships:["item_type"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/item-type-filters",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"item_type_filter",attributes:["name","columns","order_by","shared","filter"],relationships:["item_type"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/item-type-filters/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/item-type-filters"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/item-type-filters/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/item-type-filters/${e}`})}};Be.TYPE="item_type_filter";var Ee=class extends _{create(e){return this.rawCreate(y(e,{type:"upload_filter",attributes:["name","filter","shared"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-filters",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"upload_filter",attributes:["name","shared","filter"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/upload-filters/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/upload-filters"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/upload-filters/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/upload-filters/${e}`})}};Ee.TYPE="upload_filter";var Fe=class extends _{create(e){return this.rawCreate(y(e,{type:"site_invitation",attributes:["email"],relationships:["role"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/site-invitations",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"site_invitation",attributes:[],relationships:["role"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/site-invitations/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/site-invitations"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/site-invitations/${e}`})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/site-invitations/${e}`})}resend(e){return this.rawResend(h(e)).then(i=>c(i))}rawResend(e){return this.client.request({method:"POST",url:`/site-invitations/${e}/resend`})}};Fe.TYPE="site_invitation";var Se=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/editing-sessions"})}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/editing-sessions/${e}`,body:i})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/editing-sessions/${e}`})}};Se.TYPE="editing_session";var Pe=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/sso-groups"})}copyRoles(e){return this.rawCopyRoles(h(e)).then(i=>c(i))}rawCopyRoles(e){return this.client.request({method:"POST",url:`/sso-groups/${e}/copy-roles`})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"sso_group",attributes:["priority"],relationships:["role"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/sso-groups/${e}`,body:i})}destroy(e){return this.rawDestroy(h(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/sso-groups/${e}`})}};Pe.TYPE="sso_group";var ze=class extends _{find(){return this.rawFind().then(e=>c(e))}rawFind(){return this.client.request({method:"GET",url:"/sso-settings"})}generateToken(){return this.rawGenerateToken().then(e=>c(e))}rawGenerateToken(){return this.client.request({method:"PUT",url:"/sso-settings/generate-token"})}update(e){return this.rawUpdate(y(e,{type:"sso_settings",attributes:["idp_saml_metadata_url","idp_saml_metadata_xml"],relationships:["default_role"]})).then(i=>c(i))}rawUpdate(e){return this.client.request({method:"PUT",url:"/sso-settings",body:e})}};ze.TYPE="sso_settings";var ke=class extends _{find(e){return this.rawFind(e).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:"/emoji-suggestions",queryParams:e})}};ke.TYPE="emoji_suggestions";var qe=class extends _{find(){return this.rawFind().then(e=>c(e))}rawFind(){return this.client.request({method:"GET",url:"/white-label-settings"})}update(e){return this.rawUpdate(y(e,{type:"white_label_settings",attributes:["custom_i18n_messages_template_url"],relationships:[]})).then(i=>c(i))}rawUpdate(e){return this.client.request({method:"PUT",url:"/white-label-settings",body:e})}};qe.TYPE="white_label_settings";var Oe=class extends _{find(){return this.rawFind().then(e=>c(e))}rawFind(){return this.client.request({method:"GET",url:"/public-info"})}};Oe.TYPE="public_info";var Ve=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/daily-site-usages"})}};Ve.TYPE="daily_usage";var Le=class extends _{find(e,i){return this.rawFind(h(e),i).then(r=>c(r))}rawFind(e,i){return this.client.request({method:"GET",url:`/usage-log-counters/${e}`,queryParams:i})}};Le.TYPE="usage_counter";var Ws=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),n(a,f,o.done,o.value)})}}function n(s,o,a,f){Promise.resolve(f).then(function(l){s({value:l,done:a})},o)}},ft=function(t){return this instanceof ft?(this.v=t,this):new ft(t)},Js=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||a(u,m)})})}function a(u,m){try{f(r[u](m))}catch(g){p(s[0][3],g)}}function f(u){u.value instanceof ft?Promise.resolve(u.value.v).then(l,d):p(s[0][2],u)}function l(u){a("next",u)}function d(u){a("throw",u)}function p(u,m){u(m),s.shift(),s.length&&a(s[0][0],s[0][1])}},Ae=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/upload-tags",queryParams:e})}listPagedIterator(e,i){return Js(this,arguments,function*(){var n,s,o,a;try{for(var f=!0,l=Ws(this.rawListPagedIterator(e,i)),d;d=yield ft(l.next()),n=d.done,!n;){a=d.value,f=!1;try{yield yield ft(T(a))}finally{f=!0}}}catch(p){s={error:p}}finally{try{!f&&!n&&(o=l.return)&&(yield ft(o.call(l)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),R({defaultLimit:50,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}create(e){return this.rawCreate(y(e,{type:"upload_tag",attributes:["name"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-tags",body:e})}};Ae.TYPE="upload_tag";var Ys=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),n(a,f,o.done,o.value)})}}function n(s,o,a,f){Promise.resolve(f).then(function(l){s({value:l,done:a})},o)}},pt=function(t){return this instanceof pt?(this.v=t,this):new pt(t)},Hs=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||a(u,m)})})}function a(u,m){try{f(r[u](m))}catch(g){p(s[0][3],g)}}function f(u){u.value instanceof pt?Promise.resolve(u.value.v).then(l,d):p(s[0][2],u)}function l(u){a("next",u)}function d(u){a("throw",u)}function p(u,m){u(m),s.shift(),s.length&&a(s[0][0],s[0][1])}},Ne=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/upload-smart-tags",queryParams:e})}listPagedIterator(e,i){return Hs(this,arguments,function*(){var n,s,o,a;try{for(var f=!0,l=Ys(this.rawListPagedIterator(e,i)),d;d=yield pt(l.next()),n=d.done,!n;){a=d.value,f=!1;try{yield yield pt(T(a))}finally{f=!0}}}catch(p){s={error:p}}finally{try{!f&&!n&&(o=l.return)&&(yield pt(o.call(l)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),R({defaultLimit:50,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}};Ne.TYPE="upload_smart_tag";var Ce=class extends _{find(e){return this.rawFind(e).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:"/site",queryParams:e})}update(e){return this.rawUpdate(y(e,{type:"site",attributes:["no_index","favicon","global_seo","name","theme","locales","timezone","require_2fa","ip_tracking_enabled","force_use_of_sandbox_environments"],relationships:["sso_default_role"]})).then(i=>c(i))}rawUpdate(e){return this.client.request({method:"PUT",url:"/site",body:e})}activateImprovedTimezoneManagement(){return this.rawActivateImprovedTimezoneManagement().then(e=>c(e))}rawActivateImprovedTimezoneManagement(){return this.client.request({method:"PUT",url:"/site/activate-improved-timezone-management"})}activateImprovedHexManagement(){return this.rawActivateImprovedHexManagement().then(e=>c(e))}rawActivateImprovedHexManagement(){return this.client.request({method:"PUT",url:"/site/activate-improved-hex-management"})}activateImprovedGqlMultilocaleFields(){return this.rawActivateImprovedGqlMultilocaleFields().then(e=>c(e))}rawActivateImprovedGqlMultilocaleFields(){return this.client.request({method:"PUT",url:"/site/activate-improved-gql-multilocale-fields"})}activateImprovedGqlVisibilityControl(){return this.rawActivateImprovedGqlVisibilityControl().then(e=>c(e))}rawActivateImprovedGqlVisibilityControl(){return this.client.request({method:"PUT",url:"/site/activate-improved-gql-visibility-control"})}activateImprovedBooleanFields(){return this.rawActivateImprovedBooleanFields().then(e=>c(e))}rawActivateImprovedBooleanFields(){return this.client.request({method:"PUT",url:"/site/activate-improved-boolean-fields"})}activateDraftModeAsDefault(){return this.rawActivateDraftModeAsDefault().then(e=>c(e))}rawActivateDraftModeAsDefault(){return this.client.request({method:"PUT",url:"/site/activate-draft-mode-as-default"})}activateImprovedValidationAtPublishing(){return this.rawActivateImprovedValidationAtPublishing().then(e=>c(e))}rawActivateImprovedValidationAtPublishing(){return this.client.request({method:"PUT",url:"/site/activate-improved-validation-at-publishing"})}activateImprovedExposureOfInlineBlocksInCda(){return this.rawActivateImprovedExposureOfInlineBlocksInCda().then(e=>c(e))}rawActivateImprovedExposureOfInlineBlocksInCda(){return this.client.request({method:"PUT",url:"/site/activate-improved-exposure-of-inline-blocks-in-cda"})}updateAssetsCdnDefaultSettings(e){return this.rawUpdateAssetsCdnDefaultSettings(y(e,{type:"assets-cdn-default-settings",attributes:["assets_cdn_default_settings"],relationships:[]})).then(i=>c(i))}rawUpdateAssetsCdnDefaultSettings(e){return this.client.request({method:"PUT",url:"/site/assets-cdn-default-settings",body:e})}};Ce.TYPE="site";var $e=class extends _{create(e){return this.rawCreate(y(e,{type:"workflow",attributes:["name","api_key","stages"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/workflows",body:e})}update(e,i){return this.rawUpdate(h(e),y(i,{id:h(e),type:"workflow",attributes:["name","api_key","stages"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/workflows/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/workflows"})}find(e){return this.rawFind(h(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/workflows/${e}`})}destroy(e){return this.rawDestroy(h(e))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/workflows/${e}`})}};$e.TYPE="workflow";var Ks=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(d){try{l(r.next(d))}catch(p){o(p)}}function f(d){try{l(r.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):n(d.value).then(a,f)}l((r=r.apply(t,e||[])).next())})},De=class{constructor(e){this.config=e,this.roles=new Je(this),this.users=new X(this),this.ssoUsers=new Q(this),this.auditLogEvents=new Z(this),this.menuItems=new ee(this),this.schemaMenuItems=new te(this),this.uploadCollections=new ie(this),this.itemTypes=new re(this),this.fields=new se(this),this.fieldsets=new ne(this),this.session=new oe(this),this.accessTokens=new ae(this),this.plugins=new le(this),this.jobResults=new ue(this),this.subscriptionLimits=new de(this),this.subscriptionFeatures=new ce(this),this.buildEvents=new fe(this),this.siteSearchSourceEvents=new pe(this),this.items=new j(this),this.itemVersions=new he(this),this.uploads=new me(this),this.uploadRequest=new ye(this),this.uploadTracks=new _e(this),this.scheduledPublication=new ge(this),this.scheduledUnpublishing=new we(this),this.searchResults=new be(this),this.environments=new ve(this),this.maintenanceMode=new xe(this),this.webhooks=new Ie(this),this.webhookCalls=new Ue(this),this.buildTriggers=new Te(this),this.siteSearchSources=new Re(this),this.itemTypeFilters=new Be(this),this.uploadFilters=new Ee(this),this.siteInvitations=new Fe(this),this.editingSessions=new Se(this),this.ssoGroups=new Pe(this),this.ssoSettings=new ze(this),this.emojiSuggestions=new ke(this),this.whiteLabelSettings=new qe(this),this.publicInfo=new Oe(this),this.dailyUsages=new Ve(this),this.usageCounters=new Le(this),this.uploadTags=new Ae(this),this.uploadSmartTags=new Ne(this),this.site=new Ce(this),this.workflows=new $e(this)}get baseUrl(){return this.config.baseUrl||De.defaultBaseUrl}request(e){return Ut(Object.assign(Object.assign(Object.assign({},this.config),e),{logFn:this.config.logFn||console.log,userAgent:"@datocms/cma-client v5.2.0-alpha.3",baseUrl:this.baseUrl,preCallStack:new Error().stack,extraHeaders:Object.assign(Object.assign(Object.assign({},this.config.extraHeaders||{}),this.config.environment?{"X-Environment":this.config.environment}:{}),{"X-API-Version":"3"}),fetchJobResult:i=>this.jobResultsFetcher?this.jobResultsFetcher(i):or(()=>this.jobResults.find(i))}))}eventsChannelName(){return Ks(this,void 0,void 0,function*(){if(this.cachedEventsChannelName)return this.cachedEventsChannelName;let{data:e}=yield this.site.rawFind();return this.cachedEventsChannelName=this.config.environment?`private-site-${e.id}-environment-${this.config.environment}`:`private-site-${e.id}`,this.cachedEventsChannelName})}};De.defaultBaseUrl="https://site-api.datocms.com";var je=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(d){try{l(r.next(d))}catch(p){o(p)}}function f(d){try{l(r.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):n(d.value).then(a,f)}l((r=r.apply(t,e||[])).next())})};function Rt(t){return"attributes"in t?t.attributes.localized:t.localized}function b(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let e=Object.keys(t);if(e.length===0)return!1;let i=/^[A-Za-z]{2,4}(-[A-Za-z]{4})?(-([A-Za-z]{2}|[0-9]{3}))?$/;return e.every(r=>i.test(r))}function Y(t,e){return Rt(e)?Object.entries(t).map(([r,n])=>({locale:r,value:n})):[{locale:void 0,value:t}]}function Bt(t,e){if(Rt(e))return Object.fromEntries(t.map(({locale:i,value:r})=>[i,r]));if(t.length===0)throw new Error("There must be at least one entry!");return t[0].value}function Xs(t,e,i){let n=Y(t,e).map(({locale:s,value:o})=>({locale:s,value:i(s,o)}));return Bt(n,e)}function Qs(t,e,i){return je(this,void 0,void 0,function*(){let r=Y(t,e),n=yield Promise.all(r.map(({locale:s,value:o})=>je(this,void 0,void 0,function*(){return{locale:s,value:yield i(s,o)}})));return Bt(n,e)})}function Zs(t,e,i){var r;let s=Y(t,e).filter(o=>i(o.locale,o.value));return Rt(e)?Bt(s,e):s.length>0?(r=s[0])===null||r===void 0?void 0:r.value:void 0}function en(t,e,i){var r;return je(this,void 0,void 0,function*(){let n=Y(t,e),o=(yield Promise.all(n.map(({locale:a,value:f})=>je(this,void 0,void 0,function*(){return{locale:a,value:f,passed:yield i(a,f)}})))).filter(({passed:a})=>a).map(({locale:a,value:f})=>({locale:a,value:f}));return Rt(e)?Bt(o,e):o.length>0?(r=o[0])===null||r===void 0?void 0:r.value:void 0})}function vr(t,e,i){return Y(t,e).some(({locale:n,value:s})=>i(n,s))}function xr(t,e,i){return je(this,void 0,void 0,function*(){let r=Y(t,e);return(yield Promise.all(r.map(({locale:s,value:o})=>i(s,o)))).some(s=>s)})}function tn(t,e,i){return!vr(t,e,(r,n)=>!i(r,n))}function rn(t,e,i){return je(this,void 0,void 0,function*(){return!(yield xr(t,e,(r,n)=>je(this,void 0,void 0,function*(){return!(yield i(r,n))})))})}function sn(t,e,i){let r=Y(t,e);for(let{locale:n,value:s}of r)i(n,s)}function nn(t,e,i){return je(this,void 0,void 0,function*(){let r=Y(t,e);yield Promise.all(r.map(({locale:n,value:s})=>i(n,s)))})}function $t(t){return typeof t=="boolean"||t===null}function on(t){return b(t)&&Object.values(t).every($t)}function Dt(t){return t===null?!0:typeof t=="object"&&t!==null&&"red"in t&&"green"in t&&"blue"in t&&"alpha"in t}function an(t){return b(t)&&Object.values(t).every(Dt)}function jt(t){return t===null?!0:typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t)}function ln(t){return b(t)&&Object.values(t).every(jt)}function Gt(t){return t===null?!0:typeof t=="string"&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t)}function un(t){return b(t)&&Object.values(t).every(Gt)}function ht(t){return t===null?!0:b(t)&&"upload_id"in t&&"alt"in t&&"title"in t&&"custom_data"in t&&"focal_point"in t}function mt(t){return t===null?!0:typeof t=="object"&&t!==null&&"upload_id"in t}function dn(t){return b(t)&&Object.values(t).every(ht)}function cn(t){return b(t)&&Object.values(t).every(mt)}function Mt(t){return typeof t=="number"||t===null}function fn(t){return b(t)&&Object.values(t).every(Mt)}function Wt(t){return Array.isArray(t)&&t.every(ht)}function Jt(t){return Array.isArray(t)&&t.every(mt)}function pn(t){return b(t)&&Object.values(t).every(Wt)}function hn(t){return b(t)&&Object.values(t).every(Jt)}function Yt(t){return typeof t=="number"||t===null}function mn(t){return b(t)&&Object.values(t).every(Yt)}function Ht(t){if(t===null)return!0;if(typeof t!="string")return!1;try{return JSON.parse(t),!0}catch(e){return!1}}function yn(t){return b(t)&&Object.values(t).every(Ht)}function Kt(t){return t===null?!0:typeof t=="object"&&t!==null&&"latitude"in t&&"longitude"in t}function _n(t){return b(t)&&Object.values(t).every(Kt)}var Xt,gn=new Uint8Array(16);function Ai(){if(!Xt&&(Xt=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Xt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xt(gn)}var S=[];for(let t=0;t<256;++t)S.push((t+256).toString(16).slice(1));function Ir(t,e=0){return S[t[e+0]]+S[t[e+1]]+S[t[e+2]]+S[t[e+3]]+"-"+S[t[e+4]]+S[t[e+5]]+"-"+S[t[e+6]]+S[t[e+7]]+"-"+S[t[e+8]]+S[t[e+9]]+"-"+S[t[e+10]]+S[t[e+11]]+S[t[e+12]]+S[t[e+13]]+S[t[e+14]]+S[t[e+15]]}var wn=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ni={randomUUID:wn};function bn(t,e,i){if(Ni.randomUUID&&!e&&!t)return Ni.randomUUID();t=t||{};let r=t.random||(t.rng||Ai)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){i=i||0;for(let n=0;n<16;++n)e[i+n]=r[n];return e}return Ir(r)}var Ci=bn;function vn(t){return(typeof Buffer=="undefined"?btoa(Array.from(t,i=>String.fromCharCode(i)).join("")):Buffer.from(t).toString("base64")).replace(/\+/g,"-").replace(/\//g,"_").substring(0,22)}function xn(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");return typeof Buffer=="undefined"?Uint8Array.from(atob(e),i=>i.charCodeAt(0)):new Uint8Array(Buffer.from(e,"base64"))}function M(t){if(/^\d+$/.test(t))return BigInt(t)<=0xffffffffffff;let e=xn(t);return!(e.length!==16||(e.at(8)&192)!==128||e.at(6)>>4!==4)}function In(){let t=Ci(null,new Uint8Array(16));return t[0]=t[0]&127,vn(t)}function Qt(t){return typeof t=="string"&&M(t)||t===null}function Un(t){return b(t)&&Object.values(t).every(Qt)}function Zt(t){return Array.isArray(t)&&t.every(e=>typeof e=="string"&&M(e))}function Tn(t){return b(t)&&Object.values(t).every(Zt)}function yt(t){return typeof t=="string"}function q(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="item"&&"attributes"in t&&"relationships"in t}function _t(t){return q(t)&&"id"in t&&typeof t.id=="string"}function ei(t){return typeof t=="string"&&M(t)||t===null}function Rn(t){return b(t)&&Object.values(t).every(ei)}function ti(t){return t===null||yt(t)?!0:q(t)}function Bn(t){return b(t)&&Object.values(t).every(ti)}function ii(t){return t===null?!0:_t(t)}function En(t){return b(t)&&Object.values(t).every(ii)}function ri(t){return Array.isArray(t)&&t.every(e=>typeof e=="string"&&M(e))}function Fn(t){return b(t)&&Object.values(t).every(ri)}function si(t){return t===null?!0:Array.isArray(t)?t.every(e=>yt(e)?!0:q(e)):!1}function Sn(t){return b(t)&&Object.values(t).every(si)}function ni(t){return Array.isArray(t)?t.every(e=>_t(e)):!1}function Pn(t){return b(t)&&Object.values(t).every(ni)}function oi(t){return t===null?!0:typeof t=="object"&&t!==null&&("title"in t||"description"in t||"image"in t||"twitter_card"in t||"no_index"in t)}function zn(t){return b(t)&&Object.values(t).every(oi)}function ai(t){return t===null?!0:typeof t=="string"}function kn(t){return b(t)&&Object.values(t).every(ai)}function li(t){return typeof t=="string"||t===null}function qn(t){return b(t)&&Object.values(t).every(li)}var z,k,ui="blockquote",Et="block",fi="inlineBlock",Ft="code",St="heading",$i="inlineItem",pi="itemLink",hi="link",di="listItem",gt="list",Ye="paragraph",Di="root",mi="span",ci="thematicBreak";var _c=(z={},z[ui]=[Ye],z[Et]=[],z[fi]=[],z[Ft]=[],z[St]="inlineNodes",z[$i]=[],z[pi]="inlineNodes",z[hi]="inlineNodes",z[di]=[Ye,gt],z[gt]=[di],z[Ye]="inlineNodes",z[Di]=[ui,Ft,gt,Ye,St,Et,ci],z[mi]=[],z[ci]=[],z);var gc=(k={},k[ui]=["children","attribution"],k[Et]=["item"],k[fi]=["item"],k[Ft]=["language","highlight","code"],k[St]=["level","children","style"],k[$i]=["item"],k[pi]=["item","children","meta"],k[hi]=["url","children","meta"],k[di]=["children"],k[gt]=["style","children"],k[Ye]=["children","style"],k[Di]=["children"],k[mi]=["value","marks"],k[ci]=[],k);function Ur(t){return"children"in t}function Tr(t){return t.type===St}function Rr(t){return t.type===mi}function Br(t){return t.type===Ye}function Er(t){return t.type===gt}function Pt(t){return t.type===Et}function zt(t){return t.type===fi}function Fr(t){return t.type===Ft}function Sr(t){return t.type===hi}function Pr(t){return t.type===pi}function On(t){return Boolean(typeof t=="object"&&t)}function wt(t){return Boolean(On(t)&&"schema"in t&&"document"in t&&t.schema==="dast")}var Vn=function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;for(var r=Array(t),n=0,e=0;e<i;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)r[n]=s[o];return r},Ln={MAX_WIDTH:80};function An(t){return Ur(t)}function Nn(t){return"(item: "+JSON.stringify(t)+")"}function Cn(t){return wt(t)?t.document:t}function kr(t,e){e===void 0&&(e={});var i=Cn(t),r=qr(i,e);return r.nodes&&r.nodes.length>0?r.nodes.length===1?r.nodes[0]:{label:"",nodes:r.nodes}:{label:""}}function qr(t,e){var i,r,n=(r=e.maxWidth)!==null&&r!==void 0?r:Ln.MAX_WIDTH,s=Math.max(20,n-8),o=$n(t,e,s),a={label:o};if(An(t)){var f=t.children;if(f.length>0){a.nodes=[];for(var l=0,d=f;l<d.length;l++){var p=d[l];a.nodes.push(qr(p,e))}}}if((Pt(t)||zt(t))&&e.blockFormatter){var u=e.blockFormatter(t.item,s);typeof u!="string"&&(a.nodes||(a.nodes=[]),Array.isArray(u)?(i=a.nodes).push.apply(i,u):a.nodes.push(u))}return a}function $n(t,e,i){var r=[],n="";if(Rr(t))t.marks&&t.marks.length>0&&r.push("marks: "+t.marks.join(", ")),n=' "'+zr(t.value,i)+'"';else if(Fr(t))t.language&&r.push('language: "'+t.language+'"'),n=' "'+zr(t.code,i)+'"';else if(Tr(t))r.push("level: "+t.level);else if(Er(t))r.push("style: "+t.style);else if(Sr(t)){if(r.push('url: "'+t.url+'"'),t.meta&&t.meta.length>0){var s=t.meta.map(function(d){return d.id+'="'+d.value+'"'}).join(", ");r.push("meta: {"+s+"}")}}else if(Pr(t)){if(r.push('item: "'+t.item+'"'),t.meta&&t.meta.length>0){var s=t.meta.map(function(p){return p.id+'="'+p.value+'"'}).join(", ");r.push("meta: {"+s+"}")}}else if(Pt(t)||zt(t)){var o=e.blockFormatter||Nn,a=o(t.item,i);if(typeof a=="string"){var f=a.replace(/\n/g," ").trim();n=" "+f}}else Br(t)&&t.style&&r.push('style: "'+t.style+'"');var l=r.length>0?" ("+r.join(", ")+")":"";return""+t.type+l+n}function zr(t,e){return t.length<=e?t:t.substring(0,e-3)+"..."}function Or(t){var e=typeof t=="string"?{label:t}:t,i=[];function r(n,s,o){var a=n.label.trim(),f=n.nodes||[];if(!a&&f.length>0){f.forEach(function(g,v){var F=v===f.length-1;r(g,s,F)});return}var l=s.map(function(g){return g?"\u2502 ":" "}).join(""),d=o?"\u2514":"\u251C",p=a.split(`
|
|
8
|
-
`);i.push(""+
|
|
7
|
+
${this.preCallStack}`)}get errors(){return ls(this.response.body)?this.response.body.data:[]}findError(e,i){let r=Array.isArray(e)?e:[e];return this.errors.find(n=>r.includes(n.attributes.code)&&(!i||(typeof i=="function"?i(n.attributes.details):Object.entries(i).every(([s,o])=>n.attributes.details[s]===o))))}};var C=class extends Error{constructor(){super("Promise canceled!"),Object.setPrototypeOf(this,new.target.prototype)}};function G(t,e){let i=null,r=new Promise((n,s)=>{i=()=>{try{e&&e(),s(new C)}catch(l){s(l)}},(typeof t=="function"?t():t).then(n,s)});return i&&(r.cancel=i),r}function it(t){return new Promise(e=>{setTimeout(e,t)})}var as=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(d){try{a(r.next(d))}catch(h){o(h)}}function f(d){try{a(r.throw(d))}catch(h){o(h)}}function a(d){d.done?s(d.value):n(d.value).then(l,f)}a((r=r.apply(t,e||[])).next())})};function lr(t){return as(this,void 0,void 0,function*(){let e,i=0;do try{i+=1,yield it(i*1e3),e=yield t()}catch(r){if(!(r instanceof N)||r.response.status!==404)throw r}while(!e);return e})}var mr=ns(pr());var We=function(t){return this instanceof We?(this.v=t,this):new We(t)},ws=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||l(u,m)})})}function l(u,m){try{f(r[u](m))}catch(g){h(s[0][3],g)}}function f(u){u.value instanceof We?Promise.resolve(u.value.v).then(a,d):h(s[0][2],u)}function a(u){l("next",u)}function d(u){l("throw",u)}function h(u,m){u(m),s.shift(),s.length&&l(s[0][0],s[0][1])}};function T(t,e,i,r){return ws(this,arguments,function*(){let s=(i==null?void 0:i.perPage)||t.defaultLimit;if(s>t.maxLimit)throw new Error(`perPage option cannot exceed maximum value of ${t.maxLimit}`);let o=(i==null?void 0:i.concurrency)||1;if(o>10)throw new Error("concurrency option cannot exceed maximum value of 10");let l=yield We(e({limit:s,offset:0}));for(let h of l.data)yield yield We(h);let f=l.meta.total_count,a=new mr.Scheduler(o),d=[];for(let h=s;h<f;h+=s)d.push(a.enqueue(()=>e({limit:s,offset:h})));for(;d.length>0;){let h=yield We(d.shift());for(let u of h.data)yield yield We(r?et(u):u)}})}function B(t){t&&"page"in t&&console.warn("Passing a `page` query param on paged iterators has no effect: use the `perPage` option instead.")}var yr="__ARRAY_INDEX__";function bs(t){return t.reduce((e,i,r)=>r===0?i:i===yr?`${e}[]`:`${e}[${i}]`,"")}function vs(t){if(typeof t=="number"||typeof t=="string")return t.toString();if(t===!0)return"true";if(t===!1)return"false";throw`Don't know how to serialize param value ${JSON.stringify(t)}`}function Nt(t,e=[]){let i=[];if(typeof t=="number"||typeof t=="string"||typeof t=="boolean")i.push([bs(e),vs(t)]);else if(typeof t=="object"){if(Array.isArray(t))for(let r of t)for(let n of Nt(r,[...e,yr]))i.push(n);else if(t)for(let[r,n]of Object.entries(t))for(let s of Nt(n,[...e,r]))i.push(s)}return i}var xs=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(d){try{a(r.next(d))}catch(h){o(h)}}function f(d){try{a(r.throw(d))}catch(h){o(h)}}function a(d){d.done?s(d.value):n(d.value).then(l,f)}a((r=r.apply(t,e||[])).next())})},Is=typeof window!="undefined"&&typeof window.document!="undefined",Us=5,L;(function(t){t[t.NONE=0]="NONE",t[t.BASIC=1]="BASIC",t[t.BODY=2]="BODY",t[t.BODY_AND_HEADERS=3]="BODY_AND_HEADERS"})(L||(L={}));function Rs(t){let e={};return t.forEach((i,r)=>{e[r]=i}),e}function _r(t,e,i,r,n,s,o){return{request:{url:e,method:t,headers:i,body:r},response:{status:n.status,statusText:n.statusText,headers:Rs(n.headers),body:s},preCallStack:o}}function Ts(t,e,i,r,n){return{request:{url:e,method:t,headers:i,body:r},preCallStack:n}}function Bs(t,e,i,r,n,s,o){return{request:{url:e,method:t,headers:i,body:r},response:{status:n,statusText:"N/A",headers:{},body:s},preCallStack:o}}function Es(t){return typeof t=="object"&&!!t&&"code"in t}function Fs(t){return Object.fromEntries(Object.entries(t).map(([e,i])=>[e.toLowerCase(),i]))}var gr=1;function Ss(t){let e=t||(typeof fetch=="undefined"?void 0:fetch)||(typeof globalThis=="undefined"?void 0:globalThis.fetch);if(typeof e=="undefined")throw new Error("fetch() is not available: either polyfill it globally, or provide it as fetchFn option.");return e}function Ut(t){var e;return xs(this,void 0,void 0,function*(){let i=gr;gr+=1;let r=Ss(t.fetchFn),n=t.preCallStack,s=t.userAgent||"@datocms/rest-client-utils",o=t.retryCount||1,l=t.logLevel||L.NONE,f="autoRetry"in t?t.autoRetry:!0,a=t.logFn||(()=>!0),d=Object.assign({"content-type":"application/json",accept:"application/json",authorization:`Bearer ${t.apiToken}`,"user-agent":s},t.extraHeaders?Fs(t.extraHeaders):{});Is&&delete d["user-agent"];let h=t.baseUrl.replace(/\/$/,""),u=t.body?JSON.stringify(t.body,null,2):void 0,m=t.queryParams&&Object.keys(t.queryParams).length>0?`?${new URLSearchParams(Nt(t.queryParams)).toString()}`:"",g=`${h}${t.url}${m}`;if(l>=L.BASIC){if(a(`[${i}] ${t.method} ${g}`),l>=L.BODY_AND_HEADERS)for(let[v,F]of Object.entries(d||{}))a(`[${i}] ${v}: ${F}`);l>=L.BODY&&u&&a(`[${i}] ${u}`)}try{let v=G(r(g,{method:t.method,headers:d,body:u})),F=setTimeout(()=>{v.cancel()},t.requestTimeout||3e4),U=yield v;clearTimeout(F);let A=U.headers.get("Content-Type"),K=A&&!A.includes("application/json");if(U.status===429||K){if(!f||K&&t.method!=="GET")throw new N(_r(t.method,g,d,t.body,U,void 0,n));let O=U.headers.has("X-RateLimit-Reset")?Number.parseInt(U.headers.get("X-RateLimit-Reset"),10):o;return l>=L.BASIC&&(U.status===429?a(`[${i}] Rate limit exceeded, wait ${O} seconds then retry...`):a(`[${i}] Invalid response content type "${A}" (status ${U.status}). Wait ${O} seconds then retry...`)),yield it(O*1e3),Ut(Object.assign(Object.assign({},t),{retryCount:o+1}))}if(l>=L.BASIC&&(a(`[${i}] Status: ${U.status} (${U.statusText})`),l>=L.BODY_AND_HEADERS))for(let O of["x-api-version","x-environment","x-queue-time","x-ratelimit-remaining","x-request-id","cf-ray"]){let rr=U.headers.get(O);rr&&a(`[${i}] ${O}: ${rr}`)}let Ge=U.status===204?void 0:yield U.json();if(l>=L.BODY&&Ge&&a(`[${i}] ${JSON.stringify(Ge,null,2)}`),U.status===202){let O=yield t.fetchJobResult(Ge.data.id);if(O.status<200||O.status>=300)throw new N(Bs(t.method,g,d,t.body,O.status,O.payload,n));Ge=O.payload}if(U.status>=200&&U.status<300)return Ge;let At=new N(_r(t.method,g,d,t.body,U,Ge,n)),ir=(e=At.errors.find(O=>O.attributes.transient))===null||e===void 0?void 0:e.attributes.code;if(f&&ir)return l>=L.BASIC&&a(`[${i}] ${ir}, wait ${o} seconds then retry...`),yield it(o*1e3),Ut(Object.assign(Object.assign({},t),{retryCount:o+1}));throw At}catch(v){if(v instanceof C||Es(v)&&v.code.includes("ETIMEDOUT")){if(f&&o<Us)return l>=L.BASIC&&a(`[${i}] Timeout error, wait ${o} seconds then retry...`),yield it(o*1e3),Ut(Object.assign(Object.assign({},t),{retryCount:o+1}));throw new tt(Ts(t.method,g,d,t.body,n))}throw v}})}var br=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]]);return i};function Ct(t){return typeof t=="object"&&!!t&&"id"in t&&"type"in t}function Li(t){return Array.isArray(t)&&t.every(Ct)}function y(t,e){if(typeof t!="object"||!t)throw new Error("Invalid body!");if(Array.isArray(t))return{data:t.map(a=>{var d;return(d=y(a,e))===null||d===void 0?void 0:d.data})};let i=t,{id:r,type:n,meta:s}=i,o=br(i,["id","type","meta"]),l={},f={};if(e.attributes==="*")for(let[a,d]of Object.entries(o))if(e.relationships.includes(a))if(Ct(d)){let{id:h,type:u}=d;f[a]={data:{id:h,type:u}}}else Li(d)?f[a]={data:d.map(({id:h,type:u})=>({id:h,type:u}))}:f[a]={data:null};else l[a]=d;else if(e.relationships==="*")for(let[a,d]of Object.entries(o))if(e.attributes.includes(a))l[a]=d;else if(Ct(d)){let{id:h,type:u}=d;f[a]={data:{id:h,type:u}}}else Li(d)?f[a]={data:d.map(({id:h,type:u})=>({id:h,type:u}))}:f[a]={data:null};else{for(let[a,d]of Object.entries(o))if(e.attributes.includes(a))l[a]=d;else if(e.relationships.includes(a))if(Ct(d)){let{id:h,type:u}=d;f[a]={data:{id:h,type:u}}}else Li(d)?f[a]={data:d.map(({id:h,type:u})=>({id:h,type:u}))}:f[a]={data:null};e.attributes.includes("type")&&(l.type=n)}return{data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},r||e.id?{id:r||e.id}:{}),{type:e.type}),Object.keys(l).length>0?{attributes:l}:{}),Object.keys(f).length>0?{relationships:f}:{}),s?{meta:s}:{})}}function Ai(t){if(Array.isArray(t))return t.map(Ai);if(t&&typeof t=="object"){let e={};for(let[i,r]of Object.entries(t))i!=="__itemTypeId"&&(e[i]=Ai(r));return e}return t}function wr(t){if(!t||typeof t!="object")return t;let{__itemTypeId:e}=t,i=br(t,["__itemTypeId"]),r={};for(let[n,s]of Object.entries(i))r[n]=Ai(s);return r}function Rt(t){return!t||!("data"in t)?t:Array.isArray(t.data)?Object.assign(Object.assign({},t),{data:t.data.map(wr)}):Object.assign(Object.assign({},t),{data:wr(t.data)})}function p(t){return typeof t=="string"?t:t.id}var w={};sr(w,{AccessToken:()=>le,AuditLogEvent:()=>Z,BuildEvent:()=>fe,BuildTrigger:()=>Re,DailyUsage:()=>Ve,EditingSession:()=>Se,EmojiSuggestions:()=>ze,Environment:()=>ve,Field:()=>se,Fieldset:()=>ne,Item:()=>j,ItemType:()=>re,ItemTypeFilter:()=>Be,ItemVersion:()=>pe,JobResult:()=>ue,MaintenanceMode:()=>xe,MenuItem:()=>ee,Plugin:()=>ae,PublicInfo:()=>Oe,Role:()=>Je,ScheduledPublication:()=>ge,ScheduledUnpublishing:()=>we,SchemaMenuItem:()=>te,SearchIndex:()=>Te,SearchIndexEvent:()=>he,SearchResult:()=>be,Session:()=>oe,Site:()=>Ce,SiteInvitation:()=>Fe,SsoGroup:()=>Pe,SsoSettings:()=>ke,SsoUser:()=>Q,SubscriptionFeature:()=>ce,SubscriptionLimit:()=>de,Upload:()=>me,UploadCollection:()=>ie,UploadFilter:()=>Ee,UploadRequest:()=>ye,UploadSmartTag:()=>Ne,UploadTag:()=>Ae,UploadTrack:()=>_e,UsageCounter:()=>Le,User:()=>X,Webhook:()=>Ie,WebhookCall:()=>Ue,WhiteLabelSettings:()=>qe,Workflow:()=>$e});var _=class{constructor(e){this.client=e}};var st=class extends _{create(e){return this.rawCreate(y(e,{type:"role",attributes:["name","can_edit_favicon","can_edit_site","can_edit_schema","can_manage_menu","can_edit_environment","can_promote_environments","environments_access","can_manage_users","can_manage_shared_filters","can_manage_search_indexes","can_manage_upload_collections","can_manage_build_triggers","can_manage_webhooks","can_manage_environments","can_manage_sso","can_access_audit_log","can_manage_workflows","can_manage_access_tokens","can_perform_site_search","can_access_build_events_log","can_access_search_index_events_log","positive_item_type_permissions","negative_item_type_permissions","positive_upload_permissions","negative_upload_permissions","positive_build_trigger_permissions","negative_build_trigger_permissions","positive_search_index_permissions","negative_search_index_permissions"],relationships:["inherits_permissions_from"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/roles",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"role",attributes:["name","can_edit_favicon","can_edit_site","can_edit_schema","can_manage_menu","can_edit_environment","can_promote_environments","environments_access","can_manage_users","can_manage_shared_filters","can_manage_search_indexes","can_manage_upload_collections","can_manage_build_triggers","can_manage_webhooks","can_manage_environments","can_manage_sso","can_access_audit_log","can_manage_workflows","can_manage_access_tokens","can_perform_site_search","can_access_build_events_log","can_access_search_index_events_log","positive_item_type_permissions","negative_item_type_permissions","positive_upload_permissions","negative_upload_permissions","positive_build_trigger_permissions","negative_build_trigger_permissions","positive_search_index_permissions","negative_search_index_permissions"],relationships:["inherits_permissions_from"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/roles/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/roles"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/roles/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/roles/${e}`})}duplicate(e){return this.rawDuplicate(p(e)).then(i=>c(i))}rawDuplicate(e){return this.client.request({method:"POST",url:`/roles/${e}/duplicate`})}};st.TYPE="role";var Ps=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(d){try{a(r.next(d))}catch(h){o(h)}}function f(d){try{a(r.throw(d))}catch(h){o(h)}}function a(d){d.done?s(d.value):n(d.value).then(l,f)}a((r=r.apply(t,e||[])).next())})};function vr(t,e){return t==null&&e==null?!0:t===e}function ks(t,e){for(let i in t)if(!vr(t[i],e[i]))return!1;for(let i in e)if(!vr(t[i],e[i]))return!1;return!0}function $t(t,e,i,r){if(!e)return t;let{add:n,remove:s}=e;return[...s?s.reduce((o,l)=>{let f=Object.assign(Object.assign({},l),{environment:i}),a=o.find(d=>ks(d,f));if(!a)throw new Error(`Cannot find rule ${JSON.stringify(f)} to remove in ${r}!`);return o.filter(d=>d!==a)},t):t,...n?n.map(o=>Object.assign({environment:i},o)):[]]}var Je=class extends st{updateCurrentEnvironmentPermissions(e,i){return Ps(this,void 0,void 0,function*(){let r=this.client.config.environment||(yield this.client.environments.list()).find(f=>f.meta.primary).id,n=yield this.find(e),s=Boolean(i.positive_item_type_permissions||i.negative_item_type_permissions),o=Boolean(i.positive_upload_permissions||i.negative_upload_permissions),l=Object.assign(Object.assign({},s?{positive_item_type_permissions:$t(n.positive_item_type_permissions,i.positive_item_type_permissions,r,"positive_item_type_permissions"),negative_item_type_permissions:$t(n.negative_item_type_permissions,i.negative_item_type_permissions,r,"negative_item_type_permissions")}:{}),o?{positive_upload_permissions:$t(n.positive_upload_permissions,i.positive_upload_permissions,r,"positive_upload_permissions"),negative_upload_permissions:$t(n.negative_upload_permissions,i.negative_upload_permissions,r,"negative_upload_permissions")}:{});return this.update(e,l)})}};var X=class extends _{update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"user",attributes:["is_active"],relationships:["role"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/users/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/users"})}find(e,i){return this.rawFind(p(e),i).then(r=>c(r))}rawFind(e,i){return this.client.request({method:"GET",url:`/users/${e}`,queryParams:i})}findMe(e){return this.rawFindMe(e).then(i=>c(i))}rawFindMe(e){return this.client.request({method:"GET",url:"/users/me",queryParams:e})}destroy(e,i){return this.rawDestroy(p(e),i).then(r=>c(r))}rawDestroy(e,i){return this.client.request({method:"DELETE",url:`/users/${e}`,queryParams:i})}};X.TYPE="user";var Q=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/sso-users"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/sso-users/${e}`})}copyUsers(){return this.rawCopyUsers().then(e=>c(e))}rawCopyUsers(){return this.client.request({method:"POST",url:"/sso-users/copy-users"})}destroy(e,i){return this.rawDestroy(p(e),i).then(r=>c(r))}rawDestroy(e,i){return this.client.request({method:"DELETE",url:`/sso-users/${e}`,queryParams:i})}};Q.TYPE="sso_user";var Z=class extends _{query(e){return this.rawQuery(y(e,{type:"audit_log_query",attributes:["filter","next_token","detailed_log"],relationships:[]})).then(i=>c(i))}rawQuery(e){return this.client.request({method:"POST",url:"/audit-log-events/query",body:e})}};Z.TYPE="audit_log_event";var ee=class extends _{create(e){return this.rawCreate(y(e,{type:"menu_item",attributes:["label","external_url","position","open_in_new_tab"],relationships:["item_type","item_type_filter","parent"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/menu-items",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"menu_item",attributes:["label","external_url","position","open_in_new_tab"],relationships:["item_type","item_type_filter","parent"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/menu-items/${e}`,body:i})}list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/menu-items",queryParams:e})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/menu-items/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/menu-items/${e}`})}reorder(e){return this.rawReorder(y(e,{type:"menu_item",attributes:["position"],relationships:["parent"]})).then(i=>c(i))}rawReorder(e){return this.client.request({method:"POST",url:"/menu-items/reorder",body:e})}};ee.TYPE="menu_item";var te=class extends _{create(e){return this.rawCreate(y(e,{type:"schema_menu_item",attributes:["label","position","kind"],relationships:["item_type","parent"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/schema-menu-items",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"schema_menu_item",attributes:["label","position","kind"],relationships:["item_type","parent","children"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/schema-menu-items/${e}`,body:i})}list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/schema-menu-items",queryParams:e})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/schema-menu-items/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/schema-menu-items/${e}`})}reorder(e){return this.rawReorder(y(e,{type:"schema_menu_item",attributes:["position"],relationships:["parent"]})).then(i=>c(i))}rawReorder(e){return this.client.request({method:"POST",url:"/schema-menu-items/reorder",body:e})}};te.TYPE="schema_menu_item";var ie=class extends _{create(e){return this.rawCreate(y(e,{type:"upload_collection",attributes:["label","position"],relationships:["parent"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-collections",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"upload_collection",attributes:["label","position"],relationships:["parent","children"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/upload-collections/${e}`,body:i})}list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/upload-collections",queryParams:e})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/upload-collections/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/upload-collections/${e}`})}reorder(e){return this.rawReorder(y(e,{type:"upload_collection",attributes:["position"],relationships:["parent"]})).then(i=>c(i))}rawReorder(e){return this.client.request({method:"POST",url:"/upload-collections/reorder",body:e})}};ie.TYPE="upload_collection";var re=class extends _{create(e,i){return this.rawCreate(y(e,{type:"item_type",attributes:["name","api_key","singleton","all_locales_required","sortable","modular_block","draft_mode_active","draft_saving_active","tree","ordering_direction","ordering_meta","collection_appeareance","collection_appearance","hint","inverse_relationships_enabled"],relationships:["ordering_field","presentation_title_field","presentation_image_field","title_field","image_preview_field","excerpt_field","workflow"]}),i).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:"/item-types",body:e,queryParams:i})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"item_type",attributes:["name","api_key","collection_appeareance","collection_appearance","singleton","all_locales_required","sortable","modular_block","draft_mode_active","draft_saving_active","tree","ordering_direction","ordering_meta","has_singleton_item","hint","inverse_relationships_enabled"],relationships:["ordering_field","presentation_title_field","presentation_image_field","title_field","image_preview_field","excerpt_field","workflow"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/item-types/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/item-types"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/item-types/${e}`})}duplicate(e){return this.rawDuplicate(p(e)).then(i=>c(i))}rawDuplicate(e){return this.client.request({method:"POST",url:`/item-types/${e}/duplicate`})}destroy(e,i){return this.rawDestroy(p(e),i).then(r=>c(r))}rawDestroy(e,i){return this.client.request({method:"DELETE",url:`/item-types/${e}`,queryParams:i})}referencing(e){return this.rawReferencing(p(e)).then(i=>c(i))}rawReferencing(e){return this.client.request({method:"GET",url:`/item-types/${e}/referencing`})}rawReorderFieldsAndFieldsets(e,i){return this.client.request({method:"POST",url:`/item-types/${e}/reorder-fields-and-fieldsets`,body:i})}};re.TYPE="item_type";var se=class extends _{create(e,i){return this.rawCreate(p(e),y(i,{type:"field",attributes:["label","field_type","api_key","localized","validators","appeareance","appearance","position","hint","default_value","deep_filtering_enabled"],relationships:["fieldset"]})).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:`/item-types/${e}/fields`,body:i})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"field",attributes:["default_value","label","api_key","localized","validators","appeareance","appearance","position","field_type","hint","deep_filtering_enabled"],relationships:["fieldset"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/fields/${e}`,body:i})}list(e){return this.rawList(p(e)).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:`/item-types/${e}/fields`})}referencing(e){return this.rawReferencing(p(e)).then(i=>c(i))}rawReferencing(e){return this.client.request({method:"GET",url:`/item-types/${e}/fields/referencing`})}related(e){return this.rawRelated(p(e)).then(i=>c(i))}rawRelated(e){return this.client.request({method:"GET",url:`/item-types/${e}/fields/related`})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/fields/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/fields/${e}`})}duplicate(e){return this.rawDuplicate(p(e)).then(i=>c(i))}rawDuplicate(e){return this.client.request({method:"POST",url:`/fields/${e}/duplicate`})}};se.TYPE="field";var ne=class extends _{create(e,i){return this.rawCreate(p(e),y(i,{type:"fieldset",attributes:["title","hint","position","collapsible","start_collapsed"],relationships:[]})).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:`/item-types/${e}/fieldsets`,body:i})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"fieldset",attributes:["title","hint","position","collapsible","start_collapsed"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/fieldsets/${e}`,body:i})}list(e){return this.rawList(p(e)).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:`/item-types/${e}/fieldsets`})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/fieldsets/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/fieldsets/${e}`})}};ne.TYPE="fieldset";var oe=class extends _{create(e){return this.rawCreate(y(e,{type:"email_credentials",attributes:["email","password","otp_code"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/sessions",body:e})}};oe.TYPE="session";var le=class extends _{create(e){return this.rawCreate(y(e,{type:"access_token",attributes:["name","can_access_cda","can_access_cda_preview","can_access_cma"],relationships:["role"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/access_tokens",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"access_token",attributes:["name","can_access_cda","can_access_cda_preview","can_access_cma"],relationships:["role"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/access_tokens/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/access_tokens"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/access_tokens/${e}`})}regenerateToken(e){return this.rawRegenerateToken(p(e)).then(i=>c(i))}rawRegenerateToken(e){return this.client.request({method:"POST",url:`/access_tokens/${e}/regenerate_token`})}destroy(e,i){return this.rawDestroy(p(e),i).then(r=>c(r))}rawDestroy(e,i){return this.client.request({method:"DELETE",url:`/access_tokens/${e}`,queryParams:i})}};le.TYPE="access_token";var ae=class extends _{create(e){return this.rawCreate(y(e,{type:"plugin",attributes:["package_name","name","description","url","permissions","plugin_type","field_types","parameter_definitions","package_version"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/plugins",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"plugin",attributes:["name","description","url","parameters","package_version","permissions"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/plugins/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/plugins"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/plugins/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/plugins/${e}`})}fields(e){return this.rawFields(p(e)).then(i=>c(i))}rawFields(e){return this.client.request({method:"GET",url:`/plugins/${e}/fields`})}};ae.TYPE="plugin";var ue=class extends _{find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/job-results/${e}`})}};ue.TYPE="job_result";var de=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/subscription-limits"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/subscription-limits/${e}`})}};de.TYPE="subscription_limit";var ce=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/subscription-features"})}};ce.TYPE="subscription_feature";var zs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(l,f){o=t[s](o),n(l,f,o.done,o.value)})}}function n(s,o,l,f){Promise.resolve(f).then(function(a){s({value:a,done:l})},o)}},nt=function(t){return this instanceof nt?(this.v=t,this):new nt(t)},qs=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||l(u,m)})})}function l(u,m){try{f(r[u](m))}catch(g){h(s[0][3],g)}}function f(u){u.value instanceof nt?Promise.resolve(u.value.v).then(a,d):h(s[0][2],u)}function a(u){l("next",u)}function d(u){l("throw",u)}function h(u,m){u(m),s.shift(),s.length&&l(s[0][0],s[0][1])}},fe=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/build-events",queryParams:e})}listPagedIterator(e,i){return qs(this,arguments,function*(){var n,s,o,l;try{for(var f=!0,a=zs(this.rawListPagedIterator(e,i)),d;d=yield nt(a.next()),n=d.done,!n;){l=d.value,f=!1;try{yield yield nt(R(l))}finally{f=!0}}}catch(h){s={error:h}}finally{try{!f&&!n&&(o=a.return)&&(yield nt(o.call(a)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),T({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/build-events/${e}`})}};fe.TYPE="build_event";var Os=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(l,f){o=t[s](o),n(l,f,o.done,o.value)})}}function n(s,o,l,f){Promise.resolve(f).then(function(a){s({value:a,done:l})},o)}},ot=function(t){return this instanceof ot?(this.v=t,this):new ot(t)},Vs=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||l(u,m)})})}function l(u,m){try{f(r[u](m))}catch(g){h(s[0][3],g)}}function f(u){u.value instanceof ot?Promise.resolve(u.value.v).then(a,d):h(s[0][2],u)}function a(u){l("next",u)}function d(u){l("throw",u)}function h(u,m){u(m),s.shift(),s.length&&l(s[0][0],s[0][1])}},he=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/search-index-events",queryParams:e})}listPagedIterator(e,i){return Vs(this,arguments,function*(){var n,s,o,l;try{for(var f=!0,a=Os(this.rawListPagedIterator(e,i)),d;d=yield ot(a.next()),n=d.done,!n;){l=d.value,f=!1;try{yield yield ot(R(l))}finally{f=!0}}}catch(h){s={error:h}}finally{try{!f&&!n&&(o=a.return)&&(yield ot(o.call(a)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),T({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/search-index-events/${e}`})}};he.TYPE="search_index_event";var Ls=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(l,f){o=t[s](o),n(l,f,o.done,o.value)})}}function n(s,o,l,f){Promise.resolve(f).then(function(a){s({value:a,done:l})},o)}},lt=function(t){return this instanceof lt?(this.v=t,this):new lt(t)},As=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||l(u,m)})})}function l(u,m){try{f(r[u](m))}catch(g){h(s[0][3],g)}}function f(u){u.value instanceof lt?Promise.resolve(u.value.v).then(a,d):h(s[0][2],u)}function a(u){l("next",u)}function d(u){l("throw",u)}function h(u,m){u(m),s.shift(),s.length&&l(s[0][0],s[0][1])}},j=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/items",queryParams:e}).then(P)}listPagedIterator(e,i){return As(this,arguments,function*(){var n,s,o,l;try{for(var f=!0,a=Ls(this.rawListPagedIterator(e,i)),d;d=yield lt(a.next()),n=d.done,!n;){l=d.value,f=!1;try{yield yield lt(R(l))}finally{f=!0}}}catch(h){s={error:h}}finally{try{!f&&!n&&(o=a.return)&&(yield lt(o.call(a)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),T({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i,!0)}validateExisting(e,i){return this.rawValidateExisting(p(e),y(i,{id:p(e),type:"item",attributes:"*",relationships:["item_type","creator"]}))}rawValidateExisting(e,i){return this.client.request({method:"POST",url:`/items/${e}/validate`,body:Rt(i)})}validateNew(e){return this.rawValidateNew(y(e,{type:"item",attributes:"*",relationships:["item_type","creator"]}))}rawValidateNew(e){return this.client.request({method:"POST",url:"/items/validate",body:Rt(e)})}create(e){return this.rawCreate(y(e,{type:"item",attributes:"*",relationships:["item_type","creator"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/items",body:Rt(e)}).then(P)}duplicate(e){return this.rawDuplicate(p(e)).then(i=>c(i))}rawDuplicate(e){return this.client.request({method:"POST",url:`/items/${e}/duplicate`}).then(P)}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"item",attributes:"*",relationships:["item_type","creator"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/items/${e}`,body:Rt(i)}).then(P)}references(e,i){return this.rawReferences(p(e),i).then(r=>c(r))}rawReferences(e,i){return this.client.request({method:"GET",url:`/items/${e}/references`,queryParams:i}).then(P)}find(e,i){return this.rawFind(p(e),i).then(r=>c(r))}rawFind(e,i){return this.client.request({method:"GET",url:`/items/${e}`,queryParams:i}).then(P)}currentVsPublishedState(e){return this.rawCurrentVsPublishedState(p(e)).then(i=>c(i))}rawCurrentVsPublishedState(e){return this.client.request({method:"GET",url:`/items/${e}/current-vs-published-state`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/items/${e}`}).then(P)}publish(e,i,r){return this.rawPublish(p(e),i?y(i,{type:"selective_publish_operation",attributes:["content_in_locales","non_localized_content"],relationships:[]}):null,r).then(n=>c(n))}rawPublish(e,i,r){return this.client.request({method:"PUT",url:`/items/${e}/publish`,body:i,queryParams:r}).then(P)}unpublish(e,i,r){return this.rawUnpublish(p(e),i?y(i,{type:"selective_unpublish_operation",attributes:["content_in_locales"],relationships:[]}):null,r).then(n=>c(n))}rawUnpublish(e,i,r){return this.client.request({method:"PUT",url:`/items/${e}/unpublish`,body:i,queryParams:r}).then(P)}bulkPublish(e){return this.rawBulkPublish(y(e,{type:"item_bulk_publish_operation",attributes:[],relationships:["items"]})).then(i=>c(i))}rawBulkPublish(e){return this.client.request({method:"POST",url:"/items/bulk/publish",body:e})}bulkUnpublish(e){return this.rawBulkUnpublish(y(e,{type:"item_bulk_unpublish_operation",attributes:[],relationships:["items"]})).then(i=>c(i))}rawBulkUnpublish(e){return this.client.request({method:"POST",url:"/items/bulk/unpublish",body:e})}bulkDestroy(e){return this.rawBulkDestroy(y(e,{type:"item_bulk_destroy_operation",attributes:[],relationships:["items"]})).then(i=>c(i))}rawBulkDestroy(e){return this.client.request({method:"POST",url:"/items/bulk/destroy",body:e})}bulkMoveToStage(e){return this.rawBulkMoveToStage(y(e,{type:"item_bulk_move_to_stage_operation",attributes:["stage"],relationships:["items"]})).then(i=>c(i))}rawBulkMoveToStage(e){return this.client.request({method:"POST",url:"/items/bulk/move-to-stage",body:e})}};j.TYPE="item";var Ns=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(l,f){o=t[s](o),n(l,f,o.done,o.value)})}}function n(s,o,l,f){Promise.resolve(f).then(function(a){s({value:a,done:l})},o)}},at=function(t){return this instanceof at?(this.v=t,this):new at(t)},Cs=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||l(u,m)})})}function l(u,m){try{f(r[u](m))}catch(g){h(s[0][3],g)}}function f(u){u.value instanceof at?Promise.resolve(u.value.v).then(a,d):h(s[0][2],u)}function a(u){l("next",u)}function d(u){l("throw",u)}function h(u,m){u(m),s.shift(),s.length&&l(s[0][0],s[0][1])}},pe=class extends _{restore(e){return this.rawRestore(p(e)).then(i=>c(i))}rawRestore(e){return this.client.request({method:"POST",url:`/versions/${e}/restore`})}list(e,i){return this.rawList(p(e),i).then(r=>c(r))}rawList(e,i){return this.client.request({method:"GET",url:`/items/${e}/versions`,queryParams:i})}listPagedIterator(e,i,r){return Cs(this,arguments,function*(){var s,o,l,f;try{for(var a=!0,d=Ns(this.rawListPagedIterator(p(e),i,r)),h;h=yield at(d.next()),s=h.done,!s;){f=h.value,a=!1;try{yield yield at(R(f))}finally{a=!0}}}catch(u){o={error:u}}finally{try{!a&&!s&&(l=d.return)&&(yield at(l.call(d)))}finally{if(o)throw o.error}}})}rawListPagedIterator(e,i,r){return B(i),T({defaultLimit:15,maxLimit:50},n=>this.rawList(e,Object.assign(Object.assign({},i),{page:n})),r)}find(e,i){return this.rawFind(p(e),i).then(r=>c(r))}rawFind(e,i){return this.client.request({method:"GET",url:`/versions/${e}`,queryParams:i})}};pe.TYPE="item_version";var $s=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(l,f){o=t[s](o),n(l,f,o.done,o.value)})}}function n(s,o,l,f){Promise.resolve(f).then(function(a){s({value:a,done:l})},o)}},ut=function(t){return this instanceof ut?(this.v=t,this):new ut(t)},Ds=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||l(u,m)})})}function l(u,m){try{f(r[u](m))}catch(g){h(s[0][3],g)}}function f(u){u.value instanceof ut?Promise.resolve(u.value.v).then(a,d):h(s[0][2],u)}function a(u){l("next",u)}function d(u){l("throw",u)}function h(u,m){u(m),s.shift(),s.length&&l(s[0][0],s[0][1])}},me=class extends _{create(e){return this.rawCreate(y(e,{type:"upload",attributes:["path","copyright","author","notes","default_field_metadata","tags"],relationships:["upload_collection"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/uploads",body:e})}list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/uploads",queryParams:e})}listPagedIterator(e,i){return Ds(this,arguments,function*(){var n,s,o,l;try{for(var f=!0,a=$s(this.rawListPagedIterator(e,i)),d;d=yield ut(a.next()),n=d.done,!n;){l=d.value,f=!1;try{yield yield ut(R(l))}finally{f=!0}}}catch(h){s={error:h}}finally{try{!f&&!n&&(o=a.return)&&(yield ut(o.call(a)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),T({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/uploads/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/uploads/${e}`})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"upload",attributes:["path","basename","copyright","author","notes","tags","default_field_metadata"],relationships:["creator","upload_collection"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/uploads/${e}`,body:i})}references(e,i){return this.rawReferences(p(e),i).then(r=>c(r))}rawReferences(e,i){return this.client.request({method:"GET",url:`/uploads/${e}/references`,queryParams:i}).then(P)}bulkTag(e){return this.rawBulkTag(y(e,{type:"upload_bulk_tag_operation",attributes:["tags"],relationships:["uploads"]})).then(i=>c(i))}rawBulkTag(e){return this.client.request({method:"POST",url:"/uploads/bulk/tag",body:e})}bulkSetUploadCollection(e){return this.rawBulkSetUploadCollection(y(e,{type:"upload_bulk_set_upload_collection_operation",attributes:[],relationships:["upload_collection","uploads"]})).then(i=>c(i))}rawBulkSetUploadCollection(e){return this.client.request({method:"POST",url:"/uploads/bulk/set-upload-collection",body:e})}bulkDestroy(e){return this.rawBulkDestroy(y(e,{type:"upload_bulk_destroy_operation",attributes:[],relationships:["uploads"]})).then(i=>c(i))}rawBulkDestroy(e){return this.client.request({method:"POST",url:"/uploads/bulk/destroy",body:e})}};me.TYPE="upload";var ye=class extends _{create(e){return this.rawCreate(y(e,{type:"upload_request",attributes:["filename"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-requests",body:e})}};ye.TYPE="upload_request";var _e=class extends _{create(e,i){return this.rawCreate(p(e),y(i,{type:"upload_track",attributes:["url_or_upload_request_id","type","name","language_code","closed_captions"],relationships:[]})).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:`/uploads/${e}/tracks`,body:i})}list(e){return this.rawList(p(e)).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:`/uploads/${e}/tracks`})}destroy(e,i){return this.rawDestroy(p(e),p(i)).then(r=>c(r))}rawDestroy(e,i){return this.client.request({method:"DELETE",url:`/uploads/${e}/tracks/${i}`})}generateSubtitles(e,i){return this.rawGenerateSubtitles(p(e),y(i,{type:"upload_track",attributes:["name","language_code"],relationships:[]})).then(r=>c(r))}rawGenerateSubtitles(e,i){return this.client.request({method:"POST",url:`/uploads/${e}/tracks/generate-subtitles`,body:i})}};_e.TYPE="upload_track";var ge=class extends _{create(e,i){return this.rawCreate(p(e),y(i,{type:"scheduled_publication",attributes:["publication_scheduled_at","selective_publication"],relationships:[]})).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:`/items/${e}/scheduled-publication`,body:i})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/items/${e}/scheduled-publication`}).then(P)}};ge.TYPE="scheduled_publication";var we=class extends _{create(e,i){return this.rawCreate(p(e),y(i,{type:"scheduled_unpublishing",attributes:["unpublishing_scheduled_at","content_in_locales"],relationships:[]})).then(r=>c(r))}rawCreate(e,i){return this.client.request({method:"POST",url:`/items/${e}/scheduled-unpublishing`,body:i})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/items/${e}/scheduled-unpublishing`}).then(P)}};we.TYPE="scheduled_unpublishing";var js=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(l,f){o=t[s](o),n(l,f,o.done,o.value)})}}function n(s,o,l,f){Promise.resolve(f).then(function(a){s({value:a,done:l})},o)}},dt=function(t){return this instanceof dt?(this.v=t,this):new dt(t)},Gs=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||l(u,m)})})}function l(u,m){try{f(r[u](m))}catch(g){h(s[0][3],g)}}function f(u){u.value instanceof dt?Promise.resolve(u.value.v).then(a,d):h(s[0][2],u)}function a(u){l("next",u)}function d(u){l("throw",u)}function h(u,m){u(m),s.shift(),s.length&&l(s[0][0],s[0][1])}},be=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/search-results",queryParams:e})}listPagedIterator(e,i){return Gs(this,arguments,function*(){var n,s,o,l;try{for(var f=!0,a=js(this.rawListPagedIterator(e,i)),d;d=yield dt(a.next()),n=d.done,!n;){l=d.value,f=!1;try{yield yield dt(R(l))}finally{f=!0}}}catch(h){s={error:h}}finally{try{!f&&!n&&(o=a.return)&&(yield dt(o.call(a)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),T({defaultLimit:20,maxLimit:100},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}};be.TYPE="search_result";var ve=class extends _{fork(e,i,r){return this.rawFork(p(e),y(i,{id:p(e),type:"environment",attributes:[],relationships:[]}),r).then(n=>c(n))}rawFork(e,i,r){return this.client.request({method:"POST",url:`/environments/${e}/fork`,body:i,queryParams:r})}promote(e){return this.rawPromote(p(e)).then(i=>c(i))}rawPromote(e){return this.client.request({method:"PUT",url:`/environments/${e}/promote`})}rename(e,i){return this.rawRename(p(e),y(i,{id:p(e),type:"environment",attributes:[],relationships:[]})).then(r=>c(r))}rawRename(e,i){return this.client.request({method:"PUT",url:`/environments/${e}/rename`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/environments"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/environments/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/environments/${e}`})}};ve.TYPE="environment";var xe=class extends _{find(){return this.rawFind().then(e=>c(e))}rawFind(){return this.client.request({method:"GET",url:"/maintenance-mode"})}activate(e){return this.rawActivate(e).then(i=>c(i))}rawActivate(e){return this.client.request({method:"PUT",url:"/maintenance-mode/activate",queryParams:e})}deactivate(){return this.rawDeactivate().then(e=>c(e))}rawDeactivate(){return this.client.request({method:"PUT",url:"/maintenance-mode/deactivate"})}};xe.TYPE="maintenance_mode";var Ie=class extends _{create(e){return this.rawCreate(y(e,{type:"webhook",attributes:["name","url","custom_payload","headers","events","http_basic_user","http_basic_password","enabled","payload_api_version","nested_items_in_payload","auto_retry"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/webhooks",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"webhook",attributes:["name","url","custom_payload","headers","events","http_basic_user","http_basic_password","enabled","payload_api_version","nested_items_in_payload","auto_retry"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/webhooks/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/webhooks"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/webhooks/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/webhooks/${e}`})}};Ie.TYPE="webhook";var Ms=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(l,f){o=t[s](o),n(l,f,o.done,o.value)})}}function n(s,o,l,f){Promise.resolve(f).then(function(a){s({value:a,done:l})},o)}},ct=function(t){return this instanceof ct?(this.v=t,this):new ct(t)},Ws=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||l(u,m)})})}function l(u,m){try{f(r[u](m))}catch(g){h(s[0][3],g)}}function f(u){u.value instanceof ct?Promise.resolve(u.value.v).then(a,d):h(s[0][2],u)}function a(u){l("next",u)}function d(u){l("throw",u)}function h(u,m){u(m),s.shift(),s.length&&l(s[0][0],s[0][1])}},Ue=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/webhook_calls",queryParams:e})}listPagedIterator(e,i){return Ws(this,arguments,function*(){var n,s,o,l;try{for(var f=!0,a=Ms(this.rawListPagedIterator(e,i)),d;d=yield ct(a.next()),n=d.done,!n;){l=d.value,f=!1;try{yield yield ct(R(l))}finally{f=!0}}}catch(h){s={error:h}}finally{try{!f&&!n&&(o=a.return)&&(yield ct(o.call(a)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),T({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/webhook_calls/${e}`})}resendWebhook(e){return this.rawResendWebhook(p(e))}rawResendWebhook(e){return this.client.request({method:"POST",url:`/webhook_calls/${e}/resend_webhook`})}};Ue.TYPE="webhook_call";var Re=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/build-triggers"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/build-triggers/${e}`})}create(e){return this.rawCreate(y(e,{type:"build_trigger",attributes:["name","webhook_token","adapter","indexing_enabled","enabled","frontend_url","autotrigger_on_scheduled_publications","adapter_settings"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/build-triggers",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"build_trigger",attributes:["name","adapter","indexing_enabled","enabled","frontend_url","autotrigger_on_scheduled_publications","adapter_settings"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/build-triggers/${e}`,body:i})}trigger(e){return this.rawTrigger(p(e))}rawTrigger(e){return this.client.request({method:"POST",url:`/build-triggers/${e}/trigger`})}abort(e){return this.rawAbort(p(e))}rawAbort(e){return this.client.request({method:"DELETE",url:`/build-triggers/${e}/abort`})}abortIndexing(e){return this.rawAbortIndexing(p(e))}rawAbortIndexing(e){return this.client.request({method:"DELETE",url:`/build-triggers/${e}/abort_indexing`})}reindex(e){return this.rawReindex(p(e))}rawReindex(e){return this.client.request({method:"PUT",url:`/build-triggers/${e}/reindex`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/build-triggers/${e}`})}};Re.TYPE="build_trigger";var Te=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/search-indexes"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/search-indexes/${e}`})}create(e){return this.rawCreate(y(e,{type:"search_index",attributes:["name","enabled","frontend_url","user_agent_suffix"],relationships:["build_triggers"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/search-indexes",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"search_index",attributes:["name","enabled","frontend_url","user_agent_suffix"],relationships:["build_triggers"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/search-indexes/${e}`,body:i})}trigger(e){return this.rawTrigger(p(e))}rawTrigger(e){return this.client.request({method:"POST",url:`/search-indexes/${e}/trigger`})}abort(e){return this.rawAbort(p(e))}rawAbort(e){return this.client.request({method:"DELETE",url:`/search-indexes/${e}/abort`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/search-indexes/${e}`})}};Te.TYPE="search_index";var Be=class extends _{create(e){return this.rawCreate(y(e,{type:"item_type_filter",attributes:["name","filter","columns","order_by","shared"],relationships:["item_type"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/item-type-filters",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"item_type_filter",attributes:["name","columns","order_by","shared","filter"],relationships:["item_type"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/item-type-filters/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/item-type-filters"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/item-type-filters/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/item-type-filters/${e}`})}};Be.TYPE="item_type_filter";var Ee=class extends _{create(e){return this.rawCreate(y(e,{type:"upload_filter",attributes:["name","filter","shared"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-filters",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"upload_filter",attributes:["name","shared","filter"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/upload-filters/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/upload-filters"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/upload-filters/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/upload-filters/${e}`})}};Ee.TYPE="upload_filter";var Fe=class extends _{create(e){return this.rawCreate(y(e,{type:"site_invitation",attributes:["email"],relationships:["role"]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/site-invitations",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"site_invitation",attributes:[],relationships:["role"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/site-invitations/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/site-invitations"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/site-invitations/${e}`})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/site-invitations/${e}`})}resend(e){return this.rawResend(p(e)).then(i=>c(i))}rawResend(e){return this.client.request({method:"POST",url:`/site-invitations/${e}/resend`})}};Fe.TYPE="site_invitation";var Se=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/editing-sessions"})}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/editing-sessions/${e}`,body:i})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/editing-sessions/${e}`})}};Se.TYPE="editing_session";var Pe=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/sso-groups"})}copyRoles(e){return this.rawCopyRoles(p(e)).then(i=>c(i))}rawCopyRoles(e){return this.client.request({method:"POST",url:`/sso-groups/${e}/copy-roles`})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"sso_group",attributes:["priority"],relationships:["role"]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/sso-groups/${e}`,body:i})}destroy(e){return this.rawDestroy(p(e)).then(i=>c(i))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/sso-groups/${e}`})}};Pe.TYPE="sso_group";var ke=class extends _{find(){return this.rawFind().then(e=>c(e))}rawFind(){return this.client.request({method:"GET",url:"/sso-settings"})}generateToken(){return this.rawGenerateToken().then(e=>c(e))}rawGenerateToken(){return this.client.request({method:"PUT",url:"/sso-settings/generate-token"})}update(e){return this.rawUpdate(y(e,{type:"sso_settings",attributes:["idp_saml_metadata_url","idp_saml_metadata_xml"],relationships:["default_role"]})).then(i=>c(i))}rawUpdate(e){return this.client.request({method:"PUT",url:"/sso-settings",body:e})}};ke.TYPE="sso_settings";var ze=class extends _{find(e){return this.rawFind(e).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:"/emoji-suggestions",queryParams:e})}};ze.TYPE="emoji_suggestions";var qe=class extends _{find(){return this.rawFind().then(e=>c(e))}rawFind(){return this.client.request({method:"GET",url:"/white-label-settings"})}update(e){return this.rawUpdate(y(e,{type:"white_label_settings",attributes:["custom_i18n_messages_template_url"],relationships:[]})).then(i=>c(i))}rawUpdate(e){return this.client.request({method:"PUT",url:"/white-label-settings",body:e})}};qe.TYPE="white_label_settings";var Oe=class extends _{find(){return this.rawFind().then(e=>c(e))}rawFind(){return this.client.request({method:"GET",url:"/public-info"})}};Oe.TYPE="public_info";var Ve=class extends _{list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/daily-site-usages"})}};Ve.TYPE="daily_usage";var Le=class extends _{find(e,i){return this.rawFind(p(e),i).then(r=>c(r))}rawFind(e,i){return this.client.request({method:"GET",url:`/usage-log-counters/${e}`,queryParams:i})}};Le.TYPE="usage_counter";var Js=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(l,f){o=t[s](o),n(l,f,o.done,o.value)})}}function n(s,o,l,f){Promise.resolve(f).then(function(a){s({value:a,done:l})},o)}},ft=function(t){return this instanceof ft?(this.v=t,this):new ft(t)},Ys=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||l(u,m)})})}function l(u,m){try{f(r[u](m))}catch(g){h(s[0][3],g)}}function f(u){u.value instanceof ft?Promise.resolve(u.value.v).then(a,d):h(s[0][2],u)}function a(u){l("next",u)}function d(u){l("throw",u)}function h(u,m){u(m),s.shift(),s.length&&l(s[0][0],s[0][1])}},Ae=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/upload-tags",queryParams:e})}listPagedIterator(e,i){return Ys(this,arguments,function*(){var n,s,o,l;try{for(var f=!0,a=Js(this.rawListPagedIterator(e,i)),d;d=yield ft(a.next()),n=d.done,!n;){l=d.value,f=!1;try{yield yield ft(R(l))}finally{f=!0}}}catch(h){s={error:h}}finally{try{!f&&!n&&(o=a.return)&&(yield ft(o.call(a)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),T({defaultLimit:50,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}create(e){return this.rawCreate(y(e,{type:"upload_tag",attributes:["name"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-tags",body:e})}};Ae.TYPE="upload_tag";var Hs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(l,f){o=t[s](o),n(l,f,o.done,o.value)})}}function n(s,o,l,f){Promise.resolve(f).then(function(a){s({value:a,done:l})},o)}},ht=function(t){return this instanceof ht?(this.v=t,this):new ht(t)},Ks=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||l(u,m)})})}function l(u,m){try{f(r[u](m))}catch(g){h(s[0][3],g)}}function f(u){u.value instanceof ht?Promise.resolve(u.value.v).then(a,d):h(s[0][2],u)}function a(u){l("next",u)}function d(u){l("throw",u)}function h(u,m){u(m),s.shift(),s.length&&l(s[0][0],s[0][1])}},Ne=class extends _{list(e){return this.rawList(e).then(i=>c(i))}rawList(e){return this.client.request({method:"GET",url:"/upload-smart-tags",queryParams:e})}listPagedIterator(e,i){return Ks(this,arguments,function*(){var n,s,o,l;try{for(var f=!0,a=Hs(this.rawListPagedIterator(e,i)),d;d=yield ht(a.next()),n=d.done,!n;){l=d.value,f=!1;try{yield yield ht(R(l))}finally{f=!0}}}catch(h){s={error:h}}finally{try{!f&&!n&&(o=a.return)&&(yield ht(o.call(a)))}finally{if(s)throw s.error}}})}rawListPagedIterator(e,i){return B(e),T({defaultLimit:50,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),i)}};Ne.TYPE="upload_smart_tag";var Ce=class extends _{find(e){return this.rawFind(e).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:"/site",queryParams:e})}update(e){return this.rawUpdate(y(e,{type:"site",attributes:["no_index","favicon","global_seo","name","theme","locales","timezone","require_2fa","ip_tracking_enabled","force_use_of_sandbox_environments"],relationships:["sso_default_role"]})).then(i=>c(i))}rawUpdate(e){return this.client.request({method:"PUT",url:"/site",body:e})}activateImprovedTimezoneManagement(){return this.rawActivateImprovedTimezoneManagement().then(e=>c(e))}rawActivateImprovedTimezoneManagement(){return this.client.request({method:"PUT",url:"/site/activate-improved-timezone-management"})}activateImprovedHexManagement(){return this.rawActivateImprovedHexManagement().then(e=>c(e))}rawActivateImprovedHexManagement(){return this.client.request({method:"PUT",url:"/site/activate-improved-hex-management"})}activateImprovedGqlMultilocaleFields(){return this.rawActivateImprovedGqlMultilocaleFields().then(e=>c(e))}rawActivateImprovedGqlMultilocaleFields(){return this.client.request({method:"PUT",url:"/site/activate-improved-gql-multilocale-fields"})}activateImprovedGqlVisibilityControl(){return this.rawActivateImprovedGqlVisibilityControl().then(e=>c(e))}rawActivateImprovedGqlVisibilityControl(){return this.client.request({method:"PUT",url:"/site/activate-improved-gql-visibility-control"})}activateImprovedBooleanFields(){return this.rawActivateImprovedBooleanFields().then(e=>c(e))}rawActivateImprovedBooleanFields(){return this.client.request({method:"PUT",url:"/site/activate-improved-boolean-fields"})}activateDraftModeAsDefault(){return this.rawActivateDraftModeAsDefault().then(e=>c(e))}rawActivateDraftModeAsDefault(){return this.client.request({method:"PUT",url:"/site/activate-draft-mode-as-default"})}activateImprovedValidationAtPublishing(){return this.rawActivateImprovedValidationAtPublishing().then(e=>c(e))}rawActivateImprovedValidationAtPublishing(){return this.client.request({method:"PUT",url:"/site/activate-improved-validation-at-publishing"})}activateImprovedExposureOfInlineBlocksInCda(){return this.rawActivateImprovedExposureOfInlineBlocksInCda().then(e=>c(e))}rawActivateImprovedExposureOfInlineBlocksInCda(){return this.client.request({method:"PUT",url:"/site/activate-improved-exposure-of-inline-blocks-in-cda"})}updateAssetsCdnDefaultSettings(e){return this.rawUpdateAssetsCdnDefaultSettings(y(e,{type:"assets-cdn-default-settings",attributes:["assets_cdn_default_settings"],relationships:[]})).then(i=>c(i))}rawUpdateAssetsCdnDefaultSettings(e){return this.client.request({method:"PUT",url:"/site/assets-cdn-default-settings",body:e})}};Ce.TYPE="site";var $e=class extends _{create(e){return this.rawCreate(y(e,{type:"workflow",attributes:["name","api_key","stages"],relationships:[]})).then(i=>c(i))}rawCreate(e){return this.client.request({method:"POST",url:"/workflows",body:e})}update(e,i){return this.rawUpdate(p(e),y(i,{id:p(e),type:"workflow",attributes:["name","api_key","stages"],relationships:[]})).then(r=>c(r))}rawUpdate(e,i){return this.client.request({method:"PUT",url:`/workflows/${e}`,body:i})}list(){return this.rawList().then(e=>c(e))}rawList(){return this.client.request({method:"GET",url:"/workflows"})}find(e){return this.rawFind(p(e)).then(i=>c(i))}rawFind(e){return this.client.request({method:"GET",url:`/workflows/${e}`})}destroy(e){return this.rawDestroy(p(e))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/workflows/${e}`})}};$e.TYPE="workflow";var Xs=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(d){try{a(r.next(d))}catch(h){o(h)}}function f(d){try{a(r.throw(d))}catch(h){o(h)}}function a(d){d.done?s(d.value):n(d.value).then(l,f)}a((r=r.apply(t,e||[])).next())})},De=class{constructor(e){this.config=e,this.roles=new Je(this),this.users=new X(this),this.ssoUsers=new Q(this),this.auditLogEvents=new Z(this),this.menuItems=new ee(this),this.schemaMenuItems=new te(this),this.uploadCollections=new ie(this),this.itemTypes=new re(this),this.fields=new se(this),this.fieldsets=new ne(this),this.session=new oe(this),this.accessTokens=new le(this),this.plugins=new ae(this),this.jobResults=new ue(this),this.subscriptionLimits=new de(this),this.subscriptionFeatures=new ce(this),this.buildEvents=new fe(this),this.searchIndexEvents=new he(this),this.items=new j(this),this.itemVersions=new pe(this),this.uploads=new me(this),this.uploadRequest=new ye(this),this.uploadTracks=new _e(this),this.scheduledPublication=new ge(this),this.scheduledUnpublishing=new we(this),this.searchResults=new be(this),this.environments=new ve(this),this.maintenanceMode=new xe(this),this.webhooks=new Ie(this),this.webhookCalls=new Ue(this),this.buildTriggers=new Re(this),this.searchIndexes=new Te(this),this.itemTypeFilters=new Be(this),this.uploadFilters=new Ee(this),this.siteInvitations=new Fe(this),this.editingSessions=new Se(this),this.ssoGroups=new Pe(this),this.ssoSettings=new ke(this),this.emojiSuggestions=new ze(this),this.whiteLabelSettings=new qe(this),this.publicInfo=new Oe(this),this.dailyUsages=new Ve(this),this.usageCounters=new Le(this),this.uploadTags=new Ae(this),this.uploadSmartTags=new Ne(this),this.site=new Ce(this),this.workflows=new $e(this)}get baseUrl(){return this.config.baseUrl||De.defaultBaseUrl}request(e){return Ut(Object.assign(Object.assign(Object.assign({},this.config),e),{logFn:this.config.logFn||console.log,userAgent:"@datocms/cma-client v5.2.0-alpha.5",baseUrl:this.baseUrl,preCallStack:new Error().stack,extraHeaders:Object.assign(Object.assign(Object.assign({},this.config.extraHeaders||{}),this.config.environment?{"X-Environment":this.config.environment}:{}),{"X-API-Version":"3"}),fetchJobResult:i=>this.jobResultsFetcher?this.jobResultsFetcher(i):lr(()=>this.jobResults.find(i))}))}eventsChannelName(){return Xs(this,void 0,void 0,function*(){if(this.cachedEventsChannelName)return this.cachedEventsChannelName;let{data:e}=yield this.site.rawFind();return this.cachedEventsChannelName=this.config.environment?`private-site-${e.id}-environment-${this.config.environment}`:`private-site-${e.id}`,this.cachedEventsChannelName})}};De.defaultBaseUrl="https://site-api.datocms.com";var je=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(d){try{a(r.next(d))}catch(h){o(h)}}function f(d){try{a(r.throw(d))}catch(h){o(h)}}function a(d){d.done?s(d.value):n(d.value).then(l,f)}a((r=r.apply(t,e||[])).next())})};function Tt(t){return"attributes"in t?t.attributes.localized:t.localized}function b(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let e=Object.keys(t);if(e.length===0)return!1;let i=/^[A-Za-z]{2,4}(-[A-Za-z]{4})?(-([A-Za-z]{2}|[0-9]{3}))?$/;return e.every(r=>i.test(r))}function Y(t,e){return Tt(e)?Object.entries(t).map(([r,n])=>({locale:r,value:n})):[{locale:void 0,value:t}]}function Bt(t,e){if(Tt(e))return Object.fromEntries(t.map(({locale:i,value:r})=>[i,r]));if(t.length===0)throw new Error("There must be at least one entry!");return t[0].value}function Qs(t,e,i){let n=Y(t,e).map(({locale:s,value:o})=>({locale:s,value:i(s,o)}));return Bt(n,e)}function Zs(t,e,i){return je(this,void 0,void 0,function*(){let r=Y(t,e),n=yield Promise.all(r.map(({locale:s,value:o})=>je(this,void 0,void 0,function*(){return{locale:s,value:yield i(s,o)}})));return Bt(n,e)})}function en(t,e,i){var r;let s=Y(t,e).filter(o=>i(o.locale,o.value));return Tt(e)?Bt(s,e):s.length>0?(r=s[0])===null||r===void 0?void 0:r.value:void 0}function tn(t,e,i){var r;return je(this,void 0,void 0,function*(){let n=Y(t,e),o=(yield Promise.all(n.map(({locale:l,value:f})=>je(this,void 0,void 0,function*(){return{locale:l,value:f,passed:yield i(l,f)}})))).filter(({passed:l})=>l).map(({locale:l,value:f})=>({locale:l,value:f}));return Tt(e)?Bt(o,e):o.length>0?(r=o[0])===null||r===void 0?void 0:r.value:void 0})}function xr(t,e,i){return Y(t,e).some(({locale:n,value:s})=>i(n,s))}function Ir(t,e,i){return je(this,void 0,void 0,function*(){let r=Y(t,e);return(yield Promise.all(r.map(({locale:s,value:o})=>i(s,o)))).some(s=>s)})}function rn(t,e,i){return!xr(t,e,(r,n)=>!i(r,n))}function sn(t,e,i){return je(this,void 0,void 0,function*(){return!(yield Ir(t,e,(r,n)=>je(this,void 0,void 0,function*(){return!(yield i(r,n))})))})}function nn(t,e,i){let r=Y(t,e);for(let{locale:n,value:s}of r)i(n,s)}function on(t,e,i){return je(this,void 0,void 0,function*(){let r=Y(t,e);yield Promise.all(r.map(({locale:n,value:s})=>i(n,s)))})}function Dt(t){return typeof t=="boolean"||t===null}function ln(t){return b(t)&&Object.values(t).every(Dt)}function jt(t){return t===null?!0:typeof t=="object"&&t!==null&&"red"in t&&"green"in t&&"blue"in t&&"alpha"in t}function an(t){return b(t)&&Object.values(t).every(jt)}function Gt(t){return t===null?!0:typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t)}function un(t){return b(t)&&Object.values(t).every(Gt)}function Mt(t){return t===null?!0:typeof t=="string"&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t)}function dn(t){return b(t)&&Object.values(t).every(Mt)}function pt(t){return t===null?!0:b(t)&&"upload_id"in t&&"alt"in t&&"title"in t&&"custom_data"in t&&"focal_point"in t}function mt(t){return t===null?!0:typeof t=="object"&&t!==null&&"upload_id"in t}function cn(t){return b(t)&&Object.values(t).every(pt)}function fn(t){return b(t)&&Object.values(t).every(mt)}function Wt(t){return typeof t=="number"||t===null}function hn(t){return b(t)&&Object.values(t).every(Wt)}function Jt(t){return Array.isArray(t)&&t.every(pt)}function Yt(t){return Array.isArray(t)&&t.every(mt)}function pn(t){return b(t)&&Object.values(t).every(Jt)}function mn(t){return b(t)&&Object.values(t).every(Yt)}function Ht(t){return typeof t=="number"||t===null}function yn(t){return b(t)&&Object.values(t).every(Ht)}function Kt(t){if(t===null)return!0;if(typeof t!="string")return!1;try{return JSON.parse(t),!0}catch(e){return!1}}function _n(t){return b(t)&&Object.values(t).every(Kt)}function Xt(t){return t===null?!0:typeof t=="object"&&t!==null&&"latitude"in t&&"longitude"in t}function gn(t){return b(t)&&Object.values(t).every(Xt)}var Qt,wn=new Uint8Array(16);function Ni(){if(!Qt&&(Qt=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Qt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qt(wn)}var S=[];for(let t=0;t<256;++t)S.push((t+256).toString(16).slice(1));function Ur(t,e=0){return S[t[e+0]]+S[t[e+1]]+S[t[e+2]]+S[t[e+3]]+"-"+S[t[e+4]]+S[t[e+5]]+"-"+S[t[e+6]]+S[t[e+7]]+"-"+S[t[e+8]]+S[t[e+9]]+"-"+S[t[e+10]]+S[t[e+11]]+S[t[e+12]]+S[t[e+13]]+S[t[e+14]]+S[t[e+15]]}var bn=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ci={randomUUID:bn};function vn(t,e,i){if(Ci.randomUUID&&!e&&!t)return Ci.randomUUID();t=t||{};let r=t.random||(t.rng||Ni)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){i=i||0;for(let n=0;n<16;++n)e[i+n]=r[n];return e}return Ur(r)}var $i=vn;function xn(t){return(typeof Buffer=="undefined"?btoa(Array.from(t,i=>String.fromCharCode(i)).join("")):Buffer.from(t).toString("base64")).replace(/\+/g,"-").replace(/\//g,"_").substring(0,22)}function In(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");return typeof Buffer=="undefined"?Uint8Array.from(atob(e),i=>i.charCodeAt(0)):new Uint8Array(Buffer.from(e,"base64"))}function M(t){if(/^\d+$/.test(t))return BigInt(t)<=0xffffffffffff;let e=In(t);return!(e.length!==16||(e.at(8)&192)!==128||e.at(6)>>4!==4)}function Un(){let t=$i(null,new Uint8Array(16));return t[0]=t[0]&127,xn(t)}function Zt(t){return typeof t=="string"&&M(t)||t===null}function Rn(t){return b(t)&&Object.values(t).every(Zt)}function ei(t){return Array.isArray(t)&&t.every(e=>typeof e=="string"&&M(e))}function Tn(t){return b(t)&&Object.values(t).every(ei)}function yt(t){return typeof t=="string"}function q(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="item"&&"attributes"in t&&"relationships"in t}function _t(t){return q(t)&&"id"in t&&typeof t.id=="string"}function ti(t){return typeof t=="string"&&M(t)||t===null}function Bn(t){return b(t)&&Object.values(t).every(ti)}function ii(t){return t===null||yt(t)?!0:q(t)}function En(t){return b(t)&&Object.values(t).every(ii)}function ri(t){return t===null?!0:_t(t)}function Fn(t){return b(t)&&Object.values(t).every(ri)}function si(t){return Array.isArray(t)&&t.every(e=>typeof e=="string"&&M(e))}function Sn(t){return b(t)&&Object.values(t).every(si)}function ni(t){return t===null?!0:Array.isArray(t)?t.every(e=>yt(e)?!0:q(e)):!1}function Pn(t){return b(t)&&Object.values(t).every(ni)}function oi(t){return Array.isArray(t)?t.every(e=>_t(e)):!1}function kn(t){return b(t)&&Object.values(t).every(oi)}function li(t){return t===null?!0:typeof t=="object"&&t!==null&&("title"in t||"description"in t||"image"in t||"twitter_card"in t||"no_index"in t)}function zn(t){return b(t)&&Object.values(t).every(li)}function ai(t){return t===null?!0:typeof t=="string"}function qn(t){return b(t)&&Object.values(t).every(ai)}function ui(t){return typeof t=="string"||t===null}function On(t){return b(t)&&Object.values(t).every(ui)}var k,z,di="blockquote",Et="block",hi="inlineBlock",Ft="code",St="heading",Di="inlineItem",pi="itemLink",mi="link",ci="listItem",gt="list",Ye="paragraph",ji="root",yi="span",fi="thematicBreak";var _c=(k={},k[di]=[Ye],k[Et]=[],k[hi]=[],k[Ft]=[],k[St]="inlineNodes",k[Di]=[],k[pi]="inlineNodes",k[mi]="inlineNodes",k[ci]=[Ye,gt],k[gt]=[ci],k[Ye]="inlineNodes",k[ji]=[di,Ft,gt,Ye,St,Et,fi],k[yi]=[],k[fi]=[],k);var gc=(z={},z[di]=["children","attribution"],z[Et]=["item"],z[hi]=["item"],z[Ft]=["language","highlight","code"],z[St]=["level","children","style"],z[Di]=["item"],z[pi]=["item","children","meta"],z[mi]=["url","children","meta"],z[ci]=["children"],z[gt]=["style","children"],z[Ye]=["children","style"],z[ji]=["children"],z[yi]=["value","marks"],z[fi]=[],z);function Rr(t){return"children"in t}function Tr(t){return t.type===St}function Br(t){return t.type===yi}function Er(t){return t.type===Ye}function Fr(t){return t.type===gt}function Pt(t){return t.type===Et}function kt(t){return t.type===hi}function Sr(t){return t.type===Ft}function Pr(t){return t.type===mi}function kr(t){return t.type===pi}function Vn(t){return Boolean(typeof t=="object"&&t)}function wt(t){return Boolean(Vn(t)&&"schema"in t&&"document"in t&&t.schema==="dast")}var Ln=function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;for(var r=Array(t),n=0,e=0;e<i;e++)for(var s=arguments[e],o=0,l=s.length;o<l;o++,n++)r[n]=s[o];return r},An={MAX_WIDTH:80};function Nn(t){return Rr(t)}function Cn(t){return"(item: "+JSON.stringify(t)+")"}function $n(t){return wt(t)?t.document:t}function qr(t,e){e===void 0&&(e={});var i=$n(t),r=Or(i,e);return r.nodes&&r.nodes.length>0?r.nodes.length===1?r.nodes[0]:{label:"",nodes:r.nodes}:{label:""}}function Or(t,e){var i,r,n=(r=e.maxWidth)!==null&&r!==void 0?r:An.MAX_WIDTH,s=Math.max(20,n-8),o=Dn(t,e,s),l={label:o};if(Nn(t)){var f=t.children;if(f.length>0){l.nodes=[];for(var a=0,d=f;a<d.length;a++){var h=d[a];l.nodes.push(Or(h,e))}}}if((Pt(t)||kt(t))&&e.blockFormatter){var u=e.blockFormatter(t.item,s);typeof u!="string"&&(l.nodes||(l.nodes=[]),Array.isArray(u)?(i=l.nodes).push.apply(i,u):l.nodes.push(u))}return l}function Dn(t,e,i){var r=[],n="";if(Br(t))t.marks&&t.marks.length>0&&r.push("marks: "+t.marks.join(", ")),n=' "'+zr(t.value,i)+'"';else if(Sr(t))t.language&&r.push('language: "'+t.language+'"'),n=' "'+zr(t.code,i)+'"';else if(Tr(t))r.push("level: "+t.level);else if(Fr(t))r.push("style: "+t.style);else if(Pr(t)){if(r.push('url: "'+t.url+'"'),t.meta&&t.meta.length>0){var s=t.meta.map(function(d){return d.id+'="'+d.value+'"'}).join(", ");r.push("meta: {"+s+"}")}}else if(kr(t)){if(r.push('item: "'+t.item+'"'),t.meta&&t.meta.length>0){var s=t.meta.map(function(h){return h.id+'="'+h.value+'"'}).join(", ");r.push("meta: {"+s+"}")}}else if(Pt(t)||kt(t)){var o=e.blockFormatter||Cn,l=o(t.item,i);if(typeof l=="string"){var f=l.replace(/\n/g," ").trim();n=" "+f}}else Er(t)&&t.style&&r.push('style: "'+t.style+'"');var a=r.length>0?" ("+r.join(", ")+")":"";return""+t.type+a+n}function zr(t,e){return t.length<=e?t:t.substring(0,e-3)+"..."}function Vr(t){var e=typeof t=="string"?{label:t}:t,i=[];function r(n,s,o){var l=n.label.trim(),f=n.nodes||[];if(!l&&f.length>0){f.forEach(function(g,v){var F=v===f.length-1;r(g,s,F)});return}var a=s.map(function(g){return g?"\u2502 ":" "}).join(""),d=o?"\u2514":"\u251C",h=l.split(`
|
|
8
|
+
`);i.push(""+a+d+" "+h[0]);for(var u=a+(o?" ":"\u2502 "),m=1;m<h.length;m++)i.push(""+u+h[m]);f.forEach(function(g,v){var F=v===f.length-1;r(g,Ln(s,[!o]),F)})}return r(e,[],!0),i.join(`
|
|
9
9
|
`)+`
|
|
10
|
-
`}var bt=function(){return bt=Object.assign||function(t){for(var e,i=1,r=arguments.length;i<r;i++){e=arguments[i];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},bt.apply(this,arguments)},He=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(d){try{l(r.next(d))}catch(p){o(p)}}function f(d){try{l(r.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):n(d.value).then(a,f)}l((r=r.apply(t,e||[])).next())})},Ke=function(t,e){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,n,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return f([l,d])}}function f(l){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(s=i.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){i.label=l[1];break}if(l[0]===6&&i.label<s[1]){i.label=s[1],s=l;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(l);break}s[2]&&i.ops.pop(),i.trys.pop();continue}l=e.call(t,i)}catch(d){l=[6,d],n=0}finally{r=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},yi=function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;for(var r=Array(t),n=0,e=0;e<i;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)r[n]=s[o];return r};function ji(t){return typeof t=="object"&&t!==null&&"schema"in t&&t.schema==="dast"&&"document"in t}function Xe(t){return ji(t)?t.document:t}function _i(t){return typeof t=="object"&&t!==null&&"children"in t&&Array.isArray(t.children)}function Vr(t,e,i,r){return i===void 0&&(i=null),r===void 0&&(r=[]),He(this,void 0,void 0,function(){var n,s,o;return Ke(this,function(a){switch(a.label){case 0:return n=Xe(t),[4,e(n,i,r)];case 1:if(a.sent(),!_i(n))return[3,5];s=0,a.label=2;case 2:return s<n.children.length?(o=n.children[s],[4,Vr(o,e,n,yi(r,["children",s]))]):[3,5];case 3:a.sent(),a.label=4;case 4:return s++,[3,2];case 5:return[2]}})})}function Gi(t,e,i,r){return i===void 0&&(i=null),r===void 0&&(r=[]),He(this,void 0,void 0,function(){var n,s,o,a,f=this;return Ke(this,function(l){switch(l.label){case 0:return n=Xe(t),[4,e(n,i,r)];case 1:return s=l.sent(),_i(n)&&typeof s=="object"&&s!==null?[4,Promise.all(n.children.map(function(d,p){return He(f,void 0,void 0,function(){var u;return Ke(this,function(m){switch(m.label){case 0:return u=Xe,[4,Gi(d,e,n,yi(r,["children",p]))];case 1:return[2,u.apply(void 0,[m.sent()])]}})})}))]:[3,3];case 2:return a=l.sent(),o=bt(bt({},s),{children:a}),[3,4];case 3:o=s,l.label=4;case 4:return ji(t)?[2,{schema:"dast",document:o}]:[2,o]}})})}function Lr(t,e,i,r){return i===void 0&&(i=null),r===void 0&&(r=[]),He(this,void 0,void 0,function(){var n,s=this;return Ke(this,function(o){switch(o.label){case 0:return n=[],[4,Vr(t,function(a,f,l){return He(s,void 0,void 0,function(){return Ke(this,function(d){switch(d.label){case 0:return[4,e(a,f,l)];case 1:return d.sent()&&n.push({node:a,path:l}),[2]}})})},i,r)];case 1:return o.sent(),[2,n]}})})}function Mi(t,e,i,r){return i===void 0&&(i=null),r===void 0&&(r=[]),He(this,void 0,void 0,function(){var n,s,o,a,f=this;return Ke(this,function(l){switch(l.label){case 0:return n=Xe(t),[4,e(n,i,r)];case 1:return l.sent()?_i(n)?[3,2]:(s=n,[3,4]):[2,null];case 2:return[4,Promise.all(n.children.map(function(d,p){return He(f,void 0,void 0,function(){var u;return Ke(this,function(m){switch(m.label){case 0:return[4,Mi(d,e,n,yi(r,["children",p]))];case 1:return u=m.sent(),[2,u?Xe(u):null]}})})}))];case 3:o=l.sent(),a=o.filter(function(d){return d!==null}),s=bt(bt({},n),{children:a}),l.label=4;case 4:return ji(t)?[2,{schema:"dast",document:s}]:[2,s]}})})}function Ar(t,e,i,r){i===void 0&&(i=null),r===void 0&&(r=[]);var n=Xe(t);if(e(n,i,r))return!0;if(_i(n))for(var s=0;s<n.children.length;s++){var o=n.children[s];if(Ar(o,e,n,yi(r,["children",s])))return!0}return!1}function Nr(t,e,i,r){i===void 0&&(i=null),r===void 0&&(r=[]);var n=Xe(t);return!Ar(n,function(s,o,a){return!e(s,o,a)},i,r)}function Wi(t,e){return Nr(t,i=>Pt(i)||zt(i)?e(i):!0)}function gi(t){return t===null?!0:wt(t)?Wi(t.document,e=>typeof e.item=="string"&&M(e.item)):!1}function Dn(t){return b(t)&&Object.values(t).every(gi)}function wi(t){return t===null?!0:wt(t)?Wi(t.document,e=>{let i=e.item;return yt(i)?!0:q(i)}):!1}function jn(t){return b(t)&&Object.values(t).every(wi)}function bi(t){return t===null?!0:wt(t)?Wi(t.document,e=>{let i=e.item;return _t(i)}):!1}function Gn(t){return b(t)&&Object.values(t).every(bi)}function vi(t){return typeof t=="string"||t===null}function Mn(t){return b(t)&&Object.values(t).every(vi)}function xi(t){return t===null?!0:typeof t=="object"&&t!==null&&"provider"in t&&"provider_uid"in t&&"url"in t}function Wn(t){return b(t)&&Object.values(t).every(xi)}function Jn(t){return y(t,{type:j.TYPE,attributes:"*",relationships:["item_type"]}).data}var H=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(d){try{l(r.next(d))}catch(p){o(p)}}function f(d){try{l(r.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):n(d.value).then(a,f)}l((r=r.apply(t,e||[])).next())})},J=function(t){return this instanceof J?(this.v=t,this):new J(t)},Yn=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||a(u,m)})})}function a(u,m){try{f(r[u](m))}catch(g){p(s[0][3],g)}}function f(u){u.value instanceof J?Promise.resolve(u.value.v).then(l,d):p(s[0][2],u)}function l(u){a("next",u)}function d(u){a("throw",u)}function p(u,m){u(m),s.shift(),s.length&&a(s[0][0],s[0][1])}},vt=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),n(a,f,o.done,o.value)})}}function n(s,o,a,f){Promise.resolve(f).then(function(l){s({value:l,done:a})},o)}};function xt(t,e){return Yn(this,arguments,function*(){if(t==="rich_text"){let r=e;if(r)for(let n=0;n<r.length;n++){let s=r[n];yield yield J({item:s,path:[n]})}return yield J(void 0)}if(t==="single_block"){let r=e;return r&&(yield yield J({item:r,path:[]})),yield J(void 0)}if(t==="structured_text"){let r=e;if(r){let n=yield J(Lr(r.document,s=>H(this,void 0,void 0,function*(){return s.type==="block"||s.type==="inlineBlock"})));for(let{node:s,path:o}of n)(s.type==="block"||s.type==="inlineBlock")&&(yield yield J({item:s.item,path:o}))}return yield J(void 0)}})}function kt(t,e,i){var r,n,s,o;return H(this,void 0,void 0,function*(){try{for(var a=!0,f=vt(xt(t,e)),l;l=yield f.next(),r=l.done,!r;){o=l.value,a=!1;try{let{item:d,path:p}=o;yield i(d,p)}finally{a=!0}}}catch(d){n={error:d}}finally{try{!a&&!r&&(s=f.return)&&(yield s.call(f))}finally{if(n)throw n.error}}})}function Ji(t,e,i){return H(this,void 0,void 0,function*(){if(t==="rich_text"){let r=e;return r&&(yield Promise.all(r.map((n,s)=>i(n,[s]))))}if(t==="single_block"){let r=e;return r?yield i(r,[]):null}if(t==="structured_text"){let r=e;return r?{schema:"dast",document:yield Gi(r.document,(n,s,o)=>H(this,void 0,void 0,function*(){return n.type==="block"||n.type==="inlineBlock"?Object.assign(Object.assign({},n),{item:yield i(n.item,o)}):n}))}:null}return e})}function Cr(t,e,i){var r,n,s,o;return H(this,void 0,void 0,function*(){let a=[];try{for(var f=!0,l=vt(xt(t,e)),d;d=yield l.next(),r=d.done,!r;){o=d.value,f=!1;try{let{item:p,path:u}=o;(yield i(p,u))&&a.push({item:p,path:u})}finally{f=!0}}}catch(p){n={error:p}}finally{try{!f&&!r&&(s=l.return)&&(yield s.call(l))}finally{if(n)throw n.error}}return a})}function $r(t,e,i){var r,n,s,o,a,f,l,d;return H(this,void 0,void 0,function*(){if(t==="rich_text"){let U=[];try{for(var p=!0,u=vt(xt(t,e)),m;m=yield u.next(),r=m.done,!r;){o=m.value,p=!1;try{let{item:A,path:K}=o;(yield i(A,K))&&U.push(A)}finally{p=!0}}}catch(A){n={error:A}}finally{try{!p&&!r&&(s=u.return)&&(yield s.call(u))}finally{if(n)throw n.error}}return U}if(t==="single_block"){try{for(var g=!0,v=vt(xt(t,e)),F;F=yield v.next(),a=F.done,!a;){d=F.value,g=!1;try{let{item:U,path:A}=d;if(yield i(U,A))return U}finally{g=!0}}}catch(U){f={error:U}}finally{try{!g&&!a&&(l=v.return)&&(yield l.call(v))}finally{if(f)throw f.error}}return null}if(t==="structured_text"){let U=e;if(!U)return null;let A=yield Mi(U.document,(K,Ge,Lt)=>H(this,void 0,void 0,function*(){return K.type==="block"||K.type==="inlineBlock"?yield i(K.item,Lt):!0}));return A?{schema:"dast",document:A}:null}return e})}function Dr(t,e,i,r){var n,s,o,a;return H(this,void 0,void 0,function*(){let f=r;try{for(var l=!0,d=vt(xt(t,e)),p;p=yield d.next(),n=p.done,!n;){a=p.value,l=!1;try{let{item:u,path:m}=a;f=yield i(f,u,m)}finally{l=!0}}}catch(u){s={error:u}}finally{try{!l&&!n&&(o=d.return)&&(yield o.call(d))}finally{if(s)throw s.error}}return f})}function jr(t,e,i){var r,n,s,o;return H(this,void 0,void 0,function*(){try{for(var a=!0,f=vt(xt(t,e)),l;l=yield f.next(),r=l.done,!r;){o=l.value,a=!1;try{let{item:d,path:p}=o;if(yield i(d,p))return!0}finally{a=!0}}}catch(d){n={error:d}}finally{try{!a&&!r&&(s=f.return)&&(yield s.call(f))}finally{if(n)throw n.error}}return!1})}var E=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(d){try{l(r.next(d))}catch(p){o(p)}}function f(d){try{l(r.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):n(d.value).then(a,f)}l((r=r.apply(t,e||[])).next())})};function Gr(t,e,i,r,n=[]){return E(this,void 0,void 0,function*(){yield kt(e,t,(s,o)=>E(this,void 0,void 0,function*(){if(yield r(s,[...n,...o]),!q(s))return;let a=yield i.getRawItemTypeById(s.relationships.item_type.data.id),f=yield i.getRawItemTypeFields(a);for(let l of f)yield Gr(s.attributes[l.attributes.api_key],l.attributes.field_type,i,r,[...n,...o,"attributes",l.attributes.api_key])}))})}function Mr(t,e,i,r,n=[]){return E(this,void 0,void 0,function*(){let s=[],o=yield Cr(e,t,(a,f)=>E(this,void 0,void 0,function*(){return yield r(a,[...n,...f])}));return s.push(...o.map(({item:a,path:f})=>({item:a,path:[...n,...f]}))),yield kt(e,t,(a,f)=>E(this,void 0,void 0,function*(){if(!q(a))return;let l=yield i.getRawItemTypeById(a.relationships.item_type.data.id),d=yield i.getRawItemTypeFields(l);for(let p of d){let u=yield Mr(a.attributes[p.attributes.api_key],p.attributes.field_type,i,r,[...n,...f,"attributes",p.attributes.api_key]);s.push(...u)}})),s})}function Yi(t,e,i,r,n={},s=[]){return E(this,void 0,void 0,function*(){let{traversalDirection:o="top-down"}=n,f=yield Ji(e,t,(l,d)=>E(this,void 0,void 0,function*(){let p=[...s,...d];if(!q(l))return l;let u=yield i.getRawItemTypeById(l.relationships.item_type.data.id),m=yield i.getRawItemTypeFields(u);if(o==="top-down"){let v=Object.assign(Object.assign({},l),{attributes:Object.assign({},l.attributes)});for(let F of m)v.attributes[F.attributes.api_key]=yield Yi(v.attributes[F.attributes.api_key],F.attributes.field_type,i,r,n,[...p,"attributes",F.attributes.api_key]);return v}let g=Object.assign(Object.assign({},l),{attributes:Object.assign({},l.attributes)});for(let v of m)g.attributes[v.attributes.api_key]=yield Yi(g.attributes[v.attributes.api_key],v.attributes.field_type,i,r,n,[...p,"attributes",v.attributes.api_key]);return g}));return $r(e,f,(l,d)=>E(this,void 0,void 0,function*(){let p=[...s,...d];return yield r(l,p)}))})}function Wr(t,e,i,r,n,s=[]){return E(this,void 0,void 0,function*(){let o=yield Dr(e,t,(a,f,l)=>E(this,void 0,void 0,function*(){return yield r(a,f,[...s,...l])}),n);return yield kt(e,t,(a,f)=>E(this,void 0,void 0,function*(){if(!q(a))return;let l=yield i.getRawItemTypeById(a.relationships.item_type.data.id),d=yield i.getRawItemTypeFields(l);for(let p of d)o=yield Wr(a.attributes[p.attributes.api_key],p.attributes.field_type,i,r,o,[...s,...f,"attributes",p.attributes.api_key])})),o})}function Hi(t,e,i,r,n=[]){return E(this,void 0,void 0,function*(){if(yield jr(e,t,(a,f)=>E(this,void 0,void 0,function*(){return yield r(a,[...n,...f])})))return!0;let o=!1;return yield kt(e,t,(a,f)=>E(this,void 0,void 0,function*(){if(o||!q(a))return;let l=yield i.getRawItemTypeById(a.relationships.item_type.data.id),d=yield i.getRawItemTypeFields(l);for(let p of d){if(o)break;(yield Hi(a.attributes[p.attributes.api_key],p.attributes.field_type,i,r,[...n,...f,"attributes",p.attributes.api_key]))&&(o=!0)}})),o})}function Hn(t,e,i,r,n=[]){return E(this,void 0,void 0,function*(){return!(yield Hi(t,e,i,(s,o)=>E(this,void 0,void 0,function*(){return!(yield r(s,o))}),n))})}function qt(t,e,i,r,n={},s=[]){return E(this,void 0,void 0,function*(){let{traversalDirection:o="top-down"}=n;return Ji(e,t,(a,f)=>E(this,void 0,void 0,function*(){let l=[...s,...f];if(!q(a))return yield r(a,l);let d=yield i.getRawItemTypeById(a.relationships.item_type.data.id),p=yield i.getRawItemTypeFields(d);if(o==="top-down"){let m=yield r(a,l);if(!q(m))return m;for(let g of p)m.attributes[g.attributes.api_key]=yield qt(m.attributes[g.attributes.api_key],g.attributes.field_type,i,r,n,[...l,"attributes",g.attributes.api_key]);return m}let u=Object.assign({},a);for(let m of p)u.attributes[m.attributes.api_key]=yield qt(u.attributes[m.attributes.api_key],m.attributes.field_type,i,r,n,[...l,"attributes",m.attributes.api_key]);return yield r(u,l)}))})}var Kn=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(d){try{l(r.next(d))}catch(p){o(p)}}function f(d){try{l(r.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):n(d.value).then(a,f)}l((r=r.apply(t,e||[])).next())})},Jr=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]]);return i};function Xn(t,e){return Kn(this,void 0,void 0,function*(){let{__itemTypeId:i,type:r,attributes:n,relationships:s}=t,o=yield e.getRawItemTypeById(t.relationships.item_type.data.id),a={__itemTypeId:i,type:r,relationships:s,attributes:n},f=yield e.getRawItemTypeFields(o);for(let l of f)a.attributes[l.attributes.api_key]=yield qt(a.attributes[l.attributes.api_key],l.attributes.field_type,e,(d,p)=>{if(typeof d=="string")throw new Error(`Block cannot be duplicated as it contains nested block at ${p.join(".")} that is expressed as ID (${d}) instead of full object!`);if("id"in d){let{id:g,meta:v}=d;return Jr(d,["id","meta"])}let{meta:u}=d;return Jr(d,["meta"])});return a})}function Qn(t){let e="attributes"in t?t.attributes:t;switch(e.field_type){case"link":return e.validators.item_item_type.item_types;case"links":return e.validators.items_item_type.item_types;case"structured_text":return e.validators.structured_text_links.item_types;default:return[]}}function Ki(t){let e="attributes"in t?t.attributes:t;switch(e.field_type){case"single_block":return e.validators.single_block_blocks.item_types;case"rich_text":return e.validators.rich_text_blocks.item_types;case"structured_text":return[...e.validators.structured_text_blocks.item_types,...e.validators.structured_text_inline_blocks?e.validators.structured_text_inline_blocks.item_types:[]];default:return[]}}var Zn=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]]);return i},Yr=[{guard:$t,inspect:so},{guard:Mt,inspect:lo},{guard:Yt,inspect:uo},{guard:Dt,inspect:no},{guard:jt,inspect:oo},{guard:Gt,inspect:ao},{guard:Wt,inspect:Kr},{guard:Jt,inspect:Kr},{guard:ht,inspect:Hr},{guard:mt,inspect:Hr},{guard:Ht,inspect:co},{guard:ai,inspect:yo},{guard:li,inspect:_o},{guard:vi,inspect:go},{guard:Kt,inspect:fo},{guard:Qt,inspect:po},{guard:Zt,inspect:ho},{guard:oi,inspect:mo},{guard:xi,inspect:wo},{guard:gi,inspect:Xi},{guard:wi,inspect:Xi},{guard:bi,inspect:Xi},{guard:ei,inspect:Ii},{guard:ti,inspect:Ii},{guard:ii,inspect:Ii},{guard:ri,inspect:Qi},{guard:si,inspect:Qi},{guard:ni,inspect:Qi}];function eo(t,e){return typeof e=="string"?{label:`${t}: ${e}`}:Array.isArray(e)?{label:t,nodes:e}:{label:t,nodes:[e]}}function to(t,e){if(b(t)){for(let i of Yr)if(Object.values(t).every(r=>i.guard(r)))return Object.entries(t).sort(([n],[s])=>n.localeCompare(s)).map(([n,s])=>{let o=i.inspect(s,e);return typeof o=="string"?{label:`${n}: ${o}`}:Array.isArray(o)?{label:n,nodes:o}:{label:n,nodes:[o]}})}for(let i of Yr)if(i.guard(t))return i.inspect(t,e);return`UNKNOWN: ${JSON.stringify(t)}`}function io(t){if("attributes"in t)return t;let{__itemTypeId:e}=t,i=Zn(t,["__itemTypeId"]);return y(i,{type:j.TYPE,attributes:"*",relationships:["item_type","creator"]}).data}function ro(t,e){return Or(Zi(t,e))}function Zi(t,e){var i,r;let n,s=io(t);if("relationships"in s&&s.relationships){let f=s.relationships;!((r=(i=f.item_type)===null||i===void 0?void 0:i.data)===null||r===void 0)&&r.id&&(n=f.item_type.data.id)}let o=["Item","id"in t?JSON.stringify(s.id):null,n?`(item_type: ${JSON.stringify(n)})`:null].filter(Boolean).join(" "),a=[];if("attributes"in s)for(let[f,l]of Object.entries(s.attributes)){let d=to(l,e);a.push(eo(f,d))}return{label:o,nodes:a.length>0?a:void 0}}function Xi(t,e){return t===null?"null":kr(t,{maxWidth:(e==null?void 0:e.maxWidth)||80,blockFormatter:(i,r)=>typeof i=="string"?JSON.stringify(i):Zi(i,e)})}function Ii(t,e){return t===null?"null":typeof t=="string"?JSON.stringify(t):Zi(t,e)}function Qi(t,e){return t===null?"null":t.map((i,r)=>{let n=Ii(i,e);return typeof n=="string"?{label:`[${r}] ${n}`}:(n.label=`[${r}] ${n.label}`,n)})}function so(t){return JSON.stringify(t)}function no(t){if(t===null)return"null";let{red:e,green:i,blue:r,alpha:n}=t,s=`#${e.toString(16).padStart(2,"0").toUpperCase()}${i.toString(16).padStart(2,"0").toUpperCase()}${r.toString(16).padStart(2,"0").toUpperCase()}`;if(n===255)return s;let o=Math.round(n/255*100);return`${s} ${o}%`}function oo(t){return t===null?"null":t}function ao(t){return t===null?"null":t}function Hr(t,e){if(t===null)return"null";let i=[];if(i.push({label:`upload_id: ${JSON.stringify(t.upload_id)}`}),t.alt&&i.push({label:`alt: ${JSON.stringify($(t.alt,(e==null?void 0:e.maxWidth)||80))}`}),t.title&&i.push({label:`title: ${JSON.stringify($(t.title,(e==null?void 0:e.maxWidth)||80))}`}),t.custom_data&&Object.keys(t.custom_data).length>0&&i.push({label:`custom_data: ${$(JSON.stringify(t.custom_data),(e==null?void 0:e.maxWidth)||80)}`}),t.focal_point){let r=t.focal_point.x*100,n=t.focal_point.y*100;i.push({label:`focal_point: x=${r}% y=${n}%`})}return i}function lo(t){return t===null?"null":t.toString()}function Kr(t,e){return!t||t.length===0?"[]":t.map((r,n)=>{let s=[];if(s.push({label:`upload_id: ${JSON.stringify(r.upload_id)}`}),r.alt&&s.push({label:`alt: ${JSON.stringify($(r.alt,(e==null?void 0:e.maxWidth)||80))}`}),r.title&&s.push({label:`title: ${JSON.stringify($(r.title,(e==null?void 0:e.maxWidth)||80))}`}),r.custom_data&&Object.keys(r.custom_data).length>0&&s.push({label:`custom_data: ${$(JSON.stringify(r.custom_data),(e==null?void 0:e.maxWidth)||80)}`}),r.focal_point){let o=r.focal_point.x*100,a=r.focal_point.y*100;s.push({label:`focal_point: x=${o}% y=${a}%`})}return{label:`[${n}]`,nodes:s}})}function uo(t){return t===null?"null":t.toString()}function co(t,e){return t===null?"null":$(JSON.stringify(JSON.parse(t)),(e==null?void 0:e.maxWidth)||80)}function fo(t){return t===null?"null":[{label:`latitude: ${t.latitude}`},{label:`longitude: ${t.longitude}`}]}function po(t){return t===null?"null":JSON.stringify(t)}function ho(t){return t===null?"null":t.map((e,i)=>({label:`[${i}]: ${JSON.stringify(e)}`}))}function mo(t,e){if(t===null)return"null";let i=[];return t.title&&i.push({label:`title: ${JSON.stringify($(t.title,(e==null?void 0:e.maxWidth)||80))}`}),t.description&&i.push({label:`description: ${JSON.stringify($(t.description,(e==null?void 0:e.maxWidth)||80))}`}),t.image&&i.push({label:`image: ${t.image}`}),t.twitter_card&&i.push({label:`twitter_card: ${t.twitter_card}`}),t.no_index!==void 0&&i.push({label:`no_index: ${t.no_index}`}),i}function yo(t,e){return t===null?"null":JSON.stringify($(t,(e==null?void 0:e.maxWidth)||80))}function _o(t,e){return t===null?"null":JSON.stringify($(t,(e==null?void 0:e.maxWidth)||80))}function go(t,e){return t===null?"null":JSON.stringify($(t,(e==null?void 0:e.maxWidth)||80))}function wo(t,e){if(t===null)return"null";let i=[];return i.push({label:`provider: ${t.provider}`}),i.push({label:`provider_uid: ${t.provider_uid}`}),i.push({label:`url: ${t.url}`}),i.push({label:`size: ${t.width}\u2A2F${t.height}px`}),i.push({label:`thumbnail_url: ${t.thumbnail_url}`}),t.title&&i.push({label:`title: ${JSON.stringify($(t.title,(e==null?void 0:e.maxWidth)||80))}`}),i}function $(t,e){return t.length<=e?t:`${t.slice(0,e-3)}...`}var I=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(d){try{l(r.next(d))}catch(p){o(p)}}function f(d){try{l(r.throw(d))}catch(p){o(p)}}function l(d){d.done?s(d.value):n(d.value).then(a,f)}l((r=r.apply(t,e||[])).next())})},er=class{constructor(e){this.itemTypesPromise=null,this.itemTypesByApiKey=new Map,this.itemTypesById=new Map,this.fieldsByItemType=new Map,this.fieldsetsByItemType=new Map,this.pluginsPromise=null,this.pluginsById=new Map,this.pluginsByPackageName=new Map,this.prefetchPromise=null,this.client=e}loadItemTypes(){return I(this,void 0,void 0,function*(){return this.itemTypesPromise||(this.itemTypesPromise=(()=>I(this,void 0,void 0,function*(){let{data:e}=yield this.client.itemTypes.rawList();for(let i of e)this.itemTypesByApiKey.set(i.attributes.api_key,i),this.itemTypesById.set(i.id,i);return e}))()),this.itemTypesPromise})}getAllItemTypes(){return I(this,void 0,void 0,function*(){let e=yield this.getAllRawItemTypes();return c({data:e})})}getAllRawItemTypes(){return I(this,void 0,void 0,function*(){return yield this.loadItemTypes()})}getAllModels(){return I(this,void 0,void 0,function*(){let e=yield this.getAllRawModels();return c({data:e})})}getAllRawModels(){return I(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(i=>!i.attributes.modular_block)})}getAllBlockModels(){return I(this,void 0,void 0,function*(){let e=yield this.getAllRawBlockModels();return c({data:e})})}getAllRawBlockModels(){return I(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(i=>i.attributes.modular_block)})}getItemTypeByApiKey(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawItemTypeByApiKey(e);return c({data:i})})}getRawItemTypeByApiKey(e){return I(this,void 0,void 0,function*(){yield this.loadItemTypes();let i=this.itemTypesByApiKey.get(e);if(!i)throw new Error(`Item type with API key '${e}' not found`);return i})}getItemTypeById(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawItemTypeById(e);return c({data:i})})}getRawItemTypeById(e){return I(this,void 0,void 0,function*(){yield this.loadItemTypes();let i=this.itemTypesById.get(e);if(!i)throw new Error(`Item type with ID '${e}' not found`);return i})}getItemTypeFields(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawItemTypeFields(e);return c({data:i})})}getRawItemTypeFields(e){return I(this,void 0,void 0,function*(){let i=this.fieldsByItemType.get(e.id);if(i)return i;let{data:r}=yield this.client.fields.rawList(e.id);return this.fieldsByItemType.set(e.id,r),r})}getItemTypeFieldsets(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawItemTypeFieldsets(e);return c({data:i})})}getRawItemTypeFieldsets(e){return I(this,void 0,void 0,function*(){let i=this.fieldsetsByItemType.get(e.id);if(i)return i;let{data:r}=yield this.client.fieldsets.rawList(e.id);return this.fieldsetsByItemType.set(e.id,r),r})}loadPlugins(){return I(this,void 0,void 0,function*(){return this.pluginsPromise||(this.pluginsPromise=(()=>I(this,void 0,void 0,function*(){let{data:e}=yield this.client.plugins.rawList();for(let i of e)this.pluginsById.set(i.id,i),i.attributes.package_name&&this.pluginsByPackageName.set(i.attributes.package_name,i);return e}))()),this.pluginsPromise})}getAllPlugins(){return I(this,void 0,void 0,function*(){let e=yield this.getAllRawPlugins();return c({data:e})})}getAllRawPlugins(){return I(this,void 0,void 0,function*(){return yield this.loadPlugins()})}getPluginById(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawPluginById(e);return c({data:i})})}getRawPluginById(e){return I(this,void 0,void 0,function*(){yield this.loadPlugins();let i=this.pluginsById.get(e);if(!i)throw new Error(`Plugin with ID '${e}' not found`);return i})}getPluginByPackageName(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawPluginByPackageName(e);return c({data:i})})}getRawPluginByPackageName(e){return I(this,void 0,void 0,function*(){yield this.loadPlugins();let i=this.pluginsByPackageName.get(e);if(!i)throw new Error(`Plugin with package name '${e}' not found`);return i})}prefetchAllModelsAndFields(){return I(this,void 0,void 0,function*(){if(this.prefetchPromise)return this.prefetchPromise;let e=()=>I(this,void 0,void 0,function*(){let{included:i}=yield this.client.site.rawFind({include:"item_types,item_types.fields"});if(!i)throw new Error("This should not happen");let r=i.filter(o=>o.type==="item_type"),n=i.filter(o=>o.type==="field");this.itemTypesPromise=Promise.resolve(r);for(let o of r)this.itemTypesByApiKey.set(o.attributes.api_key,o),this.itemTypesById.set(o.id,o);let s=new Map;for(let o of n){let a=o.relationships.item_type.data.id;s.has(a)||s.set(a,[]),s.get(a).push(o)}for(let[o,a]of s)this.fieldsByItemType.set(o,a)});return this.prefetchPromise=e(),this.prefetchPromise})}getRawModelsEmbeddingBlocks(e){return I(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();let i=yield this.getAllRawItemTypes(),r=new Set(e.map(o=>o.id)),n=[],s=(o,a=new Set)=>I(this,void 0,void 0,function*(){if(a.has(o.id))return!1;a.add(o.id);let f=yield this.getRawItemTypeFields(o);for(let l of f){let d=Ki(l);if(d.some(u=>r.has(u)))return!0;let p=d.map(u=>i.find(m=>m.id===u));for(let u of p)if(yield s(u,new Set(a)))return!0}return!1});for(let o of i)(yield s(o))&&n.push(o);return n})}getModelsEmbeddingBlocks(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawModelsEmbeddingBlocks(e);return c({data:i})})}};var Ui={};rr(Ui,{AccessToken:()=>Po,AuditLogEvent:()=>Io,BuildEvent:()=>Vo,BuildTrigger:()=>Yo,DailyUsage:()=>na,EditingSession:()=>Zo,EmojiSuggestions:()=>ia,Environment:()=>Go,Field:()=>Eo,Fieldset:()=>Fo,Item:()=>Ao,ItemType:()=>Bo,ItemTypeFilter:()=>Ko,ItemVersion:()=>No,JobResult:()=>ko,MaintenanceMode:()=>Mo,MenuItem:()=>Uo,Plugin:()=>zo,PublicInfo:()=>sa,Role:()=>bo,ScheduledPublication:()=>$o,ScheduledUnpublishing:()=>Do,SchemaMenuItem:()=>To,SearchResult:()=>jo,Session:()=>So,Site:()=>ua,SiteInvitation:()=>Qo,SiteSearchSource:()=>Ho,SiteSearchSourceEvent:()=>Lo,SsoGroup:()=>ea,SsoSettings:()=>ta,SsoUser:()=>xo,SubscriptionFeature:()=>Oo,SubscriptionLimit:()=>qo,Upload:()=>Qe,UploadCollection:()=>Ro,UploadFilter:()=>Xo,UploadRequest:()=>Co,UploadSmartTag:()=>la,UploadTag:()=>aa,UploadTrack:()=>Vt,UsageCounter:()=>oa,User:()=>vo,Webhook:()=>Wo,WebhookCall:()=>Jo,WhiteLabelSettings:()=>ra,Workflow:()=>da});function Xr(t,e,{onProgress:i,additionalHeaders:r}={}){let n=new XMLHttpRequest;return G(new Promise((s,o)=>{if(i&&n.upload&&(n.upload.onprogress=a=>{a.lengthComputable&&i({type:"UPLOADING_FILE",payload:{progress:Math.round(a.loaded/a.total*100)}})}),n.onreadystatechange=()=>{n.readyState===4&&(n.status===200?s():o(new Error(`Status ${n.status}`)))},n.addEventListener("error",o,!1),n.open("PUT",e,!0),r)for(let[a,f]of Object.entries(r))n.setRequestHeader(a,f);n.send(t)}),()=>{n.onreadystatechange=null,n.abort()})}function Ot(t,e,i={}){let r=i.filename||("name"in e?e.name:void 0);if(!r)throw new Error("Missing filename, please provide it as an option!");let n=!1,s;return G(async()=>{i.onProgress&&(i==null||i.onProgress({type:"REQUESTING_UPLOAD_URL",payload:{filename:r}}));let{id:o,url:a,request_headers:f}=await t.uploadRequest.create({filename:r});if(n)throw new C;return i.onProgress&&i.onProgress({type:"UPLOADING_FILE",payload:{progress:0}}),s=Xr(e,a,{...i,additionalHeaders:f}),await s,o},()=>{s?s.cancel():n=!0})}var Qe=class extends w.Upload{createFromFileOrBlob(e){let i=!1,r;return G(async()=>{if(i)throw new C;let{fileOrBlob:n,filename:s,onProgress:o,...a}=e;r=Ot(this.client,n,{filename:s,onProgress:o});let f=await r;return o&&o({type:"CREATING_UPLOAD_OBJECT"}),this.create({...a,path:f})},()=>{r?r.cancel():i=!0})}updateFromFileOrBlob(e,i){let r=!1,n;return G(async()=>{if(r)throw new C;let{fileOrBlob:s,filename:o,onProgress:a,...f}=i;n=Ot(this.client,s,{filename:o,onProgress:a});let l=await n;return a&&a({type:"CREATING_UPLOAD_OBJECT"}),this.update(e,{...f,path:l})},()=>{n?n.cancel():r=!0})}};var Vt=class extends w.UploadTrack{createFromFileOrBlob(e,i){let r=!1,n;return G(async()=>{if(r)throw new C;let{fileOrBlob:s,onProgress:o,...a}=i;n=Ot(this.client,s,{onProgress:o});let f=await n;return o&&o({type:"CREATING_UPLOAD_TRACK_OBJECT"}),this.create(e,{...a,url_or_upload_request_id:f})},()=>{n?n.cancel():r=!0})}};var bo=w.Role,vo=w.User,xo=w.SsoUser,Io=w.AuditLogEvent,Uo=w.MenuItem,To=w.SchemaMenuItem,Ro=w.UploadCollection,Bo=w.ItemType,Eo=w.Field,Fo=w.Fieldset,So=w.Session,Po=w.AccessToken,zo=w.Plugin,ko=w.JobResult,qo=w.SubscriptionLimit,Oo=w.SubscriptionFeature,Vo=w.BuildEvent,Lo=w.SiteSearchSourceEvent,Ao=w.Item,No=w.ItemVersion,Co=w.UploadRequest,$o=w.ScheduledPublication,Do=w.ScheduledUnpublishing,jo=w.SearchResult,Go=w.Environment,Mo=w.MaintenanceMode,Wo=w.Webhook,Jo=w.WebhookCall,Yo=w.BuildTrigger,Ho=w.SiteSearchSource,Ko=w.ItemTypeFilter,Xo=w.UploadFilter,Qo=w.SiteInvitation,Zo=w.EditingSession,ea=w.SsoGroup,ta=w.SsoSettings,ia=w.EmojiSuggestions,ra=w.WhiteLabelSettings,sa=w.PublicInfo,na=w.DailyUsage,oa=w.UsageCounter,aa=w.UploadTag,la=w.UploadSmartTag,ua=w.Site,da=w.Workflow;var Ti=class extends De{constructor(i){super(i);this.uploads=new Qe(this)}};function Of(t){return new Ti(t)}export{N as ApiError,C as CanceledPromiseError,Ti as Client,L as LogLevel,Ui as Resources,er as SchemaRepository,tt as TimeoutError,Ki as blockModelIdsReferencedInField,Jn as buildBlockRecord,Of as buildClient,Xn as duplicateBlockRecord,Hn as everyBlockInNonLocalizedFieldValue,tn as everyNormalizedFieldValue,rn as everyNormalizedFieldValueAsync,Yi as filterBlocksInNonLocalizedFieldValue,Zs as filterNormalizedFieldValues,en as filterNormalizedFieldValuesAsync,Mr as findAllBlocksInNonLocalizedFieldValue,Bt as fromNormalizedFieldValueEntries,In as generateId,ro as inspectItem,$t as isBooleanFieldValue,Dt as isColorFieldValue,jt as isDateFieldValue,Gt as isDateTimeFieldValue,ht as isFileFieldValue,mt as isFileFieldValueInRequest,Mt as isFloatFieldValue,Wt as isGalleryFieldValue,Jt as isGalleryFieldValueInRequest,Yt as isIntegerFieldValue,yt as isItemId,q as isItemWithOptionalIdAndMeta,_t as isItemWithOptionalMeta,Ht as isJsonFieldValue,Kt as isLatLonFieldValue,Qt as isLinkFieldValue,Zt as isLinksFieldValue,Rt as isLocalized,on as isLocalizedBooleanFieldValue,an as isLocalizedColorFieldValue,ln as isLocalizedDateFieldValue,un as isLocalizedDateTimeFieldValue,b as isLocalizedFieldValue,dn as isLocalizedFileFieldValue,cn as isLocalizedFileFieldValueInRequest,fn as isLocalizedFloatFieldValue,pn as isLocalizedGalleryFieldValue,hn as isLocalizedGalleryFieldValueInRequest,mn as isLocalizedIntegerFieldValue,yn as isLocalizedJsonFieldValue,_n as isLocalizedLatLonFieldValue,Un as isLocalizedLinkFieldValue,Tn as isLocalizedLinksFieldValue,Fn as isLocalizedRichTextFieldValue,Pn as isLocalizedRichTextFieldValueInNestedResponse,Sn as isLocalizedRichTextFieldValueInRequest,zn as isLocalizedSeoFieldValue,Rn as isLocalizedSingleBlockFieldValue,En as isLocalizedSingleBlockFieldValueInNestedResponse,Bn as isLocalizedSingleBlockFieldValueInRequest,kn as isLocalizedSlugFieldValue,qn as isLocalizedStringFieldValue,Dn as isLocalizedStructuredTextFieldValue,Gn as isLocalizedStructuredTextFieldValueInNestedResponse,jn as isLocalizedStructuredTextFieldValueInRequest,Mn as isLocalizedTextFieldValue,Wn as isLocalizedVideoFieldValue,ri as isRichTextFieldValue,ni as isRichTextFieldValueInNestedResponse,si as isRichTextFieldValueInRequest,oi as isSeoFieldValue,ei as isSingleBlockFieldValue,ii as isSingleBlockFieldValueInNestedResponse,ti as isSingleBlockFieldValueInRequest,ai as isSlugFieldValue,li as isStringFieldValue,gi as isStructuredTextFieldValue,bi as isStructuredTextFieldValueInNestedResponse,wi as isStructuredTextFieldValueInRequest,vi as isTextFieldValue,M as isValidId,xi as isVideoFieldValue,qt as mapBlocksInNonLocalizedFieldValue,Xs as mapNormalizedFieldValues,Qs as mapNormalizedFieldValuesAsync,Qn as modelIdsReferencedInField,Wr as reduceBlocksInNonLocalizedFieldValue,Hi as someBlocksInNonLocalizedFieldValue,vr as someNormalizedFieldValues,xr as someNormalizedFieldValuesAsync,Y as toNormalizedFieldValueEntries,Ot as uploadFileOrBlobAndReturnPath,Xr as uploadFileOrBlobToS3,Gr as visitBlocksInNonLocalizedFieldValue,sn as visitNormalizedFieldValues,nn as visitNormalizedFieldValuesAsync};
|
|
10
|
+
`}var bt=function(){return bt=Object.assign||function(t){for(var e,i=1,r=arguments.length;i<r;i++){e=arguments[i];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},bt.apply(this,arguments)},He=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(d){try{a(r.next(d))}catch(h){o(h)}}function f(d){try{a(r.throw(d))}catch(h){o(h)}}function a(d){d.done?s(d.value):n(d.value).then(l,f)}a((r=r.apply(t,e||[])).next())})},Ke=function(t,e){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,n,s,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(a){return function(d){return f([a,d])}}function f(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=a[0]&2?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[a[0]&2,s.value]),a[0]){case 0:case 1:s=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(s=i.trys,!(s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1],s=a;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(a);break}s[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(d){a=[6,d],n=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},_i=function(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;for(var r=Array(t),n=0,e=0;e<i;e++)for(var s=arguments[e],o=0,l=s.length;o<l;o++,n++)r[n]=s[o];return r};function Gi(t){return typeof t=="object"&&t!==null&&"schema"in t&&t.schema==="dast"&&"document"in t}function Xe(t){return Gi(t)?t.document:t}function gi(t){return typeof t=="object"&&t!==null&&"children"in t&&Array.isArray(t.children)}function Lr(t,e,i,r){return i===void 0&&(i=null),r===void 0&&(r=[]),He(this,void 0,void 0,function(){var n,s,o;return Ke(this,function(l){switch(l.label){case 0:return n=Xe(t),[4,e(n,i,r)];case 1:if(l.sent(),!gi(n))return[3,5];s=0,l.label=2;case 2:return s<n.children.length?(o=n.children[s],[4,Lr(o,e,n,_i(r,["children",s]))]):[3,5];case 3:l.sent(),l.label=4;case 4:return s++,[3,2];case 5:return[2]}})})}function Mi(t,e,i,r){return i===void 0&&(i=null),r===void 0&&(r=[]),He(this,void 0,void 0,function(){var n,s,o,l,f=this;return Ke(this,function(a){switch(a.label){case 0:return n=Xe(t),[4,e(n,i,r)];case 1:return s=a.sent(),gi(n)&&typeof s=="object"&&s!==null?[4,Promise.all(n.children.map(function(d,h){return He(f,void 0,void 0,function(){var u;return Ke(this,function(m){switch(m.label){case 0:return u=Xe,[4,Mi(d,e,n,_i(r,["children",h]))];case 1:return[2,u.apply(void 0,[m.sent()])]}})})}))]:[3,3];case 2:return l=a.sent(),o=bt(bt({},s),{children:l}),[3,4];case 3:o=s,a.label=4;case 4:return Gi(t)?[2,{schema:"dast",document:o}]:[2,o]}})})}function Ar(t,e,i,r){return i===void 0&&(i=null),r===void 0&&(r=[]),He(this,void 0,void 0,function(){var n,s=this;return Ke(this,function(o){switch(o.label){case 0:return n=[],[4,Lr(t,function(l,f,a){return He(s,void 0,void 0,function(){return Ke(this,function(d){switch(d.label){case 0:return[4,e(l,f,a)];case 1:return d.sent()&&n.push({node:l,path:a}),[2]}})})},i,r)];case 1:return o.sent(),[2,n]}})})}function Wi(t,e,i,r){return i===void 0&&(i=null),r===void 0&&(r=[]),He(this,void 0,void 0,function(){var n,s,o,l,f=this;return Ke(this,function(a){switch(a.label){case 0:return n=Xe(t),[4,e(n,i,r)];case 1:return a.sent()?gi(n)?[3,2]:(s=n,[3,4]):[2,null];case 2:return[4,Promise.all(n.children.map(function(d,h){return He(f,void 0,void 0,function(){var u;return Ke(this,function(m){switch(m.label){case 0:return[4,Wi(d,e,n,_i(r,["children",h]))];case 1:return u=m.sent(),[2,u?Xe(u):null]}})})}))];case 3:o=a.sent(),l=o.filter(function(d){return d!==null}),s=bt(bt({},n),{children:l}),a.label=4;case 4:return Gi(t)?[2,{schema:"dast",document:s}]:[2,s]}})})}function Nr(t,e,i,r){i===void 0&&(i=null),r===void 0&&(r=[]);var n=Xe(t);if(e(n,i,r))return!0;if(gi(n))for(var s=0;s<n.children.length;s++){var o=n.children[s];if(Nr(o,e,n,_i(r,["children",s])))return!0}return!1}function Cr(t,e,i,r){i===void 0&&(i=null),r===void 0&&(r=[]);var n=Xe(t);return!Nr(n,function(s,o,l){return!e(s,o,l)},i,r)}function Ji(t,e){return Cr(t,i=>Pt(i)||kt(i)?e(i):!0)}function wi(t){return t===null?!0:wt(t)?Ji(t.document,e=>typeof e.item=="string"&&M(e.item)):!1}function jn(t){return b(t)&&Object.values(t).every(wi)}function bi(t){return t===null?!0:wt(t)?Ji(t.document,e=>{let i=e.item;return yt(i)?!0:q(i)}):!1}function Gn(t){return b(t)&&Object.values(t).every(bi)}function vi(t){return t===null?!0:wt(t)?Ji(t.document,e=>{let i=e.item;return _t(i)}):!1}function Mn(t){return b(t)&&Object.values(t).every(vi)}function xi(t){return typeof t=="string"||t===null}function Wn(t){return b(t)&&Object.values(t).every(xi)}function Ii(t){return t===null?!0:typeof t=="object"&&t!==null&&"provider"in t&&"provider_uid"in t&&"url"in t}function Jn(t){return b(t)&&Object.values(t).every(Ii)}function Yn(t){return y(t,{type:j.TYPE,attributes:"*",relationships:["item_type"]}).data}var H=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(d){try{a(r.next(d))}catch(h){o(h)}}function f(d){try{a(r.throw(d))}catch(h){o(h)}}function a(d){d.done?s(d.value):n(d.value).then(l,f)}a((r=r.apply(t,e||[])).next())})},J=function(t){return this instanceof J?(this.v=t,this):new J(t)},Hn=function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(u){r[u]&&(n[u]=function(m){return new Promise(function(g,v){s.push([u,m,g,v])>1||l(u,m)})})}function l(u,m){try{f(r[u](m))}catch(g){h(s[0][3],g)}}function f(u){u.value instanceof J?Promise.resolve(u.value.v).then(a,d):h(s[0][2],u)}function a(u){l("next",u)}function d(u){l("throw",u)}function h(u,m){u(m),s.shift(),s.length&&l(s[0][0],s[0][1])}},vt=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(s){i[s]=t[s]&&function(o){return new Promise(function(l,f){o=t[s](o),n(l,f,o.done,o.value)})}}function n(s,o,l,f){Promise.resolve(f).then(function(a){s({value:a,done:l})},o)}};function xt(t,e){return Hn(this,arguments,function*(){if(t==="rich_text"){let r=e;if(r)for(let n=0;n<r.length;n++){let s=r[n];yield yield J({item:s,path:[n]})}return yield J(void 0)}if(t==="single_block"){let r=e;return r&&(yield yield J({item:r,path:[]})),yield J(void 0)}if(t==="structured_text"){let r=e;if(r){let n=yield J(Ar(r.document,s=>H(this,void 0,void 0,function*(){return s.type==="block"||s.type==="inlineBlock"})));for(let{node:s,path:o}of n)(s.type==="block"||s.type==="inlineBlock")&&(yield yield J({item:s.item,path:o}))}return yield J(void 0)}})}function zt(t,e,i){var r,n,s,o;return H(this,void 0,void 0,function*(){try{for(var l=!0,f=vt(xt(t,e)),a;a=yield f.next(),r=a.done,!r;){o=a.value,l=!1;try{let{item:d,path:h}=o;yield i(d,h)}finally{l=!0}}}catch(d){n={error:d}}finally{try{!l&&!r&&(s=f.return)&&(yield s.call(f))}finally{if(n)throw n.error}}})}function Yi(t,e,i){return H(this,void 0,void 0,function*(){if(t==="rich_text"){let r=e;return r&&(yield Promise.all(r.map((n,s)=>i(n,[s]))))}if(t==="single_block"){let r=e;return r?yield i(r,[]):null}if(t==="structured_text"){let r=e;return r?{schema:"dast",document:yield Mi(r.document,(n,s,o)=>H(this,void 0,void 0,function*(){return n.type==="block"||n.type==="inlineBlock"?Object.assign(Object.assign({},n),{item:yield i(n.item,o)}):n}))}:null}return e})}function $r(t,e,i){var r,n,s,o;return H(this,void 0,void 0,function*(){let l=[];try{for(var f=!0,a=vt(xt(t,e)),d;d=yield a.next(),r=d.done,!r;){o=d.value,f=!1;try{let{item:h,path:u}=o;(yield i(h,u))&&l.push({item:h,path:u})}finally{f=!0}}}catch(h){n={error:h}}finally{try{!f&&!r&&(s=a.return)&&(yield s.call(a))}finally{if(n)throw n.error}}return l})}function Dr(t,e,i){var r,n,s,o,l,f,a,d;return H(this,void 0,void 0,function*(){if(t==="rich_text"){let U=[];try{for(var h=!0,u=vt(xt(t,e)),m;m=yield u.next(),r=m.done,!r;){o=m.value,h=!1;try{let{item:A,path:K}=o;(yield i(A,K))&&U.push(A)}finally{h=!0}}}catch(A){n={error:A}}finally{try{!h&&!r&&(s=u.return)&&(yield s.call(u))}finally{if(n)throw n.error}}return U}if(t==="single_block"){try{for(var g=!0,v=vt(xt(t,e)),F;F=yield v.next(),l=F.done,!l;){d=F.value,g=!1;try{let{item:U,path:A}=d;if(yield i(U,A))return U}finally{g=!0}}}catch(U){f={error:U}}finally{try{!g&&!l&&(a=v.return)&&(yield a.call(v))}finally{if(f)throw f.error}}return null}if(t==="structured_text"){let U=e;if(!U)return null;let A=yield Wi(U.document,(K,Ge,At)=>H(this,void 0,void 0,function*(){return K.type==="block"||K.type==="inlineBlock"?yield i(K.item,At):!0}));return A?{schema:"dast",document:A}:null}return e})}function jr(t,e,i,r){var n,s,o,l;return H(this,void 0,void 0,function*(){let f=r;try{for(var a=!0,d=vt(xt(t,e)),h;h=yield d.next(),n=h.done,!n;){l=h.value,a=!1;try{let{item:u,path:m}=l;f=yield i(f,u,m)}finally{a=!0}}}catch(u){s={error:u}}finally{try{!a&&!n&&(o=d.return)&&(yield o.call(d))}finally{if(s)throw s.error}}return f})}function Gr(t,e,i){var r,n,s,o;return H(this,void 0,void 0,function*(){try{for(var l=!0,f=vt(xt(t,e)),a;a=yield f.next(),r=a.done,!r;){o=a.value,l=!1;try{let{item:d,path:h}=o;if(yield i(d,h))return!0}finally{l=!0}}}catch(d){n={error:d}}finally{try{!l&&!r&&(s=f.return)&&(yield s.call(f))}finally{if(n)throw n.error}}return!1})}var E=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(d){try{a(r.next(d))}catch(h){o(h)}}function f(d){try{a(r.throw(d))}catch(h){o(h)}}function a(d){d.done?s(d.value):n(d.value).then(l,f)}a((r=r.apply(t,e||[])).next())})};function Mr(t,e,i,r,n=[]){return E(this,void 0,void 0,function*(){yield zt(e,t,(s,o)=>E(this,void 0,void 0,function*(){if(yield r(s,[...n,...o]),!q(s))return;let l=yield i.getRawItemTypeById(s.relationships.item_type.data.id),f=yield i.getRawItemTypeFields(l);for(let a of f)yield Mr(s.attributes[a.attributes.api_key],a.attributes.field_type,i,r,[...n,...o,"attributes",a.attributes.api_key])}))})}function Wr(t,e,i,r,n=[]){return E(this,void 0,void 0,function*(){let s=[],o=yield $r(e,t,(l,f)=>E(this,void 0,void 0,function*(){return yield r(l,[...n,...f])}));return s.push(...o.map(({item:l,path:f})=>({item:l,path:[...n,...f]}))),yield zt(e,t,(l,f)=>E(this,void 0,void 0,function*(){if(!q(l))return;let a=yield i.getRawItemTypeById(l.relationships.item_type.data.id),d=yield i.getRawItemTypeFields(a);for(let h of d){let u=yield Wr(l.attributes[h.attributes.api_key],h.attributes.field_type,i,r,[...n,...f,"attributes",h.attributes.api_key]);s.push(...u)}})),s})}function Hi(t,e,i,r,n={},s=[]){return E(this,void 0,void 0,function*(){let{traversalDirection:o="top-down"}=n,f=yield Yi(e,t,(a,d)=>E(this,void 0,void 0,function*(){let h=[...s,...d];if(!q(a))return a;let u=yield i.getRawItemTypeById(a.relationships.item_type.data.id),m=yield i.getRawItemTypeFields(u);if(o==="top-down"){let v=Object.assign(Object.assign({},a),{attributes:Object.assign({},a.attributes)});for(let F of m)v.attributes[F.attributes.api_key]=yield Hi(v.attributes[F.attributes.api_key],F.attributes.field_type,i,r,n,[...h,"attributes",F.attributes.api_key]);return v}let g=Object.assign(Object.assign({},a),{attributes:Object.assign({},a.attributes)});for(let v of m)g.attributes[v.attributes.api_key]=yield Hi(g.attributes[v.attributes.api_key],v.attributes.field_type,i,r,n,[...h,"attributes",v.attributes.api_key]);return g}));return Dr(e,f,(a,d)=>E(this,void 0,void 0,function*(){let h=[...s,...d];return yield r(a,h)}))})}function Jr(t,e,i,r,n,s=[]){return E(this,void 0,void 0,function*(){let o=yield jr(e,t,(l,f,a)=>E(this,void 0,void 0,function*(){return yield r(l,f,[...s,...a])}),n);return yield zt(e,t,(l,f)=>E(this,void 0,void 0,function*(){if(!q(l))return;let a=yield i.getRawItemTypeById(l.relationships.item_type.data.id),d=yield i.getRawItemTypeFields(a);for(let h of d)o=yield Jr(l.attributes[h.attributes.api_key],h.attributes.field_type,i,r,o,[...s,...f,"attributes",h.attributes.api_key])})),o})}function Ki(t,e,i,r,n=[]){return E(this,void 0,void 0,function*(){if(yield Gr(e,t,(l,f)=>E(this,void 0,void 0,function*(){return yield r(l,[...n,...f])})))return!0;let o=!1;return yield zt(e,t,(l,f)=>E(this,void 0,void 0,function*(){if(o||!q(l))return;let a=yield i.getRawItemTypeById(l.relationships.item_type.data.id),d=yield i.getRawItemTypeFields(a);for(let h of d){if(o)break;(yield Ki(l.attributes[h.attributes.api_key],h.attributes.field_type,i,r,[...n,...f,"attributes",h.attributes.api_key]))&&(o=!0)}})),o})}function Kn(t,e,i,r,n=[]){return E(this,void 0,void 0,function*(){return!(yield Ki(t,e,i,(s,o)=>E(this,void 0,void 0,function*(){return!(yield r(s,o))}),n))})}function qt(t,e,i,r,n={},s=[]){return E(this,void 0,void 0,function*(){let{traversalDirection:o="top-down"}=n;return Yi(e,t,(l,f)=>E(this,void 0,void 0,function*(){let a=[...s,...f];if(!q(l))return yield r(l,a);let d=yield i.getRawItemTypeById(l.relationships.item_type.data.id),h=yield i.getRawItemTypeFields(d);if(o==="top-down"){let m=yield r(l,a);if(!q(m))return m;for(let g of h)m.attributes[g.attributes.api_key]=yield qt(m.attributes[g.attributes.api_key],g.attributes.field_type,i,r,n,[...a,"attributes",g.attributes.api_key]);return m}let u=Object.assign({},l);for(let m of h)u.attributes[m.attributes.api_key]=yield qt(u.attributes[m.attributes.api_key],m.attributes.field_type,i,r,n,[...a,"attributes",m.attributes.api_key]);return yield r(u,a)}))})}var Xn=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(d){try{a(r.next(d))}catch(h){o(h)}}function f(d){try{a(r.throw(d))}catch(h){o(h)}}function a(d){d.done?s(d.value):n(d.value).then(l,f)}a((r=r.apply(t,e||[])).next())})},Yr=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]]);return i};function Qn(t,e){return Xn(this,void 0,void 0,function*(){let{__itemTypeId:i,type:r,attributes:n,relationships:s}=t,o=yield e.getRawItemTypeById(t.relationships.item_type.data.id),l={__itemTypeId:i,type:r,relationships:s,attributes:n},f=yield e.getRawItemTypeFields(o);for(let a of f)l.attributes[a.attributes.api_key]=yield qt(l.attributes[a.attributes.api_key],a.attributes.field_type,e,(d,h)=>{if(typeof d=="string")throw new Error(`Block cannot be duplicated as it contains nested block at ${h.join(".")} that is expressed as ID (${d}) instead of full object!`);if("id"in d){let{id:g,meta:v}=d;return Yr(d,["id","meta"])}let{meta:u}=d;return Yr(d,["meta"])});return l})}function Xi(t){let e="attributes"in t?t.attributes:t;switch(e.field_type){case"link":return e.validators.item_item_type.item_types;case"links":return e.validators.items_item_type.item_types;case"structured_text":return e.validators.structured_text_links.item_types;default:return[]}}function Ot(t){let e="attributes"in t?t.attributes:t;switch(e.field_type){case"single_block":return e.validators.single_block_blocks.item_types;case"rich_text":return e.validators.rich_text_blocks.item_types;case"structured_text":return[...e.validators.structured_text_blocks.item_types,...e.validators.structured_text_inline_blocks?e.validators.structured_text_inline_blocks.item_types:[]];default:return[]}}var Zn=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]]);return i},Hr=[{guard:Dt,inspect:so},{guard:Wt,inspect:ao},{guard:Ht,inspect:uo},{guard:jt,inspect:no},{guard:Gt,inspect:oo},{guard:Mt,inspect:lo},{guard:Jt,inspect:Xr},{guard:Yt,inspect:Xr},{guard:pt,inspect:Kr},{guard:mt,inspect:Kr},{guard:Kt,inspect:co},{guard:ai,inspect:yo},{guard:ui,inspect:_o},{guard:xi,inspect:go},{guard:Xt,inspect:fo},{guard:Zt,inspect:ho},{guard:ei,inspect:po},{guard:li,inspect:mo},{guard:Ii,inspect:wo},{guard:wi,inspect:Qi},{guard:bi,inspect:Qi},{guard:vi,inspect:Qi},{guard:ti,inspect:Ui},{guard:ii,inspect:Ui},{guard:ri,inspect:Ui},{guard:si,inspect:Zi},{guard:ni,inspect:Zi},{guard:oi,inspect:Zi}];function eo(t,e){return typeof e=="string"?{label:`${t}: ${e}`}:Array.isArray(e)?{label:t,nodes:e}:{label:t,nodes:[e]}}function to(t,e){if(b(t)){for(let i of Hr)if(Object.values(t).every(r=>i.guard(r)))return Object.entries(t).sort(([n],[s])=>n.localeCompare(s)).map(([n,s])=>{let o=i.inspect(s,e);return typeof o=="string"?{label:`${n}: ${o}`}:Array.isArray(o)?{label:n,nodes:o}:{label:n,nodes:[o]}})}for(let i of Hr)if(i.guard(t))return i.inspect(t,e);return`UNKNOWN: ${JSON.stringify(t)}`}function io(t){if("attributes"in t)return t;let{__itemTypeId:e}=t,i=Zn(t,["__itemTypeId"]);return y(i,{type:j.TYPE,attributes:"*",relationships:["item_type","creator"]}).data}function ro(t,e){return Vr(er(t,e))}function er(t,e){var i,r;let n,s=io(t);if("relationships"in s&&s.relationships){let f=s.relationships;!((r=(i=f.item_type)===null||i===void 0?void 0:i.data)===null||r===void 0)&&r.id&&(n=f.item_type.data.id)}let o=["Item","id"in t?JSON.stringify(s.id):null,n?`(item_type: ${JSON.stringify(n)})`:null].filter(Boolean).join(" "),l=[];if("attributes"in s)for(let[f,a]of Object.entries(s.attributes)){let d=to(a,e);l.push(eo(f,d))}return{label:o,nodes:l.length>0?l:void 0}}function Qi(t,e){return t===null?"null":qr(t,{maxWidth:(e==null?void 0:e.maxWidth)||80,blockFormatter:(i,r)=>typeof i=="string"?JSON.stringify(i):er(i,e)})}function Ui(t,e){return t===null?"null":typeof t=="string"?JSON.stringify(t):er(t,e)}function Zi(t,e){return t===null?"null":t.map((i,r)=>{let n=Ui(i,e);return typeof n=="string"?{label:`[${r}] ${n}`}:(n.label=`[${r}] ${n.label}`,n)})}function so(t){return JSON.stringify(t)}function no(t){if(t===null)return"null";let{red:e,green:i,blue:r,alpha:n}=t,s=`#${e.toString(16).padStart(2,"0").toUpperCase()}${i.toString(16).padStart(2,"0").toUpperCase()}${r.toString(16).padStart(2,"0").toUpperCase()}`;if(n===255)return s;let o=Math.round(n/255*100);return`${s} ${o}%`}function oo(t){return t===null?"null":t}function lo(t){return t===null?"null":t}function Kr(t,e){if(t===null)return"null";let i=[];if(i.push({label:`upload_id: ${JSON.stringify(t.upload_id)}`}),t.alt&&i.push({label:`alt: ${JSON.stringify($(t.alt,(e==null?void 0:e.maxWidth)||80))}`}),t.title&&i.push({label:`title: ${JSON.stringify($(t.title,(e==null?void 0:e.maxWidth)||80))}`}),t.custom_data&&Object.keys(t.custom_data).length>0&&i.push({label:`custom_data: ${$(JSON.stringify(t.custom_data),(e==null?void 0:e.maxWidth)||80)}`}),t.focal_point){let r=t.focal_point.x*100,n=t.focal_point.y*100;i.push({label:`focal_point: x=${r}% y=${n}%`})}return i}function ao(t){return t===null?"null":t.toString()}function Xr(t,e){return!t||t.length===0?"[]":t.map((r,n)=>{let s=[];if(s.push({label:`upload_id: ${JSON.stringify(r.upload_id)}`}),r.alt&&s.push({label:`alt: ${JSON.stringify($(r.alt,(e==null?void 0:e.maxWidth)||80))}`}),r.title&&s.push({label:`title: ${JSON.stringify($(r.title,(e==null?void 0:e.maxWidth)||80))}`}),r.custom_data&&Object.keys(r.custom_data).length>0&&s.push({label:`custom_data: ${$(JSON.stringify(r.custom_data),(e==null?void 0:e.maxWidth)||80)}`}),r.focal_point){let o=r.focal_point.x*100,l=r.focal_point.y*100;s.push({label:`focal_point: x=${o}% y=${l}%`})}return{label:`[${n}]`,nodes:s}})}function uo(t){return t===null?"null":t.toString()}function co(t,e){return t===null?"null":$(JSON.stringify(JSON.parse(t)),(e==null?void 0:e.maxWidth)||80)}function fo(t){return t===null?"null":[{label:`latitude: ${t.latitude}`},{label:`longitude: ${t.longitude}`}]}function ho(t){return t===null?"null":JSON.stringify(t)}function po(t){return t===null?"null":t.map((e,i)=>({label:`[${i}]: ${JSON.stringify(e)}`}))}function mo(t,e){if(t===null)return"null";let i=[];return t.title&&i.push({label:`title: ${JSON.stringify($(t.title,(e==null?void 0:e.maxWidth)||80))}`}),t.description&&i.push({label:`description: ${JSON.stringify($(t.description,(e==null?void 0:e.maxWidth)||80))}`}),t.image&&i.push({label:`image: ${t.image}`}),t.twitter_card&&i.push({label:`twitter_card: ${t.twitter_card}`}),t.no_index!==void 0&&i.push({label:`no_index: ${t.no_index}`}),i}function yo(t,e){return t===null?"null":JSON.stringify($(t,(e==null?void 0:e.maxWidth)||80))}function _o(t,e){return t===null?"null":JSON.stringify($(t,(e==null?void 0:e.maxWidth)||80))}function go(t,e){return t===null?"null":JSON.stringify($(t,(e==null?void 0:e.maxWidth)||80))}function wo(t,e){if(t===null)return"null";let i=[];return i.push({label:`provider: ${t.provider}`}),i.push({label:`provider_uid: ${t.provider_uid}`}),i.push({label:`url: ${t.url}`}),i.push({label:`size: ${t.width}\u2A2F${t.height}px`}),i.push({label:`thumbnail_url: ${t.thumbnail_url}`}),t.title&&i.push({label:`title: ${JSON.stringify($(t.title,(e==null?void 0:e.maxWidth)||80))}`}),i}function $(t,e){return t.length<=e?t:`${t.slice(0,e-3)}...`}var I=function(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(d){try{a(r.next(d))}catch(h){o(h)}}function f(d){try{a(r.throw(d))}catch(h){o(h)}}function a(d){d.done?s(d.value):n(d.value).then(l,f)}a((r=r.apply(t,e||[])).next())})},tr=class{constructor(e){this.itemTypesPromise=null,this.itemTypesByApiKey=new Map,this.itemTypesById=new Map,this.fieldsByItemType=new Map,this.fieldsetsByItemType=new Map,this.pluginsPromise=null,this.pluginsById=new Map,this.pluginsByPackageName=new Map,this.prefetchPromise=null,this.client=e}loadItemTypes(){return I(this,void 0,void 0,function*(){return this.itemTypesPromise||(this.itemTypesPromise=(()=>I(this,void 0,void 0,function*(){let{data:e}=yield this.client.itemTypes.rawList();for(let i of e)this.itemTypesByApiKey.set(i.attributes.api_key,i),this.itemTypesById.set(i.id,i);return e}))()),this.itemTypesPromise})}getAllItemTypes(){return I(this,void 0,void 0,function*(){let e=yield this.getAllRawItemTypes();return c({data:e})})}getAllRawItemTypes(){return I(this,void 0,void 0,function*(){return yield this.loadItemTypes()})}getAllModels(){return I(this,void 0,void 0,function*(){let e=yield this.getAllRawModels();return c({data:e})})}getAllRawModels(){return I(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(i=>!i.attributes.modular_block)})}getAllBlockModels(){return I(this,void 0,void 0,function*(){let e=yield this.getAllRawBlockModels();return c({data:e})})}getAllRawBlockModels(){return I(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(i=>i.attributes.modular_block)})}getItemTypeByApiKey(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawItemTypeByApiKey(e);return c({data:i})})}getRawItemTypeByApiKey(e){return I(this,void 0,void 0,function*(){yield this.loadItemTypes();let i=this.itemTypesByApiKey.get(e);if(!i)throw new Error(`Item type with API key '${e}' not found`);return i})}getItemTypeById(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawItemTypeById(e);return c({data:i})})}getRawItemTypeById(e){return I(this,void 0,void 0,function*(){yield this.loadItemTypes();let i=this.itemTypesById.get(e);if(!i)throw new Error(`Item type with ID '${e}' not found`);return i})}getItemTypeFields(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawItemTypeFields(e);return c({data:i})})}getRawItemTypeFields(e){return I(this,void 0,void 0,function*(){let i=this.fieldsByItemType.get(e.id);if(i)return i;let{data:r}=yield this.client.fields.rawList(e.id);return this.fieldsByItemType.set(e.id,r),r})}getItemTypeFieldsets(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawItemTypeFieldsets(e);return c({data:i})})}getRawItemTypeFieldsets(e){return I(this,void 0,void 0,function*(){let i=this.fieldsetsByItemType.get(e.id);if(i)return i;let{data:r}=yield this.client.fieldsets.rawList(e.id);return this.fieldsetsByItemType.set(e.id,r),r})}loadPlugins(){return I(this,void 0,void 0,function*(){return this.pluginsPromise||(this.pluginsPromise=(()=>I(this,void 0,void 0,function*(){let{data:e}=yield this.client.plugins.rawList();for(let i of e)this.pluginsById.set(i.id,i),i.attributes.package_name&&this.pluginsByPackageName.set(i.attributes.package_name,i);return e}))()),this.pluginsPromise})}getAllPlugins(){return I(this,void 0,void 0,function*(){let e=yield this.getAllRawPlugins();return c({data:e})})}getAllRawPlugins(){return I(this,void 0,void 0,function*(){return yield this.loadPlugins()})}getPluginById(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawPluginById(e);return c({data:i})})}getRawPluginById(e){return I(this,void 0,void 0,function*(){yield this.loadPlugins();let i=this.pluginsById.get(e);if(!i)throw new Error(`Plugin with ID '${e}' not found`);return i})}getPluginByPackageName(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawPluginByPackageName(e);return c({data:i})})}getRawPluginByPackageName(e){return I(this,void 0,void 0,function*(){yield this.loadPlugins();let i=this.pluginsByPackageName.get(e);if(!i)throw new Error(`Plugin with package name '${e}' not found`);return i})}prefetchAllModelsAndFields(){return I(this,void 0,void 0,function*(){if(this.prefetchPromise)return this.prefetchPromise;let e=()=>I(this,void 0,void 0,function*(){let{included:i}=yield this.client.site.rawFind({include:"item_types,item_types.fields"});if(!i)throw new Error("This should not happen");let r=i.filter(o=>o.type==="item_type"),n=i.filter(o=>o.type==="field");this.itemTypesPromise=Promise.resolve(r);for(let o of r)this.itemTypesByApiKey.set(o.attributes.api_key,o),this.itemTypesById.set(o.id,o);let s=new Map;for(let o of n){let l=o.relationships.item_type.data.id;s.has(l)||s.set(l,[]),s.get(l).push(o)}for(let[o,l]of s)this.fieldsByItemType.set(o,l)});return this.prefetchPromise=e(),this.prefetchPromise})}getRawModelsEmbeddingBlocks(e){return I(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();let i=yield this.getAllRawItemTypes(),r=new Set(e.map(o=>o.id)),n=[],s=(o,l=new Set)=>I(this,void 0,void 0,function*(){if(l.has(o.id))return!1;l.add(o.id);let f=yield this.getRawItemTypeFields(o);for(let a of f){let d=Ot(a);if(d.some(u=>r.has(u)))return!0;let h=d.map(u=>i.find(m=>m.id===u));for(let u of h)if(yield s(u,new Set(l)))return!0}return!1});for(let o of i)(yield s(o))&&n.push(o);return n})}getModelsEmbeddingBlocks(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawModelsEmbeddingBlocks(e);return c({data:i})})}getRawNestedBlocks(e){return I(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();let i=yield this.getAllRawItemTypes(),r=new Set,n=[],s=(o,l=new Set)=>I(this,void 0,void 0,function*(){if(l.has(o.id))return;l.add(o.id);let f=yield this.getRawItemTypeFields(o);for(let a of f){let d=Ot(a);for(let h of d)if(!r.has(h)){r.add(h);let u=i.find(m=>m.id===h);u&&(n.push(u),yield s(u,new Set(l)))}}});for(let o of e)yield s(o);return n})}getNestedBlocks(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawNestedBlocks(e);return c({data:i})})}getRawNestedModels(e){return I(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();let i=yield this.getAllRawItemTypes(),r=new Set,n=[],s=(o,l=new Set)=>I(this,void 0,void 0,function*(){if(l.has(o.id))return;l.add(o.id);let f=yield this.getRawItemTypeFields(o);for(let a of f){let d=Xi(a);for(let u of d)if(!r.has(u)){r.add(u);let m=i.find(g=>g.id===u);m&&n.push(m)}let h=Ot(a);for(let u of h){let m=i.find(g=>g.id===u);m&&(yield s(m,new Set(l)))}}});for(let o of e)yield s(o);return n})}getNestedModels(e){return I(this,void 0,void 0,function*(){let i=yield this.getRawNestedModels(e);return c({data:i})})}};var Ri={};sr(Ri,{AccessToken:()=>Po,AuditLogEvent:()=>Io,BuildEvent:()=>Vo,BuildTrigger:()=>Yo,DailyUsage:()=>nl,EditingSession:()=>Zo,EmojiSuggestions:()=>il,Environment:()=>Go,Field:()=>Eo,Fieldset:()=>Fo,Item:()=>Ao,ItemType:()=>Bo,ItemTypeFilter:()=>Ko,ItemVersion:()=>No,JobResult:()=>zo,MaintenanceMode:()=>Mo,MenuItem:()=>Uo,Plugin:()=>ko,PublicInfo:()=>sl,Role:()=>bo,ScheduledPublication:()=>$o,ScheduledUnpublishing:()=>Do,SchemaMenuItem:()=>Ro,SearchIndex:()=>Ho,SearchIndexEvent:()=>Lo,SearchResult:()=>jo,Session:()=>So,Site:()=>ul,SiteInvitation:()=>Qo,SsoGroup:()=>el,SsoSettings:()=>tl,SsoUser:()=>xo,SubscriptionFeature:()=>Oo,SubscriptionLimit:()=>qo,Upload:()=>Qe,UploadCollection:()=>To,UploadFilter:()=>Xo,UploadRequest:()=>Co,UploadSmartTag:()=>al,UploadTag:()=>ll,UploadTrack:()=>Lt,UsageCounter:()=>ol,User:()=>vo,Webhook:()=>Wo,WebhookCall:()=>Jo,WhiteLabelSettings:()=>rl,Workflow:()=>dl});function Qr(t,e,{onProgress:i,additionalHeaders:r}={}){let n=new XMLHttpRequest;return G(new Promise((s,o)=>{if(i&&n.upload&&(n.upload.onprogress=l=>{l.lengthComputable&&i({type:"UPLOADING_FILE",payload:{progress:Math.round(l.loaded/l.total*100)}})}),n.onreadystatechange=()=>{n.readyState===4&&(n.status===200?s():o(new Error(`Status ${n.status}`)))},n.addEventListener("error",o,!1),n.open("PUT",e,!0),r)for(let[l,f]of Object.entries(r))n.setRequestHeader(l,f);n.send(t)}),()=>{n.onreadystatechange=null,n.abort()})}function Vt(t,e,i={}){let r=i.filename||("name"in e?e.name:void 0);if(!r)throw new Error("Missing filename, please provide it as an option!");let n=!1,s;return G(async()=>{i.onProgress&&(i==null||i.onProgress({type:"REQUESTING_UPLOAD_URL",payload:{filename:r}}));let{id:o,url:l,request_headers:f}=await t.uploadRequest.create({filename:r});if(n)throw new C;return i.onProgress&&i.onProgress({type:"UPLOADING_FILE",payload:{progress:0}}),s=Qr(e,l,{...i,additionalHeaders:f}),await s,o},()=>{s?s.cancel():n=!0})}var Qe=class extends w.Upload{createFromFileOrBlob(e){let i=!1,r;return G(async()=>{if(i)throw new C;let{fileOrBlob:n,filename:s,onProgress:o,...l}=e;r=Vt(this.client,n,{filename:s,onProgress:o});let f=await r;return o&&o({type:"CREATING_UPLOAD_OBJECT"}),this.create({...l,path:f})},()=>{r?r.cancel():i=!0})}updateFromFileOrBlob(e,i){let r=!1,n;return G(async()=>{if(r)throw new C;let{fileOrBlob:s,filename:o,onProgress:l,...f}=i;n=Vt(this.client,s,{filename:o,onProgress:l});let a=await n;return l&&l({type:"CREATING_UPLOAD_OBJECT"}),this.update(e,{...f,path:a})},()=>{n?n.cancel():r=!0})}};var Lt=class extends w.UploadTrack{createFromFileOrBlob(e,i){let r=!1,n;return G(async()=>{if(r)throw new C;let{fileOrBlob:s,onProgress:o,...l}=i;n=Vt(this.client,s,{onProgress:o});let f=await n;return o&&o({type:"CREATING_UPLOAD_TRACK_OBJECT"}),this.create(e,{...l,url_or_upload_request_id:f})},()=>{n?n.cancel():r=!0})}};var bo=w.Role,vo=w.User,xo=w.SsoUser,Io=w.AuditLogEvent,Uo=w.MenuItem,Ro=w.SchemaMenuItem,To=w.UploadCollection,Bo=w.ItemType,Eo=w.Field,Fo=w.Fieldset,So=w.Session,Po=w.AccessToken,ko=w.Plugin,zo=w.JobResult,qo=w.SubscriptionLimit,Oo=w.SubscriptionFeature,Vo=w.BuildEvent,Lo=w.SearchIndexEvent,Ao=w.Item,No=w.ItemVersion,Co=w.UploadRequest,$o=w.ScheduledPublication,Do=w.ScheduledUnpublishing,jo=w.SearchResult,Go=w.Environment,Mo=w.MaintenanceMode,Wo=w.Webhook,Jo=w.WebhookCall,Yo=w.BuildTrigger,Ho=w.SearchIndex,Ko=w.ItemTypeFilter,Xo=w.UploadFilter,Qo=w.SiteInvitation,Zo=w.EditingSession,el=w.SsoGroup,tl=w.SsoSettings,il=w.EmojiSuggestions,rl=w.WhiteLabelSettings,sl=w.PublicInfo,nl=w.DailyUsage,ol=w.UsageCounter,ll=w.UploadTag,al=w.UploadSmartTag,ul=w.Site,dl=w.Workflow;var Ti=class extends De{constructor(i){super(i);this.uploads=new Qe(this)}};function Of(t){return new Ti(t)}export{N as ApiError,C as CanceledPromiseError,Ti as Client,L as LogLevel,Ri as Resources,tr as SchemaRepository,tt as TimeoutError,Ot as blockModelIdsReferencedInField,Yn as buildBlockRecord,Of as buildClient,Qn as duplicateBlockRecord,Kn as everyBlockInNonLocalizedFieldValue,rn as everyNormalizedFieldValue,sn as everyNormalizedFieldValueAsync,Hi as filterBlocksInNonLocalizedFieldValue,en as filterNormalizedFieldValues,tn as filterNormalizedFieldValuesAsync,Wr as findAllBlocksInNonLocalizedFieldValue,Bt as fromNormalizedFieldValueEntries,Un as generateId,ro as inspectItem,Dt as isBooleanFieldValue,jt as isColorFieldValue,Gt as isDateFieldValue,Mt as isDateTimeFieldValue,pt as isFileFieldValue,mt as isFileFieldValueInRequest,Wt as isFloatFieldValue,Jt as isGalleryFieldValue,Yt as isGalleryFieldValueInRequest,Ht as isIntegerFieldValue,yt as isItemId,q as isItemWithOptionalIdAndMeta,_t as isItemWithOptionalMeta,Kt as isJsonFieldValue,Xt as isLatLonFieldValue,Zt as isLinkFieldValue,ei as isLinksFieldValue,Tt as isLocalized,ln as isLocalizedBooleanFieldValue,an as isLocalizedColorFieldValue,un as isLocalizedDateFieldValue,dn as isLocalizedDateTimeFieldValue,b as isLocalizedFieldValue,cn as isLocalizedFileFieldValue,fn as isLocalizedFileFieldValueInRequest,hn as isLocalizedFloatFieldValue,pn as isLocalizedGalleryFieldValue,mn as isLocalizedGalleryFieldValueInRequest,yn as isLocalizedIntegerFieldValue,_n as isLocalizedJsonFieldValue,gn as isLocalizedLatLonFieldValue,Rn as isLocalizedLinkFieldValue,Tn as isLocalizedLinksFieldValue,Sn as isLocalizedRichTextFieldValue,kn as isLocalizedRichTextFieldValueInNestedResponse,Pn as isLocalizedRichTextFieldValueInRequest,zn as isLocalizedSeoFieldValue,Bn as isLocalizedSingleBlockFieldValue,Fn as isLocalizedSingleBlockFieldValueInNestedResponse,En as isLocalizedSingleBlockFieldValueInRequest,qn as isLocalizedSlugFieldValue,On as isLocalizedStringFieldValue,jn as isLocalizedStructuredTextFieldValue,Mn as isLocalizedStructuredTextFieldValueInNestedResponse,Gn as isLocalizedStructuredTextFieldValueInRequest,Wn as isLocalizedTextFieldValue,Jn as isLocalizedVideoFieldValue,si as isRichTextFieldValue,oi as isRichTextFieldValueInNestedResponse,ni as isRichTextFieldValueInRequest,li as isSeoFieldValue,ti as isSingleBlockFieldValue,ri as isSingleBlockFieldValueInNestedResponse,ii as isSingleBlockFieldValueInRequest,ai as isSlugFieldValue,ui as isStringFieldValue,wi as isStructuredTextFieldValue,vi as isStructuredTextFieldValueInNestedResponse,bi as isStructuredTextFieldValueInRequest,xi as isTextFieldValue,M as isValidId,Ii as isVideoFieldValue,qt as mapBlocksInNonLocalizedFieldValue,Qs as mapNormalizedFieldValues,Zs as mapNormalizedFieldValuesAsync,Xi as modelIdsReferencedInField,Jr as reduceBlocksInNonLocalizedFieldValue,Ki as someBlocksInNonLocalizedFieldValue,xr as someNormalizedFieldValues,Ir as someNormalizedFieldValuesAsync,Y as toNormalizedFieldValueEntries,Vt as uploadFileOrBlobAndReturnPath,Qr as uploadFileOrBlobToS3,Mr as visitBlocksInNonLocalizedFieldValue,nn as visitNormalizedFieldValues,on as visitNormalizedFieldValuesAsync};
|
|
11
11
|
//# sourceMappingURL=index.js.map
|