9 lines
139 KiB
JavaScript
9 lines
139 KiB
JavaScript
|
|
var Xo=Object.create;var Nr=Object.defineProperty;var eu=Object.getOwnPropertyDescriptor;var tu=Object.getOwnPropertyNames;var ru=Object.getPrototypeOf,su=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Zn=(t,e)=>{for(var r in e)Nr(t,r,{get:e[r],enumerable:!0})},nu=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tu(e))!su.call(t,n)&&n!==r&&Nr(t,n,{get:()=>e[n],enumerable:!(s=eu(e,n))||s.enumerable});return t};var $e=(t,e,r)=>(r=t!=null?Xo(ru(t)):{},nu(e||!t||!t.__esModule?Nr(r,"default",{value:t,enumerable:!0}):r,t));var ut=y((ch,Qn)=>{Qn.exports=window.wp.data});var kr=y((dh,Xn)=>{Xn.exports=window.wp.i18n});var lt=y(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.regexpCode=q.getEsmExportName=q.getProperty=q.safeStringify=q.stringify=q.strConcat=q.addCodeArg=q.str=q._=q.nil=q._Code=q.Name=q.IDENTIFIER=q._CodeOrName=void 0;var ct=class{};q._CodeOrName=ct;q.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ne=class extends ct{constructor(e){if(super(),!q.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};q.Name=Ne;var W=class extends ct{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,s)=>`${r}${s}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,s)=>(s instanceof Ne&&(r[s.str]=(r[s.str]||0)+1),r),{})}};q._Code=W;q.nil=new W("");function ii(t,...e){let r=[t[0]],s=0;for(;s<e.length;)Mr(r,e[s]),r.push(t[++s]);return new W(r)}q._=ii;var Cr=new W("+");function ai(t,...e){let r=[dt(t[0])],s=0;for(;s<e.length;)r.push(Cr),Mr(r,e[s]),r.push(Cr,dt(t[++s]));return wu(r),new W(r)}q.str=ai;function Mr(t,e){e instanceof W?t.push(...e._items):e instanceof Ne?t.push(e):t.push(Su(e))}q.addCodeArg=Mr;function wu(t){let e=1;for(;e<t.length-1;){if(t[e]===Cr){let r=bu(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function bu(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ne||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ne))return`"${t}${e.slice(1)}`}function Eu(t,e){return e.emptyStr()?t:t.emptyStr()?e:ai`${t}${e}`}q.strConcat=Eu;function Su(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:dt(Array.isArray(t)?t.join(","):t)}function Pu(t){return new W(dt(t))}q.stringify=Pu;function dt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}q.safeStringify=dt;function Ou(t){return typeof t=="string"&&q.IDENTIFIER.test(t)?new W(`.${t}`):ii`[${t}]`}q.getProperty=Ou;function Tu(t){if(typeof t=="string"&&q.IDENTIFIER.test(t))return new W(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}q.getEsmExportName=Tu;function Iu(t){return new W(t.toString())}q.regexpCode=Iu});var xr=y(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.ValueScope=B.ValueScopeName=B.Scope=B.varKinds=B.UsedValueState=void 0;var H=lt(),zr=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Ft;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Ft||(B.UsedValueState=Ft={}));B.varKinds={const:new H.Name("const"),let:new H.Name("let"),var:new H.Name("var")};var Kt=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof H.Name?e:this.name(e)}name(e){return new H.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,s;if(!((s=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||s===void 0)&&s.has(e)||this._prefixes&&!this._prefixe
|
||
|
|
`:""},this._extScope=e,this._scope=new te.Scope({parent:e}),this._nodes=[new Hr]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let s=this._extScope.value(e,r);return(this._values[s.prefix]||(this._values[s.prefix]=new Set)).add(s),s}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,s,n){let i=this._scope.toName(r);return s!==void 0&&n&&(this._constants[i.str]=s),this._leafNode(new Vr(e,i,s)),i}const(e,r,s){return this._def(te.varKinds.const,e,r,s)}let(e,r,s){return this._def(te.varKinds.let,e,r,s)}var(e,r,s){return this._def(te.varKinds.var,e,r,s)}assign(e,r,s){return this._leafNode(new Ht(e,r,s))}add(e,r){return this._leafNode(new Ur(e,S.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==T.nil&&this._leafNode(new Gr(e)),this}object(...e){let r=["{"];for(let[s,n]of e)r.length>1&&r.push(","),r.push(s),(s!==n||this.opts.es5)&&(r.push(":"),(0,T.addCodeArg)(r,n));return r.push("}"),new T._Code(r)}if(e,r,s){if(this._blockNode(new ke(e)),r&&s)this.code(r).else().code(s).endIf();else if(r)this.code(r).endIf();else if(s)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ke(e))}else(){return this._elseNode(new Ve)}endIf(){return this._endBlockNode(ke,Ve)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Br(e),r)}forRange(e,r,s,n,i=this.opts.es5?te.varKinds.var:te.varKinds.let){let a=this._scope.toName(e);return this._for(new Yr(i,a,r,s),()=>n(a))}forOf(e,r,s,n=te.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let a=r instanceof T.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,T._)`${a}.length`,o=>{this.var(i,(0,T._)`${a}[${o}]`),s(i)})}return this._for(new Bt("of",n,i,r),()=>s(i))}forIn(e,r,s,n=this.opts.es5?te.varKinds.var:te.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,T._)`Object.keys(${r})`,s);let i=this._scope.toName(e);return this._for(new Bt("in",n,i,r),()=>s(i))}endFor(){return this._endBlockNode(qe)}label(e){return this._leafNode(new Lr(e))}break(e){return this._leafNode(new Fr(e))}return(e){let r=new pt;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(pt)}try(e,r,s){if(!r&&!s)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new Jr;if(this._blockNode(n),this.code(e),r){let i=this.name("e");this._currNode=n.catch=new ht(i),r(i)}return s&&(this._currNode=n.finally=new yt,this.code(s)),this._endBlockNode(ht,yt)}throw(e){return this._leafNode(new Kr(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let s=this._nodes.length-r;if(s<0||e!==void 0&&s!==e)throw new Error(`CodeGen: wrong number of nodes: ${s} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=T.nil,s,n){return this._blockNode(new mt(e,r,s)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(mt)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let s=this._currNode;if(s instanceof e||r&&s instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ke))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};S.CodeGen=Wr;function Re(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Yt(t,e){return e instanceof T
|
||
|
|
|| (${a} == "string" && ${n} && ${n} == +${n})`).assign(o,(0,E._)`+${n}`);return;case"integer":s.elseIf((0,E._)`${a} === "boolean" || ${n} === null
|
||
|
|
|| (${a} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(o,(0,E._)`+${n}`);return;case"boolean":s.elseIf((0,E._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(o,!1).elseIf((0,E._)`${n} === "true" || ${n} === 1`).assign(o,!0);return;case"null":s.elseIf((0,E._)`${n} === "" || ${n} === 0 || ${n} === false`),s.assign(o,null);return;case"array":s.elseIf((0,E._)`${a} === "string" || ${a} === "number"
|
||
|
|
|| ${a} === "boolean" || ${n} === null`).assign(o,(0,E._)`[${n}]`)}}}function gc({gen:t,parentData:e,parentDataProperty:r},s){t.if((0,E._)`${e} !== undefined`,()=>t.assign((0,E._)`${e}[${r}]`,s))}function ns(t,e,r,s=Ke.Correct){let n=s===Ke.Correct?E.operators.EQ:E.operators.NEQ,i;switch(t){case"null":return(0,E._)`${e} ${n} null`;case"array":i=(0,E._)`Array.isArray(${e})`;break;case"object":i=(0,E._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=a((0,E._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=a();break;default:return(0,E._)`typeof ${e} ${n} ${t}`}return s===Ke.Correct?i:(0,E.not)(i);function a(o=E.nil){return(0,E.and)((0,E._)`typeof ${e} == "number"`,o,r?(0,E._)`isFinite(${e})`:E.nil)}}F.checkDataType=ns;function is(t,e,r,s){if(t.length===1)return ns(t[0],e,r,s);let n,i=(0,Ei.toHash)(t);if(i.array&&i.object){let a=(0,E._)`typeof ${e} != "object"`;n=i.null?a:(0,E._)`!${e} || ${a}`,delete i.null,delete i.array,delete i.object}else n=E.nil;i.number&&delete i.integer;for(let a in i)n=(0,E.and)(n,ns(a,e,r,s));return n}F.checkDataTypes=is;var $c={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,E._)`{type: ${t}}`:(0,E._)`{type: ${e}}`};function as(t){let e=vc(t);(0,mc.reportError)(e,$c)}F.reportTypeError=as;function vc(t){let{gen:e,data:r,schema:s}=t,n=(0,Ei.schemaRefOrVal)(t,s,"type");return{gen:e,keyword:"type",data:r,schema:s.type,schemaCode:n,schemaValue:n,parentSchema:s,params:{},it:t}}});var Ti=y(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.assignDefaults=void 0;var Ge=b(),wc=N();function bc(t,e){let{properties:r,items:s}=t.schema;if(e==="object"&&r)for(let n in r)Oi(t,n,r[n].default);else e==="array"&&Array.isArray(s)&&s.forEach((n,i)=>Oi(t,i,n.default))}Zt.assignDefaults=bc;function Oi(t,e,r){let{gen:s,compositeRule:n,data:i,opts:a}=t;if(r===void 0)return;let o=(0,Ge._)`${i}${(0,Ge.getProperty)(e)}`;if(n){(0,wc.checkStrictMode)(t,`default is ignored for: ${o}`);return}let u=(0,Ge._)`${o} === undefined`;a.useDefaults==="empty"&&(u=(0,Ge._)`${u} || ${o} === null || ${o} === ""`),s.if(u,(0,Ge._)`${o} = ${(0,Ge.stringify)(r)}`)}});var Z=y(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.validateUnion=R.validateArray=R.usePattern=R.callValidateCode=R.schemaProperties=R.allSchemaProperties=R.noPropertyInData=R.propertyInData=R.isOwnProperty=R.hasPropFunc=R.reportMissingProp=R.checkMissingProp=R.checkReportMissingProp=void 0;var C=b(),os=N(),be=_e(),Ec=N();function Sc(t,e){let{gen:r,data:s,it:n}=t;r.if(cs(r,s,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,C._)`${e}`},!0),t.error()})}R.checkReportMissingProp=Sc;function Pc({gen:t,data:e,it:{opts:r}},s,n){return(0,C.or)(...s.map(i=>(0,C.and)(cs(t,e,i,r.ownProperties),(0,C._)`${n} = ${i}`)))}R.checkMissingProp=Pc;function Oc(t,e){t.setParams({missingProperty:e},!0),t.error()}R.reportMissingProp=Oc;function Ii(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,C._)`Object.prototype.hasOwnProperty`})}R.hasPropFunc=Ii;function us(t,e,r){return(0,C._)`${Ii(t)}.call(${e}, ${r})`}R.isOwnProperty=us;function Tc(t,e,r,s){let n=(0,C._)`${e}${(0,C.getProperty)(r)} !== undefined`;return s?(0,C._)`${n} && ${us(t,e,r)}`:n}R.propertyInData=Tc;function cs(t,e,r,s){let n=(0,C._)`${e}${(0,C.getProperty)(r)} === undefined`;return s?(0,C.or)(n,(0,C.not)(us(t,e,r))):n}R.noPropertyInData=cs;function Ni(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}R.allSchemaProperties=Ni;function Ic(t,e){return Ni(e).filter(r=>!(0,os.alwaysValidSchema)(t,e[r]))}R.schemaProperties=Ic;function Nc({schemaCode:t,data:e,it:{gen:r,topSchemaRef:s,schemaPath:n,errorPath:i},it:a},o,u,d){let c=d?(0,C._)`${t}, ${e}, ${s}${n}`:e,l=[[be.default.instancePath,(0,C.strConcat)(be.default.instancePath,i)],[be.default.parentData,a.parentData],[be.default.parentDataProperty,a.parentDataProperty],[be.default.rootData,be.default.rootData]];a.opts.dynamicRef&&l.push([be.default.dynamicAnchors,be.default.dynamicAnchors]);let h=(0,C._)`${c},
|
||
|
|
missingProperty: ${s},
|
||
|
|
depsCount: ${e},
|
||
|
|
deps: ${r}}`};var Xf={keyword:"dependencies",type:"object",schemaType:"object",error:ce.error,code(t){let[e,r]=em(t);Ya(t,e),Ja(t,r)}};function em({schema:t}){let e={},r={};for(let s in t){if(s==="__proto__")continue;let n=Array.isArray(t[s])?e:r;n[s]=t[s]}return[e,r]}function Ya(t,e=t.schema){let{gen:r,data:s,it:n}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let a in e){let o=e[a];if(o.length===0)continue;let u=(0,Mt.propertyInData)(r,s,a,n.opts.ownProperties);t.setParams({property:a,depsCount:o.length,deps:o.join(", ")}),n.allErrors?r.if(u,()=>{for(let d of o)(0,Mt.checkReportMissingProp)(t,d)}):(r.if((0,pn._)`${u} && (${(0,Mt.checkMissingProp)(t,o,i)})`),(0,Mt.reportMissingProp)(t,i),r.else())}}ce.validatePropertyDeps=Ya;function Ja(t,e=t.schema){let{gen:r,data:s,keyword:n,it:i}=t,a=r.name("valid");for(let o in e)(0,Qf.alwaysValidSchema)(i,e[o])||(r.if((0,Mt.propertyInData)(r,s,o,i.opts.ownProperties),()=>{let u=t.subschema({keyword:n,schemaProp:o},a);t.mergeValidEvaluated(u,a)},()=>r.var(a,!0)),t.ok(a))}ce.validateSchemaDeps=Ja;ce.default=Xf});var Qa=y(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});var Za=b(),tm=N(),rm={message:"property name must be valid",params:({params:t})=>(0,Za._)`{propertyName: ${t.propertyName}}`},sm={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:rm,code(t){let{gen:e,schema:r,data:s,it:n}=t;if((0,tm.alwaysValidSchema)(n,r))return;let i=e.name("valid");e.forIn("key",s,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),e.if((0,Za.not)(i),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(i)}};hn.default=sm});var _n=y(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});var mr=Z(),ne=b(),nm=_e(),pr=N(),im={message:"must NOT have additional properties",params:({params:t})=>(0,ne._)`{additionalProperty: ${t.additionalProperty}}`},am={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:im,code(t){let{gen:e,schema:r,parentSchema:s,data:n,errsCount:i,it:a}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:o,opts:u}=a;if(a.props=!0,u.removeAdditional!=="all"&&(0,pr.alwaysValidSchema)(a,r))return;let d=(0,mr.allSchemaProperties)(s.properties),c=(0,mr.allSchemaProperties)(s.patternProperties);l(),t.ok((0,ne._)`${i} === ${nm.default.errors}`);function l(){e.forIn("key",n,_=>{!d.length&&!c.length?f(_):e.if(h(_),()=>f(_))})}function h(_){let g;if(d.length>8){let I=(0,pr.schemaRefOrVal)(a,s.properties,"properties");g=(0,mr.isOwnProperty)(e,I,_)}else d.length?g=(0,ne.or)(...d.map(I=>(0,ne._)`${_} === ${I}`)):g=ne.nil;return c.length&&(g=(0,ne.or)(g,...c.map(I=>(0,ne._)`${(0,mr.usePattern)(t,I)}.test(${_})`))),(0,ne.not)(g)}function p(_){e.code((0,ne._)`delete ${n}[${_}]`)}function f(_){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){p(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),o||e.break();return}if(typeof r=="object"&&!(0,pr.alwaysValidSchema)(a,r)){let g=e.name("valid");u.removeAdditional==="failing"?(m(_,g,!1),e.if((0,ne.not)(g),()=>{t.reset(),p(_)})):(m(_,g),o||e.if((0,ne.not)(g),()=>e.break()))}}function m(_,g,I){let O={keyword:"additionalProperties",dataProp:_,dataPropType:pr.Type.Str};I===!1&&Object.assign(O,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(O,g)}}};yn.default=am});var to=y($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});var om=bt(),Xa=Z(),gn=N(),eo=_n(),um={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:s,data:n,it:i}=t;i.opts.removeAdditional==="all"&&s.additionalProperties===void 0&&eo.default.code(new om.KeywordCxt(i,eo.default,"additionalProperties"));let a=(0,Xa.allSchemaProperties)(r);for(let l of a)i.definedProperties.add(l);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=gn.mergeEvaluated.props(e,(0,gn.toHash)(a),i.props));let o=a.filter(l=>!(0,gn.alwaysValidSchema)(i,r[l]));if(o.length===0)return;let u=e.nam
|