UNPKG

datocms-plugin-tinymce-rich-text

Version:
7 lines (6 loc) 1.71 MB
(function(){const b=document.createElement("link").relList;if(b&&b.supports&&b.supports("modulepreload"))return;for(const I of document.querySelectorAll('link[rel="modulepreload"]'))D(I);new MutationObserver(I=>{for(const B of I)if(B.type==="childList")for(const F of B.addedNodes)F.tagName==="LINK"&&F.rel==="modulepreload"&&D(F)}).observe(document,{childList:!0,subtree:!0});function w(I){const B={};return I.integrity&&(B.integrity=I.integrity),I.referrerPolicy&&(B.referrerPolicy=I.referrerPolicy),I.crossOrigin==="use-credentials"?B.credentials="include":I.crossOrigin==="anonymous"?B.credentials="omit":B.credentials="same-origin",B}function D(I){if(I.ep)return;I.ep=!0;const B=w(I);fetch(I.href,B)}})();var Mx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vx(C){return C&&C.__esModule&&Object.prototype.hasOwnProperty.call(C,"default")?C.default:C}function Hre(C){if(Object.prototype.hasOwnProperty.call(C,"__esModule"))return C;var b=C.default;if(typeof b=="function"){var w=function D(){var I=!1;try{I=this instanceof D}catch{}return I?Reflect.construct(b,arguments,this.constructor):b.apply(this,arguments)};w.prototype=b.prototype}else w={};return Object.defineProperty(w,"__esModule",{value:!0}),Object.keys(C).forEach(function(D){var I=Object.getOwnPropertyDescriptor(C,D);Object.defineProperty(w,D,I.get?I:{enumerable:!0,get:function(){return C[D]}})}),w}var lX={exports:{}},Mz={};var Gee;function Ure(){if(Gee)return Mz;Gee=1;var C=Symbol.for("react.transitional.element"),b=Symbol.for("react.fragment");function w(D,I,B){var F=null;if(B!==void 0&&(F=""+B),I.key!==void 0&&(F=""+I.key),"key"in I){B={};for(var j in I)j!=="key"&&(B[j]=I[j])}else B=I;return I=B.ref,{$$typeof:C,type:D,key:F,ref:I!==void 0?I:null,props:B}}return Mz.Fragment=b,Mz.jsx=w,Mz.jsxs=w,Mz}var Wee;function Vre(){return Wee||(Wee=1,lX.exports=Ure()),lX.exports}var iI=Vre(),WP={exports:{}},Ll={},Yee;function _J(){if(Yee)return Ll;Yee=1,Object.defineProperty(Ll,"__esModule",{value:!0}),Ll.DATA_CLONE_ERROR=Ll.MESSAGE=Ll.REJECTED=Ll.FULFILLED=Ll.REPLY=Ll.CALL=Ll.HANDSHAKE_REPLY=Ll.HANDSHAKE=void 0;const C="handshake";Ll.HANDSHAKE=C;const b="handshake-reply";Ll.HANDSHAKE_REPLY=b;const w="call";Ll.CALL=w;const D="reply";Ll.REPLY=D;const I="fulfilled";Ll.FULFILLED=I;const B="rejected";Ll.REJECTED=B;const F="message";Ll.MESSAGE=F;const j="DataCloneError";return Ll.DATA_CLONE_ERROR=j,Ll}var cp={},Kee;function _se(){if(Kee)return cp;Kee=1,Object.defineProperty(cp,"__esModule",{value:!0}),cp.ERR_NO_IFRAME_SRC=cp.ERR_NOT_IN_IFRAME=cp.ERR_CONNECTION_TIMEOUT=cp.ERR_CONNECTION_DESTROYED=void 0;const C="ConnectionDestroyed";cp.ERR_CONNECTION_DESTROYED=C;const b="ConnectionTimeout";cp.ERR_CONNECTION_TIMEOUT=b;const w="NotInIframe";cp.ERR_NOT_IN_IFRAME=w;const D="NoIframeSrc";return cp.ERR_NO_IFRAME_SRC=D,cp}var YP={exports:{}},Xee;function qre(){return Xee||(Xee=1,(function(C,b){Object.defineProperty(b,"__esModule",{value:!0}),b.default=void 0;var w=()=>{const D=[];let I=!1;return{destroy(){I=!0,D.forEach(B=>{B()})},onDestroy(B){I?B():D.push(B)}}};b.default=w,C.exports=b.default})(YP,YP.exports)),YP.exports}var KP={exports:{}},z2={},Qee;function wse(){if(Qee)return z2;Qee=1,Object.defineProperty(z2,"__esModule",{value:!0}),z2.deserializeError=z2.serializeError=void 0;const C=w=>{let D=w.name,I=w.message,B=w.stack;return{name:D,message:I,stack:B}};z2.serializeError=C;const b=w=>{const D=new Error;return Object.keys(w).forEach(I=>D[I]=w[I]),D};return z2.deserializeError=b,z2}var Jee;function jre(){return Jee||(Jee=1,(function(C,b){Object.defineProperty(b,"__esModule",{value:!0}),b.default=void 0;var w=_J(),D=wse(),I=(B,F,j)=>{const ne=B.localName,Y=B.local,re=B.remote,he=B.originForSending,ie=B.originForReceiving;let Le=!1;j(`${ne}: Connecting call receiver`);const ye=De=>{if(De.source!==re||De.data.penpal!==w.CALL)return;if(De.origin!==ie){j(`${ne} received message from origin ${De.origin} which did not match expected origin ${ie}`);return}const Pe=De.data,Dt=Pe.methodName,je=Pe.args,Q=Pe.id;j(`${ne}: Received ${Dt}() call`);const pt=qt=>ct=>{if(j(`${ne}: Sending ${Dt}() reply`),Le){j(`${ne}: Unable to send ${Dt}() reply due to destroyed connection`);return}const q={penpal:w.REPLY,id:Q,resolution:qt,returnValue:ct};qt===w.REJECTED&&ct instanceof Error&&(q.returnValue=(0,D.serializeError)(ct),q.returnValueIsError=!0);try{re.postMessage(q,he)}catch(Xe){throw Xe.name===w.DATA_CLONE_ERROR&&re.postMessage({penpal:w.REPLY,id:Q,resolution:w.REJECTED,returnValue:(0,D.serializeError)(Xe),returnValueIsError:!0},he),Xe}};new Promise(qt=>qt(F[Dt].apply(F,je))).then(pt(w.FULFILLED),pt(w.REJECTED))};return Y.addEventListener(w.MESSAGE,ye),()=>{Le=!0,Y.removeEventListener(w.MESSAGE,ye)}};b.default=I,C.exports=b.default})(KP,KP.exports)),KP.exports}var XP={exports:{}},QP={exports:{}},ete;function Zre(){return ete||(ete=1,(function(C,b){Object.defineProperty(b,"__esModule",{value:!0}),b.default=void 0;let w=0;var D=()=>++w;b.default=D,C.exports=b.default})(QP,QP.exports)),QP.exports}var tte;function Gre(){return tte||(tte=1,(function(C,b){Object.defineProperty(b,"__esModule",{value:!0}),b.default=void 0;var w=_J(),D=_se(),I=F(Zre()),B=wse();function F(ne){return ne&&ne.__esModule?ne:{default:ne}}var j=(ne,Y,re,he,ie)=>{const Le=Y.localName,ye=Y.local,De=Y.remote,Pe=Y.originForSending,Dt=Y.originForReceiving;let je=!1;ie(`${Le}: Connecting call sender`);const Q=pt=>function(){for(var qt=arguments.length,ct=new Array(qt),q=0;q<qt;q++)ct[q]=arguments[q];ie(`${Le}: Sending ${pt}() call`);let Xe;try{De.closed&&(Xe=!0)}catch{Xe=!0}if(Xe&&he(),je){const Et=new Error(`Unable to send ${pt}() call due to destroyed connection`);throw Et.code=D.ERR_CONNECTION_DESTROYED,Et}return new Promise((Et,Mt)=>{const Ae=(0,I.default)(),Lt=xn=>{if(xn.source!==De||xn.data.penpal!==w.REPLY||xn.data.id!==Ae)return;if(xn.origin!==Dt){ie(`${Le} received message from origin ${xn.origin} which did not match expected origin ${Dt}`);return}ie(`${Le}: Received ${pt}() reply`),ye.removeEventListener(w.MESSAGE,Lt);let Rt=xn.data.returnValue;xn.data.returnValueIsError&&(Rt=(0,B.deserializeError)(Rt)),(xn.data.resolution===w.FULFILLED?Et:Mt)(Rt)};ye.addEventListener(w.MESSAGE,Lt),De.postMessage({penpal:w.CALL,id:Ae,methodName:pt,args:ct},Pe)})};return re.reduce((pt,qt)=>(pt[qt]=Q(qt),pt),ne),()=>{je=!0}};b.default=j,C.exports=b.default})(XP,XP.exports)),XP.exports}var JP={exports:{}},nte;function Wre(){return nte||(nte=1,(function(C,b){Object.defineProperty(b,"__esModule",{value:!0}),b.default=void 0;var w=D=>function(){if(D){for(var I=arguments.length,B=new Array(I),F=0;F<I;F++)B[F]=arguments[F];console.log("[Penpal]",...B)}};b.default=w,C.exports=b.default})(JP,JP.exports)),JP.exports}var ote;function Yre(){return ote||(ote=1,(function(C,b){Object.defineProperty(b,"__esModule",{value:!0}),b.default=void 0;var w=_J(),D=_se(),I=ne(qre()),B=ne(jre()),F=ne(Gre()),j=ne(Wre());function ne(re){return re&&re.__esModule?re:{default:re}}var Y=function(){let he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ie=he.parentOrigin,Le=ie===void 0?"*":ie,ye=he.methods,De=ye===void 0?{}:ye,Pe=he.timeout,Dt=he.debug;const je=(0,j.default)(Dt);if(window===window.top){const Et=new Error("connectToParent() must be called within an iframe");throw Et.code=D.ERR_NOT_IN_IFRAME,Et}const Q=(0,I.default)(),pt=Q.destroy,qt=Q.onDestroy,ct=window,q=ct.parent;return{promise:new Promise((Et,Mt)=>{let Ae;Pe!==void 0&&(Ae=setTimeout(()=>{const xn=new Error(`Connection to parent timed out after ${Pe}ms`);xn.code=D.ERR_CONNECTION_TIMEOUT,Mt(xn),pt()},Pe));const Lt=xn=>{try{clearTimeout()}catch{return}if(xn.source!==q||xn.data.penpal!==w.HANDSHAKE_REPLY)return;if(Le!=="*"&&Le!==xn.origin){je(`Child received handshake reply from origin ${xn.origin} which did not match expected origin ${Le}`);return}je("Child: Received handshake reply"),ct.removeEventListener(w.MESSAGE,Lt);const Rt={localName:"Child",local:ct,remote:q,originForSending:xn.origin==="null"?"*":xn.origin,originForReceiving:xn.origin},yt={},A=(0,B.default)(Rt,De,je);qt(A);const jt=(0,F.default)(yt,Rt,xn.data.methodNames,pt,je);qt(jt),clearTimeout(Ae),Et(yt)};ct.addEventListener(w.MESSAGE,Lt),qt(()=>{ct.removeEventListener(w.MESSAGE,Lt);const xn=new Error("Connection destroyed");xn.code=D.ERR_CONNECTION_DESTROYED,Mt(xn)}),je("Child: Sending handshake"),q.postMessage({penpal:w.HANDSHAKE,methodNames:Object.keys(De)},Le)}),destroy:pt}};b.default=Y,C.exports=b.default})(WP,WP.exports)),WP.exports}var Kre=Yre();const Xre=Vx(Kre);var Sy=function(){return Sy=Object.assign||function(C){for(var b,w=1,D=arguments.length;w<D;w++){b=arguments[w];for(var I in b)Object.prototype.hasOwnProperty.call(b,I)&&(C[I]=b[I])}return C},Sy.apply(this,arguments)};function ste(C,b){for(var w=Sy({},C),D=0,I=b;D<I.length;D++){var B=I[D];delete w[B]}return w}function uX(C){return function(b,w){if(C){for(var D={},I=0,B=b;I<B.length;I++){var F=B[I],j=w.itemTypes[F.relationships.item_type.data.id];D[F.id]=C(F,Sy(Sy({},w),{itemType:j}))}return D}}}function ub(C,b){var w=function(D,I,B){if(B.mode===C){var F=Jre(I),j=function(ne){b(D,Sy(Sy(Sy({},I),ne),F))};return j(B),j}};return w.mode=C,w}function Iz(C,b){var w=function(D,I,B){if(B.mode===C){var F=function(j){b(D,Sy(Sy({},I),j))};return F(B),F}};return w.mode=C,w}function Qre(){for(var C=document.querySelectorAll("body *"),b=0,w=0;w<C.length;w++)b=Math.max(C[w].getBoundingClientRect().bottom,b);return b}var Jre=function(C){var b=null,w=function(Y){var re=Y===void 0?Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.getBoundingClientRect().height,Qre()):Y;re!==b&&(C.setHeight(re),b=re)},D=null,I=null,B=function(){return w()},F=function(){w(),D||(D=new ResizeObserver(B),D.observe(document.documentElement)),I||(I=new MutationObserver(B),I.observe(window.document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}))},j=function(){D&&(D.disconnect(),D=null),I&&(I.disconnect(),I=null)},ne=function(){return!!D};return{updateHeight:w,startAutoResizer:F,stopAutoResizer:j,isAutoResizerActive:ne}},eae=ub("renderAssetSource",function(C,b){C.renderAssetSource&&C.renderAssetSource(b.assetSourceId,b)}),tae=ub("renderConfigScreen",function(C,b){C.renderConfigScreen&&C.renderConfigScreen(b)}),nae=ub("renderFieldExtension",function(C,b){C.renderFieldExtension&&C.renderFieldExtension(b.fieldExtensionId,b)}),oae=Iz("renderInspector",function(C,b){C.renderInspector&&C.renderInspector(b.inspectorId,b)}),sae=Iz("renderInspectorPanel",function(C,b){C.renderInspectorPanel&&C.renderInspectorPanel(b.panelId,b)}),rae=ub("renderItemCollectionOutlet",function(C,b){C.renderItemCollectionOutlet&&C.renderItemCollectionOutlet(b.itemCollectionOutletId,b)}),aae=ub("renderItemFormOutlet",function(C,b){C.renderItemFormOutlet&&C.renderItemFormOutlet(b.itemFormOutletId,b)}),iae=Iz("renderItemFormSidebar",function(C,b){C.renderItemFormSidebar&&C.renderItemFormSidebar(b.sidebarId,b)}),cae=ub("renderItemFormSidebarPanel",function(C,b){C.renderItemFormSidebarPanel&&C.renderItemFormSidebarPanel(b.sidebarPaneId,b)}),lae=ub("renderManualFieldExtensionConfigScreen",function(C,b){C.renderManualFieldExtensionConfigScreen&&C.renderManualFieldExtensionConfigScreen(b.fieldExtensionId,b)}),uae=ub("renderModal",function(C,b){C.renderModal&&C.renderModal(b.modalId,b)}),dae=Iz("renderPage",function(C,b){C.renderPage&&C.renderPage(b.pageId,b)}),fae=Iz("renderUploadSidebar",function(C,b){C.renderUploadSidebar&&C.renderUploadSidebar(b.sidebarId,b)}),mae=ub("renderUploadSidebarPanel",function(C,b){C.renderUploadSidebarPanel&&C.renderUploadSidebarPanel(b.sidebarPaneId,b)}),sg=function(){return sg=Object.assign||function(C){for(var b,w=1,D=arguments.length;w<D;w++){b=arguments[w];for(var I in b)Object.prototype.hasOwnProperty.call(b,I)&&(C[I]=b[I])}return C},sg.apply(this,arguments)},hae=function(C,b,w,D){function I(B){return B instanceof w?B:new w(function(F){F(B)})}return new(w||(w=Promise))(function(B,F){function j(re){try{Y(D.next(re))}catch(he){F(he)}}function ne(re){try{Y(D.throw(re))}catch(he){F(he)}}function Y(re){re.done?B(re.value):I(re.value).then(j,ne)}Y((D=D.apply(C,b||[])).next())})},gae=function(C,b){var w={label:0,sent:function(){if(B[0]&1)throw B[1];return B[1]},trys:[],ops:[]},D,I,B,F=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return F.next=j(0),F.throw=j(1),F.return=j(2),typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function j(Y){return function(re){return ne([Y,re])}}function ne(Y){if(D)throw new TypeError("Generator is already executing.");for(;F&&(F=0,Y[0]&&(w=0)),w;)try{if(D=1,I&&(B=Y[0]&2?I.return:Y[0]?I.throw||((B=I.return)&&B.call(I),0):I.next)&&!(B=B.call(I,Y[1])).done)return B;switch(I=0,B&&(Y=[Y[0]&2,B.value]),Y[0]){case 0:case 1:B=Y;break;case 4:return w.label++,{value:Y[1],done:!1};case 5:w.label++,I=Y[1],Y=[0];continue;case 7:Y=w.ops.pop(),w.trys.pop();continue;default:if(B=w.trys,!(B=B.length>0&&B[B.length-1])&&(Y[0]===6||Y[0]===2)){w=0;continue}if(Y[0]===3&&(!B||Y[1]>B[0]&&Y[1]<B[3])){w.label=Y[1];break}if(Y[0]===6&&w.label<B[1]){w.label=B[1],B=Y;break}if(B&&w.label<B[2]){w.label=B[2],w.ops.push(Y);break}B[2]&&w.ops.pop(),w.trys.pop();continue}Y=b.call(C,w)}catch(re){Y=[6,re],I=0}finally{D=B=0}if(Y[0]&5)throw Y[1];return{value:Y[0]?Y[1]:void 0,done:!0}}},rte=function(C,b,w){if(w||arguments.length===2)for(var D=0,I=b.length,B;D<I;D++)(B||!(D in b))&&(B||(B=Array.prototype.slice.call(b,0,D)),B[D]=b[D]);return C.concat(B||Array.prototype.slice.call(b))};function pae(){return hae(this,arguments,void 0,function(C){var b,w,D,I,B,F,j,ne,Y,re,he,ie;return C===void 0&&(C={}),gae(this,function(Le){switch(Le.label){case 0:return b=null,w=null,D=sg(sg({},C),{overrideFieldExtensions:uX(C.overrideFieldExtensions),customMarksForStructuredTextField:uX(C.customMarksForStructuredTextField),customBlockStylesForStructuredTextField:uX(C.customBlockStylesForStructuredTextField)}),I=Xre({methods:sg(sg({sdkVersion:function(){return"0.3.0"},implementedHooks:function(){return Object.fromEntries(Object.keys(C).map(function(ye){return[ye,!0]}))}},Object.fromEntries(Object.entries(D).filter(function(ye){var De=ye[0];return!De.startsWith("render")}))),{onChange:function(ye){b&&b(ye)},callMethodMergingBootCtx:function(ye,De,Pe,Dt,je){return w?w(ye,De,Pe,Dt,je):null}})}),[4,I.promise];case 1:return B=Le.sent(),[4,B.getSettings()];case 2:for(F=Le.sent(),F.mode==="onBoot"&&(j=F,b=function(ye){j=ye},w=function(ye,De,Pe,Dt,je){var Q;if(ye in D)return(Q=D)[ye].apply(Q,rte(rte([],De,!1),[sg(sg(sg(sg({},ste(B,["getSettings","setHeight"])),ste(j,["mode","bodyPadding"])),Object.fromEntries(Dt.map(function(pt){return[pt,function(){for(var ct=[],q=0;q<arguments.length;q++)ct[q]=arguments[q];return B.callAdditionalCtxMethod(je,pt,ct)}]}))),Pe)],!1))},D.onBoot&&D.onBoot(sg(sg({},B),j))),ne={renderAssetSource:eae,renderConfigScreen:tae,renderFieldExtension:nae,renderItemCollectionOutlet:rae,renderItemFormOutlet:aae,renderItemFormSidebar:iae,renderItemFormSidebarPanel:cae,renderManualFieldExtensionConfigScreen:lae,renderModal:uae,renderPage:dae,renderInspector:oae,renderInspectorPanel:sae,renderUploadSidebar:fae,renderUploadSidebarPanel:mae},Y=0,re=Object.values(ne);Y<re.length;Y++)if(he=re[Y],ie=he(D,B,F),ie){b=ie;break}return[2]}})})}function kse(C){return typeof C=="object"&&!!C&&"data"in C}function yae(C){return typeof C=="object"&&!!C&&"included"in C}function lp({__itemTypeId:C,id:b,type:w,attributes:D,relationships:I,meta:B}){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},C?{__itemTypeId:C}:{}),b?{id:b}:{}),w?{type:w}:{}),D||{}),I?Object.fromEntries(Object.entries(I).map(([F,j])=>[F,j?.data])):{}),B?{meta:B}:{})}function Ke(C){if(!kse(C))throw new Error("Invalid body!");return Array.isArray(C.data)?C.data.map(lp):lp(C.data)}function Sse(C){return!!(C&&typeof C=="object"&&"type"in C&&C.type==="item")}function hJ(C){if(Array.isArray(C))return C.map(hJ);if(C&&typeof C=="object"){if(Sse(C))return Bz(C);const b={};for(const[w,D]of Object.entries(C))b[w]=hJ(D);return b}return C}function Bz(C){if(!Sse(C))return C;const b=C.attributes?hJ(C.attributes):C.attributes;return Object.assign(Object.assign({},C),{attributes:b,__itemTypeId:C.relationships.item_type.data.id})}function ag(C){if(!kse(C))throw new Error("Invalid body!");let b;Array.isArray(C.data)?b=C.data.map(Bz):b=Bz(C.data);let w;return yae(C)&&(w=C.included.map(Bz)),Object.assign(Object.assign(Object.assign({},C),{data:b}),w?{included:w}:{})}function bae(C){if(typeof C!="object"||C===null||!("data"in C))return!1;const b=C;if(!Array.isArray(b.data))return!1;const w=b;if(w.data.length===0)return!1;const D=w.data[0];return!(typeof D!="object"||D===null||!("id"in D)||!("type"in D)||!("attributes"in D)||D.type!=="api_error")}class vae extends Error{constructor(b){super("API Error!"),Object.setPrototypeOf(this,new.target.prototype),"captureStackTrace"in Error?Error.captureStackTrace(this,R2):this.stack=new Error().stack,this.request=b.request,this.preCallStack=b.preCallStack,this.message=`${b.request.method} ${b.request.url}: Timeout error`,this.preCallStack&&(this.stack+=` Caused By: ${this.preCallStack}`)}}class R2 extends Error{constructor(b){super("API Error!"),Object.setPrototypeOf(this,new.target.prototype),"captureStackTrace"in Error?Error.captureStackTrace(this,R2):this.stack=new Error().stack,this.request=b.request,this.response=b.response,this.preCallStack=b.preCallStack;let w=`${b.request.method} ${b.request.url}: ${this.response.status} ${this.response.statusText}`;this.errors.length>0&&(w+=` ${JSON.stringify(this.errors,null,2)}`),this.message=w,this.preCallStack&&(this.stack+=` Caused By: ${this.preCallStack}`)}get errors(){return bae(this.response.body)?this.response.body.data:[]}findError(b,w){const D=Array.isArray(b)?b:[b];return this.errors.find(I=>D.includes(I.attributes.code)&&(!w||(typeof w=="function"?w(I.attributes.details):Object.entries(w).every(([B,F])=>I.attributes.details[B]===F))))}}class Lz extends Error{constructor(){super("Promise canceled!"),Object.setPrototypeOf(this,new.target.prototype)}}function Pz(C,b){let w=null;const D=new Promise((I,B)=>{w=()=>{try{b&&b(),B(new Lz)}catch(j){B(j)}},(typeof C=="function"?C():C).then(I,B)});return w&&(D.cancel=w),D}function sI(C){return new Promise(b=>{setTimeout(b,C)})}var _ae=function(C,b,w,D){function I(B){return B instanceof w?B:new w(function(F){F(B)})}return new(w||(w=Promise))(function(B,F){function j(re){try{Y(D.next(re))}catch(he){F(he)}}function ne(re){try{Y(D.throw(re))}catch(he){F(he)}}function Y(re){re.done?B(re.value):I(re.value).then(j,ne)}Y((D=D.apply(C,b||[])).next())})};function wae(C){return _ae(this,void 0,void 0,function*(){let b,w=0;do try{w+=1,yield sI(w*1e3),b=yield C()}catch(D){if(!(D instanceof R2)||D.response.status!==404)throw D}while(!b);return b})}var Rz={},xv={},dX={},ate;function Cse(){return ate||(ate=1,(function(C){Object.defineProperty(C,"__esModule",{value:!0}),C.TaskCollisionStrategy=void 0,(function(b){b[b.DEFAULT=0]="DEFAULT",b[b.KEEP_THIS=1]="KEEP_THIS",b[b.KEEP_OTHER=2]="KEEP_OTHER",b[b.KEEP_BOTH=3]="KEEP_BOTH",b[b.RESOLVE_THIS=4]="RESOLVE_THIS",b[b.RESOLVE_OTHER=5]="RESOLVE_OTHER"})(C.TaskCollisionStrategy||(C.TaskCollisionStrategy={}))})(dX)),dX}var eI={},ite;function xse(){if(ite)return eI;ite=1,Object.defineProperty(eI,"__esModule",{value:!0});let C=class{constructor(w,D){this._code=w,this._message=D}get code(){return this._code}get message(){return this._message}};return eI.default=C,eI}var D2={},cte;function Ese(){if(cte)return D2;cte=1,Object.defineProperty(D2,"__esModule",{value:!0}),D2.mutexEquality=D2.mutexBitwiseAnd=void 0;function C(w,D){return(w&D)!==0}D2.mutexBitwiseAnd=C;function b(w,D){return w===D}return D2.mutexEquality=b,D2}var tI={},lte;function kae(){if(lte)return tI;lte=1,Object.defineProperty(tI,"__esModule",{value:!0});let C=class{constructor(w,D){this._meta=void 0,this._task=w,this._scheduler=D}withDescriptor(w){return this._descriptor=w,this}withMutex(w){return this._mutex=w,this}withMeta(w){return this._meta=w,this}runBeforeExecuting(w){return this._onPreExecute=w,this}handleCollisions(w){return this._onTaskCollision=w,this}execute(w){return this._scheduler.enqueue({priority:w,mutex:this._mutex,descriptor:this._descriptor,meta:this._meta,execute:this._task,onPreExecute:this._onPreExecute,onTaskCollision:this._onTaskCollision})}};return tI.default=C,tI}var ute;function Sae(){if(ute)return xv;ute=1;var C=xv&&xv.__awaiter||function(Y,re,he,ie){function Le(ye){return ye instanceof he?ye:new he(function(De){De(ye)})}return new(he||(he=Promise))(function(ye,De){function Pe(Q){try{je(ie.next(Q))}catch(pt){De(pt)}}function Dt(Q){try{je(ie.throw(Q))}catch(pt){De(pt)}}function je(Q){Q.done?ye(Q.value):Le(Q.value).then(Pe,Dt)}je((ie=ie.apply(Y,re||[])).next())})},b=xv&&xv.__importDefault||function(Y){return Y&&Y.__esModule?Y:{default:Y}};Object.defineProperty(xv,"__esModule",{value:!0});const w=Cse(),D=b(xse()),I=Ese(),B=b(kae());var F;(function(Y){Y[Y.PENDING=0]="PENDING",Y[Y.EXECUTING=1]="EXECUTING",Y[Y.TERMINATED=2]="TERMINATED"})(F||(F={}));function j(Y,re){for(let he of Y.listeners)he.reject(re)}let ne=class{constructor(re,he={}){this._queue=[],this._isExecuting=!1,this._idleListeners=[],this._maxConcurrentTasks=re,this._samePriorityMutex=!!he.samePriorityMutex,this._mutexStrategy=he.mutexStrategy||I.mutexEquality,he.disableLogging?this._errorLog=()=>{}:this._errorLog=console.error}enqueue(re){return new Promise((he,ie)=>{typeof re=="function"&&(re={priority:0,execute:re});const Le=this._checkMutexes(re,he,ie);Le.task?this._addTask(Le.task):Le.canceled&&ie(this.createCanceledError())})}prepare(re){return new B.default(re,this)}_addTask(re){this._queue.push(re),this._applyPriorities(),this._isExecuting||(this._isExecuting=!0,setTimeout(this._executeNextTasks.bind(this)))}get executingTasks(){return this._queue.reduce((re,he)=>he.state===F.EXECUTING?re+1:re,0)}createCanceledError(){return new D.default(50,"Task has been canceled in favor of another task")}_findFirstPendingTask(){return this._queue.find(re=>re.state===F.PENDING)}_isIdle(){return this._queue.length===0||!this._queue.find(re=>re.state!==F.TERMINATED)}_removeTaskAt(re){this._queue.splice(re,1)}_executeTask(re){return C(this,void 0,void 0,function*(){try{return re.task.onPreExecute&&re.task.onPreExecute(),yield re.task.execute()}catch(he){throw he}finally{re.state=F.TERMINATED;let he=this._queue.indexOf(re);this._removeTaskAt(he),this._executeNextTasks()}})}_executeNextTasks(){let re=this.executingTasks;if(re>=this._maxConcurrentTasks)return;let he=this._maxConcurrentTasks-re;for(let ie=0;ie<he;ie++){const Le=this._findFirstPendingTask();if(!Le){this._isIdle()&&this._switchToIdle();return}Le.state=F.EXECUTING,this._executeTask(Le).then(ye=>{for(const{resolve:De}of Le.listeners)try{De(ye)}catch(Pe){this._errorLog("An error occurred while resolving listener",Pe)}}).catch(ye=>{for(const{reject:De}of Le.listeners)try{De(ye)}catch(Pe){this._errorLog("An error occurred while rejecting listener",Pe)}})}}_switchToIdle(){this._isExecuting=!1;const re=this._idleListeners;this._idleListeners=[];for(const{resolve:he}of re)try{he()}catch{}}waitForIdle(){return this._isExecuting?new Promise((re,he)=>{this._idleListeners.push({resolve:re,reject:he})}):Promise.resolve()}_applyPriorities(){this._queue.sort((re,he)=>he.task.priority-re.task.priority)}_checkMutexes(re,he,ie){for(let Le=0;Le<this._queue.length;Le++){let ye=this._queue[Le];if(ye.state===F.TERMINATED||this._samePriorityMutex&&ye.task.priority!=re.priority||!ye.task.mutex||!re.mutex||!this._mutexStrategy(ye.task.mutex,re.mutex))continue;let De,Pe;if(ye.task.onTaskCollision)if(De=ye.task.onTaskCollision(re),De===w.TaskCollisionStrategy.KEEP_OTHER&&ye.state!==F.EXECUTING){this._removeTaskAt(Le--),j(ye,this.createCanceledError());continue}else{if(De===w.TaskCollisionStrategy.KEEP_THIS)return{canceled:!0};if(De===w.TaskCollisionStrategy.RESOLVE_OTHER)return this._removeTaskAt(Le--),{canceled:!1,task:{task:re,state:F.PENDING,listeners:[{resolve:he,reject:ie},...ye.listeners]}};if(De===w.TaskCollisionStrategy.RESOLVE_THIS)return ye.listeners=[...ye.listeners,{resolve:he,reject:ie}],{canceled:!1}}if(re.onTaskCollision){if(Pe=re.onTaskCollision(ye.task),Pe===w.TaskCollisionStrategy.KEEP_OTHER)return{canceled:!0};if(Pe===w.TaskCollisionStrategy.KEEP_THIS){this._removeTaskAt(Le--),j(ye,this.createCanceledError());continue}else{if(Pe===w.TaskCollisionStrategy.RESOLVE_OTHER)return ye.listeners=[...ye.listeners,{resolve:he,reject:ie}],{canceled:!1};if(Pe===w.TaskCollisionStrategy.RESOLVE_THIS)return this._removeTaskAt(Le--),{canceled:!1,task:{task:re,state:F.PENDING,listeners:[{resolve:he,reject:ie},...ye.listeners]}}}}if(!(De===w.TaskCollisionStrategy.KEEP_BOTH&&Pe===w.TaskCollisionStrategy.KEEP_BOTH))return{canceled:!0}}return{canceled:!1,task:{task:re,state:F.PENDING,listeners:[{resolve:he,reject:ie}]}}}};return xv.default=ne,xv}var dte;function Cae(){return dte||(dte=1,(function(C){var b=Rz&&Rz.__importDefault||function(F){return F&&F.__esModule?F:{default:F}};Object.defineProperty(C,"__esModule",{value:!0}),C.mutexEquality=C.mutexBitwiseAnd=C.SchedulerError=C.TaskCollisionStrategy=C.Scheduler=void 0;const w=b(Sae());C.Scheduler=w.default;const D=Cse();Object.defineProperty(C,"TaskCollisionStrategy",{enumerable:!0,get:function(){return D.TaskCollisionStrategy}});const I=b(xse());C.SchedulerError=I.default;const B=Ese();Object.defineProperty(C,"mutexBitwiseAnd",{enumerable:!0,get:function(){return B.mutexBitwiseAnd}}),Object.defineProperty(C,"mutexEquality",{enumerable:!0,get:function(){return B.mutexEquality}})})(Rz)),Rz}var xae=Cae(),M2=function(C){return this instanceof M2?(this.v=C,this):new M2(C)},Eae=function(C,b,w){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var D=w.apply(C,b||[]),I,B=[];return I={},F("next"),F("throw"),F("return"),I[Symbol.asyncIterator]=function(){return this},I;function F(ie){D[ie]&&(I[ie]=function(Le){return new Promise(function(ye,De){B.push([ie,Le,ye,De])>1||j(ie,Le)})})}function j(ie,Le){try{ne(D[ie](Le))}catch(ye){he(B[0][3],ye)}}function ne(ie){ie.value instanceof M2?Promise.resolve(ie.value.v).then(Y,re):he(B[0][2],ie)}function Y(ie){j("next",ie)}function re(ie){j("throw",ie)}function he(ie,Le){ie(Le),B.shift(),B.length&&j(B[0][0],B[0][1])}};function db(C,b,w,D){return Eae(this,arguments,function*(){const B=w?.perPage||C.defaultLimit;if(B>C.maxLimit)throw new Error(`perPage option cannot exceed maximum value of ${C.maxLimit}`);const F=w?.concurrency||1;if(F>10)throw new Error("concurrency option cannot exceed maximum value of 10");const j=yield M2(b({limit:B,offset:0}));for(const he of j.data)yield yield M2(he);const ne=j.meta.total_count,Y=new xae.Scheduler(F),re=[];for(let he=B;he<ne;he+=B)re.push(Y.enqueue(()=>b({limit:B,offset:he})));for(;re.length>0;){const he=yield M2(re.shift());for(const ie of he.data)yield yield M2(D?Bz(ie):ie)}})}function fb(C){C&&"page"in C&&console.warn("Passing a `page` query param on paged iterators has no effect: use the `perPage` option instead.")}const Tse="__ARRAY_INDEX__";function Tae(C){return C.reduce((b,w,D)=>D===0?w:w===Tse?`${b}[]`:`${b}[${w}]`,"")}function Aae(C){if(typeof C=="number"||typeof C=="string")return C.toString();if(C===!0)return"true";if(C===!1)return"false";throw`Don't know how to serialize param value ${JSON.stringify(C)}`}function gJ(C,b=[]){const w=[];if(typeof C=="number"||typeof C=="string"||typeof C=="boolean")w.push([Tae(b),Aae(C)]);else if(typeof C=="object"){if(Array.isArray(C))for(const D of C)for(const I of gJ(D,[...b,Tse]))w.push(I);else if(C)for(const[D,I]of Object.entries(C))for(const B of gJ(I,[...b,D]))w.push(B)}return w}var Oae=function(C,b,w,D){function I(B){return B instanceof w?B:new w(function(F){F(B)})}return new(w||(w=Promise))(function(B,F){function j(re){try{Y(D.next(re))}catch(he){F(he)}}function ne(re){try{Y(D.throw(re))}catch(he){F(he)}}function Y(re){re.done?B(re.value):I(re.value).then(j,ne)}Y((D=D.apply(C,b||[])).next())})};const zae=typeof window<"u"&&typeof window.document<"u",Dae=5;var rg;(function(C){C[C.NONE=0]="NONE",C[C.BASIC=1]="BASIC",C[C.BODY=2]="BODY",C[C.BODY_AND_HEADERS=3]="BODY_AND_HEADERS"})(rg||(rg={}));function Mae(C){const b={};return C.forEach((w,D)=>{b[D]=w}),b}function fte(C,b,w,D,I,B,F){return{request:{url:b,method:C,headers:w,body:D},response:{status:I.status,statusText:I.statusText,headers:Mae(I.headers),body:B},preCallStack:F}}function Rae(C,b,w,D,I){return{request:{url:b,method:C,headers:w,body:D},preCallStack:I}}function Nae(C,b,w,D,I,B,F){return{request:{url:b,method:C,headers:w,body:D},response:{status:I,statusText:"N/A",headers:{},body:B},preCallStack:F}}function Bae(C){return typeof C=="object"&&!!C&&"code"in C}function Lae(C){return Object.fromEntries(Object.entries(C).map(([b,w])=>[b.toLowerCase(),w]))}let mte=1;function Pae(C){const b=C||(typeof fetch>"u"?void 0:fetch)||(typeof globalThis>"u"?void 0:globalThis.fetch);if(typeof b>"u")throw new Error("fetch() is not available: either polyfill it globally, or provide it as fetchFn option.");return b}function rI(C){var b;return Oae(this,void 0,void 0,function*(){const w=mte;mte+=1;const D=Pae(C.fetchFn),I=C.preCallStack,B=C.userAgent||"@datocms/rest-client-utils",F=C.retryCount||1,j=C.logLevel||rg.NONE,ne="autoRetry"in C?C.autoRetry:!0,Y=C.logFn||(()=>!0),re=Object.assign({"content-type":"application/json",accept:"application/json",authorization:`Bearer ${C.apiToken}`,"user-agent":B},C.extraHeaders?Lae(C.extraHeaders):{});zae&&delete re["user-agent"];const he=C.baseUrl.replace(/\/$/,""),ie=C.body?JSON.stringify(C.body,null,2):void 0,Le=C.queryParams&&Object.keys(C.queryParams).length>0?`?${new URLSearchParams(gJ(C.queryParams)).toString()}`:"",ye=`${he}${C.url}${Le}`;if(j>=rg.BASIC){if(Y(`[${w}] ${C.method} ${ye}`),j>=rg.BODY_AND_HEADERS)for(const[De,Pe]of Object.entries(re||{}))Y(`[${w}] ${De}: ${Pe}`);j>=rg.BODY&&ie&&Y(`[${w}] ${ie}`)}try{const De=Pz(D(ye,{method:C.method,headers:re,body:ie})),Pe=setTimeout(()=>{De.cancel()},C.requestTimeout||3e4),Dt=yield De;clearTimeout(Pe);const je=Dt.headers.get("Content-Type"),Q=je&&!je.includes("application/json");if(Dt.status===429||Q){if(!ne||Q&&C.method!=="GET")throw new R2(fte(C.method,ye,re,C.body,Dt,void 0,I));const q=Dt.headers.has("X-RateLimit-Reset")?Number.parseInt(Dt.headers.get("X-RateLimit-Reset"),10):F;return j>=rg.BASIC&&(Dt.status===429?Y(`[${w}] Rate limit exceeded, wait ${q} seconds then retry...`):Y(`[${w}] Invalid response content type "${je}" (status ${Dt.status}). Wait ${q} seconds then retry...`)),yield sI(q*1e3),rI(Object.assign(Object.assign({},C),{retryCount:F+1}))}if(j>=rg.BASIC&&(Y(`[${w}] Status: ${Dt.status} (${Dt.statusText})`),j>=rg.BODY_AND_HEADERS))for(const q of["x-api-version","x-environment","x-queue-time","x-ratelimit-remaining","x-request-id","cf-ray"]){const Xe=Dt.headers.get(q);Xe&&Y(`[${w}] ${q}: ${Xe}`)}let pt=Dt.status===204?void 0:yield Dt.json();if(j>=rg.BODY&&pt&&Y(`[${w}] ${JSON.stringify(pt,null,2)}`),Dt.status===202){const q=yield C.fetchJobResult(pt.data.id);if(q.status<200||q.status>=300)throw new R2(Nae(C.method,ye,re,C.body,q.status,q.payload,I));pt=q.payload}if(Dt.status>=200&&Dt.status<300)return pt;const qt=new R2(fte(C.method,ye,re,C.body,Dt,pt,I)),ct=(b=qt.errors.find(q=>q.attributes.transient))===null||b===void 0?void 0:b.attributes.code;if(ne&&ct)return j>=rg.BASIC&&Y(`[${w}] ${ct}, wait ${F} seconds then retry...`),yield sI(F*1e3),rI(Object.assign(Object.assign({},C),{retryCount:F+1}));throw qt}catch(De){if(De instanceof Lz||Bae(De)&&De.code.includes("ETIMEDOUT")){if(ne&&F<Dae)return j>=rg.BASIC&&Y(`[${w}] Timeout error, wait ${F} seconds then retry...`),yield sI(F*1e3),rI(Object.assign(Object.assign({},C),{retryCount:F+1}));throw new vae(Rae(C.method,ye,re,C.body,I))}throw De}})}var Ase=function(C,b){var w={};for(var D in C)Object.prototype.hasOwnProperty.call(C,D)&&b.indexOf(D)<0&&(w[D]=C[D]);if(C!=null&&typeof Object.getOwnPropertySymbols=="function")for(var I=0,D=Object.getOwnPropertySymbols(C);I<D.length;I++)b.indexOf(D[I])<0&&Object.prototype.propertyIsEnumerable.call(C,D[I])&&(w[D[I]]=C[D[I]]);return w};function aI(C){return typeof C=="object"&&!!C&&"id"in C&&"type"in C}function fX(C){return Array.isArray(C)&&C.every(aI)}function Xn(C,b){if(typeof C!="object"||!C)throw new Error("Invalid body!");if(Array.isArray(C))return{data:C.map(Y=>{var re;return(re=Xn(Y,b))===null||re===void 0?void 0:re.data})};const w=C,{id:D,type:I,meta:B}=w,F=Ase(w,["id","type","meta"]),j={},ne={};if(b.attributes==="*")for(const[Y,re]of Object.entries(F))if(b.relationships.includes(Y))if(aI(re)){const{id:he,type:ie}=re;ne[Y]={data:{id:he,type:ie}}}else fX(re)?ne[Y]={data:re.map(({id:he,type:ie})=>({id:he,type:ie}))}:ne[Y]={data:null};else j[Y]=re;else if(b.relationships==="*")for(const[Y,re]of Object.entries(F))if(b.attributes.includes(Y))j[Y]=re;else if(aI(re)){const{id:he,type:ie}=re;ne[Y]={data:{id:he,type:ie}}}else fX(re)?ne[Y]={data:re.map(({id:he,type:ie})=>({id:he,type:ie}))}:ne[Y]={data:null};else{for(const[Y,re]of Object.entries(F))if(b.attributes.includes(Y))j[Y]=re;else if(b.relationships.includes(Y))if(aI(re)){const{id:he,type:ie}=re;ne[Y]={data:{id:he,type:ie}}}else fX(re)?ne[Y]={data:re.map(({id:he,type:ie})=>({id:he,type:ie}))}:ne[Y]={data:null};b.attributes.includes("type")&&(j.type=I)}return{data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},D||b.id?{id:D||b.id}:{}),{type:b.type}),Object.keys(j).length>0?{attributes:j}:{}),Object.keys(ne).length>0?{relationships:ne}:{}),B?{meta:B}:{})}}function pJ(C){if(Array.isArray(C))return C.map(pJ);if(C&&typeof C=="object"){const b={};for(const[w,D]of Object.entries(C))w!=="__itemTypeId"&&(b[w]=pJ(D));return b}return C}function hte(C){if(!C||typeof C!="object")return C;const{__itemTypeId:b}=C,w=Ase(C,["__itemTypeId"]),D={};for(const[I,B]of Object.entries(w))D[I]=pJ(B);return D}function nI(C){return!C||!("data"in C)?C:Array.isArray(C.data)?Object.assign(Object.assign({},C),{data:C.data.map(hte)}):Object.assign(Object.assign({},C),{data:hte(C.data)})}function Ct(C){return typeof C=="string"?C:C.id}class ts{constructor(b){this.client=b}}class Ose extends ts{create(b){return this.rawCreate(Xn(b,{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(w=>Ke(w))}rawCreate(b){return this.client.request({method:"POST",url:"/roles",body:b})}update(b,w){return this.rawUpdate(Ct(b),Xn(w,{id:Ct(b),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(D=>Ke(D))}rawUpdate(b,w){return this.client.request({method:"PUT",url:`/roles/${b}`,body:w})}list(){return this.rawList().then(b=>Ke(b))}rawList(){return this.client.request({method:"GET",url:"/roles"})}find(b){return this.rawFind(Ct(b)).then(w=>Ke(w))}rawFind(b){return this.client.request({method:"GET",url:`/roles/${b}`})}destroy(b){return this.rawDestroy(Ct(b)).then(w=>Ke(w))}rawDestroy(b){return this.client.request({method:"DELETE",url:`/roles/${b}`})}duplicate(b){return this.rawDuplicate(Ct(b)).then(w=>Ke(w))}rawDuplicate(b){return this.client.request({method:"POST",url:`/roles/${b}/duplicate`})}}Ose.TYPE="role";var Iae=function(C,b,w,D){function I(B){return B instanceof w?B:new w(function(F){F(B)})}return new(w||(w=Promise))(function(B,F){function j(re){try{Y(D.next(re))}catch(he){F(he)}}function ne(re){try{Y(D.throw(re))}catch(he){F(he)}}function Y(re){re.done?B(re.value):I(re.value).then(j,ne)}Y((D=D.apply(C,b||[])).next())})};function gte(C,b){return C==null&&b==null?!0:C===b}function $ae(C,b){for(const w in C)if(!gte(C[w],b[w]))return!1;for(const w in b)if(!gte(C[w],b[w]))return!1;return!0}function oI(C,b,w,D){if(!b)return C;const{add:I,remove:B}=b;return[...B?B.reduce((F,j)=>{const ne=Object.assign(Object.assign({},j),{environment:w}),Y=F.find(re=>$ae(re,ne));if(!Y)throw new Error(`Cannot find rule ${JSON.stringify(ne)} to remove in ${D}!`);return F.filter(re=>re!==Y)},C):C,...I?I.map(F=>Object.assign({environment:w},F)):[]]}class Fae extends Ose{updateCurrentEnvironmentPermissions(b,w){return Iae(this,void 0,void 0,function*(){const D=this.client.config.environment||(yield this.client.environments.list()).find(ne=>ne.meta.primary).id,I=yield this.find(b),B=!!(w.positive_item_type_permissions||w.negative_item_type_permissions),F=!!(w.positive_upload_permissions||w.negative_upload_permissions),j=Object.assign(Object.assign({},B?{positive_item_type_permissions:oI(I.positive_item_type_permissions,w.positive_item_type_permissions,D,"positive_item_type_permissions"),negative_item_type_permissions:oI(I.negative_item_type_permissions,w.negative_item_type_permissions,D,"negative_item_type_permissions")}:{}),F?{positive_upload_permissions:oI(I.positive_upload_permissions,w.positive_upload_permissions,D,"positive_upload_permissions"),negative_upload_permissions:oI(I.negative_upload_permissions,w.negative_upload_permissions,D,"negative_upload_permissions")}:{});return this.update(b,j)})}}class zse extends ts{update(b,w){return this.rawUpdate(Ct(b),Xn(w,{id:Ct(b),type:"user",attributes:["is_active"],relationships:["role"]})).then(D=>Ke(D))}rawUpdate(b,w){return this.client.request({method:"PUT",url:`/users/${b}`,body:w})}list(){return this.rawList().then(b=>Ke(b))}rawList(){return this.client.request({method:"GET",url:"/users"})}find(b,w){return this.rawFind(Ct(b),w).then(D=>Ke(D))}rawFind(b,w){return this.client.request({method:"GET",url:`/users/${b}`,queryParams:w})}findMe(b){return this.rawFindMe(b).then(w=>Ke(w))}rawFindMe(b){return this.client.request({method:"GET",url:"/users/me",queryParams:b})}destroy(b,w){return this.rawDestroy(Ct(b),w).then(D=>Ke(D))}rawDestroy(b,w){return this.client.request({method:"DELETE",url:`/users/${b}`,queryParams:w})}}zse.TYPE="user";class Dse extends ts{list(){return this.rawList().then(b=>Ke(b))}rawList(){return this.client.request({method:"GET",url:"/sso-users"})}find(b){return this.rawFind(Ct(b)).then(w=>Ke(w))}rawFind(b){return this.client.request({method:"GET",url:`/sso-users/${b}`})}copyUsers(){return this.rawCopyUsers().then(b=>Ke(b))}rawCopyUsers(){return this.client.request({method:"POST",url:"/sso-users/copy-users"})}destroy(b,w){return this.rawDestroy(Ct(b),w).then(D=>Ke(D))}rawDestroy(b,w){return this.client.request({method:"DELETE",url:`/sso-users/${b}`,queryParams:w})}}Dse.TYPE="sso_user";class Mse extends ts{query(b){return this.rawQuery(Xn(b,{type:"audit_log_query",attributes:["filter","next_token","detailed_log"],relationships:[]})).then(w=>Ke(w))}rawQuery(b){return this.client.request({method:"POST",url:"/audit-log-events/query",body:b})}}Mse.TYPE="audit_log_event";class Rse extends ts{create(b){return this.rawCreate(Xn(b,{type:"menu_item",attributes:["label","external_url","position","open_in_new_tab"],relationships:["item_type","item_type_filter","parent"]})).then(w=>Ke(w))}rawCreate(b){return this.client.request({method:"POST",url:"/menu-items",body:b})}update(b,w){return this.rawUpdate(Ct(b),Xn(w,{id:Ct(b),type:"menu_item",attributes:["label","external_url","position","open_in_new_tab"],relationships:["item_type","item_type_filter","parent"]})).then(D=>Ke(D))}rawUpdate(b,w){return this.client.request({method:"PUT",url:`/menu-items/${b}`,body:w})}list(b){return this.rawList(b).then(w=>Ke(w))}rawList(b){return this.client.request({method:"GET",url:"/menu-items",queryParams:b})}find(b){return this.rawFind(Ct(b)).then(w=>Ke(w))}rawFind(b){return this.client.request({method:"GET",url:`/menu-items/${b}`})}destroy(b){return this.rawDestroy(Ct(b)).then(w=>Ke(w))}rawDestroy(b){return this.client.request({method:"DELETE",url:`/menu-items/${b}`})}reorder(b){return this.rawReorder(Xn(b,{type:"menu_item",attributes:["position"],relationships:["parent"]})).then(w=>Ke(w))}rawReorder(b){return this.client.request({method:"POST",url:"/menu-items/reorder",body:b})}}Rse.TYPE="menu_item";class Nse extends ts{create(b){return this.rawCreate(Xn(b,{type:"schema_menu_item",attributes:["label","position","kind"],relationships:["item_type","parent"]})).then(w=>Ke(w))}rawCreate(b){return this.client.request({method:"POST",url:"/schema-menu-items",body:b})}update(b,w){return this.rawUpdate(Ct(b),Xn(w,{id:Ct(b),type:"schema_menu_item",attributes:["label","position","kind"],relationships:["item_type","parent","children"]})).then(D=>Ke(D))}rawUpdate(b,w){return this.client.request({method:"PUT",url:`/schema-menu-items/${b}`,body:w})}list(b){return this.rawList(b).then(w=>Ke(w))}rawList(b){return this.client.request({method:"GET",url:"/schema-menu-items",queryParams:b})}find(b){return this.rawFind(Ct(b)).then(w=>Ke(w))}rawFind(b){return this.client.request({method:"GET",url:`/schema-menu-items/${b}`})}destroy(b){return this.rawDestroy(Ct(b)).then(w=>Ke(w))}rawDestroy(b){return this.client.request({method:"DELETE",url:`/schema-menu-items/${b}`})}reorder(b){return this.rawReorder(Xn(b,{type:"schema_menu_item",attributes:["position"],relationships:["parent"]})).then(w=>Ke(w))}rawReorder(b){return this.client.request({method:"POST",url:"/schema-menu-items/reorder",body:b})}}Nse.TYPE="schema_menu_item";class Bse extends ts{create(b){return this.rawCreate(Xn(b,{type:"upload_collection",attributes:["label","position"],relationships:["parent"]})).then(w=>Ke(w))}rawCreate(b){return this.client.request({method:"POST",url:"/upload-collections",body:b})}update(b,w){return this.rawUpdate(Ct(b),Xn(w,{id:Ct(b),type:"upload_collection",attributes:["label","position"],relationships:["parent","children"]})).then(D=>Ke(D))}rawUpdate(b,w){return this.client.request({method:"PUT",url:`/upload-collections/${b}`,body:w})}list(b){return this.rawList(b).then(w=>Ke(w))}rawList(b){return this.client.request({method:"GET",url:"/upload-collections",queryParams:b})}find(b){return this.rawFind(Ct(b)).then(w=>Ke(w))}rawFind(b){return this.client.request({method:"GET",url:`/upload-collections/${b}`})}destroy(b){return this.rawDestroy(Ct(b)).then(w=>Ke(w))}rawDestroy(b){return this.client.request({method:"DELETE",url:`/upload-collections/${b}`})}reorder(b){return this.rawReorder(Xn(b,{type:"upload_collection",attributes:["position"],relationships:["parent"]})).then(w=>Ke(w))}rawReorder(b){return this.client.request({method:"POST",url:"/upload-collections/reorder",body:b})}}Bse.TYPE="upload_collection";class Lse extends ts{create(b,w){return this.rawCreate(Xn(b,{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"]}),w).then(D=>Ke(D))}rawCreate(b,w){return this.client.request({method:"POST",url:"/item-types",body:b,queryParams:w})}update(b,w){return this.rawUpdate(Ct(b),Xn(w,{id:Ct(b),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(D=>Ke(D))}rawUpdate(b,w){return this.client.request({method:"PUT",url:`/item-types/${b}`,body:w})}list(){return this.rawList().then(b=>Ke(b))}rawList(){return this.client.request({method:"GET",url:"/item-types"})}find(b){return this.rawFind(Ct(b)).then(w=>Ke(w))}rawFind(b){return this.client.request({method:"GET",url:`/item-types/${b}`})}duplicate(b){return this.rawDuplicate(Ct(b)).then(w=>Ke(w))}rawDuplicate(b){return this.client.request({method:"POST",url:`/item-types/${b}/duplicate`})}destroy(b,w){return this.rawDestroy(Ct(b),w).then(D=>Ke(D))}rawDestroy(b,w){return this.client.request({method:"DELETE",url:`/item-types/${b}`,queryParams:w})}referencing(b){return this.rawReferencing(Ct(b)).then(w=>Ke(w))}rawReferencing(b){return this.client.request({method:"GET",url:`/item-types/${b}/referencing`})}rawReorderFieldsAndFieldsets(b,w){return this.client.request({method:"POST",url:`/item-types/${b}/reorder-fields-and-fieldsets`,body:w})}}Lse.TYPE="item_type";class Pse extends ts{create(b,w){return this.rawCreate(Ct(b),Xn(w,{type:"field",attributes:["label","field_type","api_key","localized","validators","appeareance","appearance","position","hint","default_value","deep_filtering_enabled"],relationships:["fieldset"]})).then(D=>Ke(D))}rawCreate(b,w){return this.client.request({method:"POST",url:`/item-types/${b}/fields`,body:w})}update(b,w){return this.rawUpdate(Ct(b),Xn(w,{id:Ct(b),type:"field",attributes:["default_value","label","api_key","localized","validators","appeareance","appearance","position","field_type","hint","deep_filtering_enabled"],relationships:["fieldset"]})).then(D=>Ke(D))}rawUpdate(b,w){return this.client.request({method:"PUT",url:`/fields/${b}`,body:w})}list(b){return this.rawList(Ct(b)).then(w=>Ke(w))}rawList(b){return this.client.request({method:"GET",url:`/item-types/${b}/fields`})}referencing(b){return this.rawReferencing(Ct(b)).then(w=>Ke(w))}rawReferencing(b){return this.client.request({method:"GET",url:`/item-types/${b}/fields/referencing`})}related(b){return this.rawRelated(Ct(b)).then(w=>Ke(w))}rawRelated(b){return this.client.request({method:"GET",url:`/item-types/${b}/fields/related`})}find(b){return this.rawFind(Ct(b)).then(w=>Ke(w))}rawFind(b){return this.client.request({method:"GET",url:`/fields/${b}`})}destroy(b){return this.rawDestroy(Ct(b)).then(w=>Ke(w))}rawDestroy(b){return this.client.request({method:"DELETE",url:`/fields/${b}`})}duplicate(b){return this.rawDuplicate(Ct(b)).then(w=>Ke(w))}rawDuplicate(b){return this.client.request({method:"POST",url:`/fields/${b}/duplicate`})}}Pse.TYPE="field";class Ise extends ts{create(b,w){return this.rawCreate(Ct(b),Xn(w,{type:"fieldset",attributes:["title","hint","position","collapsible","start_collapsed"],relationships:[]})).then(D=>Ke(D))}rawCreate(b,w){return this.client.request({method:"POST",url:`/item-types/${b}/fieldsets`,body:w})}update(b,w){return this.rawUpdate(Ct(b),Xn(w,{id:Ct(b),type:"fieldset",attributes:["title","hint","position","collapsible","start_collapsed"],relationships:[]})).then(D=>Ke(D))}rawUpdate(b,w){return this.client.request({method:"PUT",url:`/fieldsets/${b}`,body:w})}list(b){return this.rawList(Ct(b)).then(w=>Ke(w))}rawList(b){return this.client.request({method:"GET",url:`/item-types/${b}/fieldsets`})}find(b){return this.rawFind(Ct(b)).then(w=>Ke(w))}rawFind(b){return this.client.request({method:"GET",url:`/fieldsets/${b}`})}destroy(b){return this.rawDestroy(Ct(b)).then(w=>Ke(w))}rawDestroy(b){return this.client.request({method:"DELETE",url:`/fieldsets/${b}`})}}Ise.TYPE="fieldset";class $se extends ts{create(b){return this.rawCreate(Xn(b,{type:"email_credentials",attributes:["email","password","otp_code"],relationships:[]})).then(w=>Ke(w))}rawCreate(b){return this.client.request({method:"POST",url:"/sessions",body:b})}}$se.TYPE="session";class Fse extends ts{create(b){return this.rawCreate(Xn(b,{type:"access_token",attributes:["name","can_access_cda","can_access_cda_preview","can_access_cma"],relationships:["role"]})).then(w=>Ke(w))}rawCreate(b){return this.client.request({method:"POST",url:"/access_tokens",body:b})}update(b,w){return this.rawUpdate(Ct(b),Xn(w,{id:Ct(b),type:"access_token",attributes:["name","can_access_cda","can_access_cda_preview","can_access_cma"],relationships:["role"]})).then(D=>Ke(D))}rawUpdate(b,w){return this.client.request({method:"PUT",url:`/access_tokens/${b}`,body:w})}list(){return this.rawList().then(b=>Ke(b))}rawList(){return this.client.request({method:"GET",url:"/access_tokens"})}find(b){return this.rawFind(Ct(b)).then(w=>Ke(w))}rawFind(b){return this.client.request({method:"GET",url:`/access_tokens/${b}`})}regenerateToken(b){return this.rawRegenerateToken(Ct(b)).then(w=>Ke(w))}rawRegenerateToken(b){return this.client.request({method:"POST",url:`/access_tokens/${b}/regenerate_token`})}destroy(b,w){return this.rawDest