vcard4
Version:
An RFC 6350 compliant JavaScript library for generating and parsing version 4.0 vCards. Can also generate RFC 6351 compliant XML vCards and RFC 7095 compliant jCards. TypeScript type declarations are provided.
1 lines • 166 kB
JavaScript
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).vcard4={})}(this,(function(e){"use strict";function r(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function t(e,r,t){if("function"==typeof e?e===r:e.has(r))return arguments.length<3?r:t;throw new TypeError("Private element is not present on this object")}function a(e,r,t){return r=d(r),function(e,r){if(r&&("object"==typeof r||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,m()?Reflect.construct(r,t||[],d(e).constructor):r.apply(e,t))}function n(e,r){if(r.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function o(e,r){return e.get(t(e,r))}function u(e,r,t){n(e,r),r.set(e,t)}function s(e,r,a){return e.set(t(e,r),a),a}function c(e,r){n(e,r),r.add(e)}function p(e,r){for(var t=0;t<r.length;t++){var a=r[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,A(a.key),a)}}function f(e,r,t){return r&&p(e.prototype,r),t&&p(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=k(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return o=e.done,e},e:function(e){u=!0,i=e},f:function(){try{o||null==t.return||t.return()}finally{if(u)throw i}}}}function y(e,r,t){return(r=A(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function h(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&w(e,r)}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(m=function(){return!!e})()}function v(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function P(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?v(Object(t),!0).forEach((function(r){y(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function w(e,r){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},w(e,r)}function T(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var a,n,i,o,u=[],s=!0,c=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;s=!1}else for(;!(s=(a=i.call(t)).done)&&(u.push(a.value),u.length!==r);s=!0);}catch(e){c=!0,n=e}finally{try{if(!s&&null!=t.return&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw n}}return u}}(e,r)||k(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||k(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,r||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function k(e,t){if(e){if("string"==typeof e)return r(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?r(e,t):void 0}}function S(e){var r="function"==typeof Map?new Map:void 0;return S=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(r){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return function(e,r,t){if(m())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,r);var n=new(e.bind.apply(e,a));return t&&w(n,t.prototype),n}(e,arguments,d(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),w(t,e)},S(e)}var O=function(e){function r(e){var t;return i(this,r),(t=a(this,r,[e])).name="MissingArgument",t}return h(r,e),f(r)}(S(Error));Object.freeze(O);var M=function(e){function r(e){var t;return i(this,r),(t=a(this,r,[e])).name="InvalidArgument",t}return h(r,e),f(r)}(S(Error));Object.freeze(M);var L=function(e){function r(e){var t;return i(this,r),(t=a(this,r,[e])).name="InvalidVcard",t}return h(r,e),f(r)}(S(Error));Object.freeze(L);var N=new WeakMap,I=function(){return f((function e(){if(i(this,e),u(this,N,["type","value","valueXML","valueJSON","identifier"]),this.constructor===e)throw new Error("Cannot create instance of base class")}),[{key:"checkAbstractPropertiesAndMethods",value:function(){var e=this;if(!o(N,this).every((function(r){return Object.prototype.hasOwnProperty.call(e,r)||Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(e),r)||Object.prototype.hasOwnProperty.call(e.constructor,r)})))throw new Error("All abstract properties and methods in abstract base class must be defined in child class")}},{key:"repr",value:function(){return this.value}},{key:"reprXML",value:function(){return this.valueXML}},{key:"reprJSON",value:function(){return this.valueJSON}}])}();Object.freeze(I);var E=new WeakMap,X=new WeakSet,J=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),X),u(n,E,void 0),t(X,n,V).call(n,e),s(E,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return t(X,this,j).call(this,o(E,this))}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(t(X,this,W).call(this,o(E,this)),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),o(E,this)]}},{key:"_unsafe_raw_value",get:function(){return o(E,this)}}])}(I);function V(e){if(void 0===e||""===e)throw new O("Value for TextType must be supplied");if("string"!=typeof e)throw new TypeError("Only type string allowed for TextType value")}function j(e){return e.replaceAll("\\","\\\\").replaceAll(",","\\,").replaceAll(":","\\:").replaceAll(";","\\;").replaceAll("\n","\\n")}function W(e){return e.replaceAll("&","&").replaceAll(">",">").replaceAll("<","<").replaceAll('"',""").replaceAll("'","'")}y(J,"type","TEXT"),y(J,"identifier","TextType"),Object.freeze(J);var x=new WeakMap,z=new WeakSet,D=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),z),u(n,x,void 0),t(z,n,R).call(n,e),s(x,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(x,this).reduce((function(e,r){return e.push(r.repr()),e}),[]).join(",")}},{key:"valueXML",get:function(){return o(x,this).reduce((function(e,r){return e+r.reprXML()}),"")}},{key:"valueJSON",get:function(){var e=o(x,this).reduce((function(e,r){return e.push(r.reprJSON().pop()),e}),[]);return e.unshift(this.constructor.type.toLowerCase()),e}}])}(I);function R(e){if(void 0===e)throw new O("Value for TextListType must be supplied");if(!Array.isArray(e))throw new TypeError("Value for TextListType must be passed in an array");var r,t=l(e);try{for(t.s();!(r=t.n()).done;){if("TextType"!==r.value.constructor.identifier)throw new TypeError("Invalid type for value of TextListType. It should be an array of TextTypes")}}catch(e){t.e(e)}finally{t.f()}}y(D,"type","TEXT"),y(D,"identifier","TextListType"),Object.freeze(D);var C=new WeakMap,F=new WeakSet,U=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),F),u(n,C,void 0),t(F,n,$).call(n,e),s(C,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return"".concat(o(C,this))}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(o(C,this),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),o(C,this)]}}])}(I);function $(e){if(void 0===e)throw new O("boolValue must be supplied");if("boolean"!=typeof e)throw new TypeError("Value for BooleanType should be of type boolean")}y(U,"type","BOOLEAN"),y(U,"identifier","BooleanType"),Object.freeze(U);var G=new WeakMap,_=new WeakMap,B=new WeakMap,Z=new WeakMap,K=new WeakMap,H=new WeakMap,Y=new WeakMap,q=new WeakSet,Q=function(e){function r(e,n){var p;return i(this,r),c(p=a(this,r),q),u(p,G,void 0),u(p,_,/^(?:(?:\d{4})|(?:(?:\d{4}(?:(?:(?:0[469]|11)(?:[0-2]\d|30))|(?:(?:0[13578]|1[02])(?:[0-2]\d|3[01]))))|(?:\d{2}(?:(?:(?:[02468][048]|[13579][26])(?:02)(?:[0-2]\d))|(?:(:?\d[13579]|[02468][26]|[13579][048])(?:02)(?:[0-2][0-8]|[01]9)))))|(?:-{2}(?:(?:(?:0[469]|11)(?:[0-2]\d|30)?)|(?:(?:0[13578]|1[02])(?:[0-2]\d|3[01])?)|(?:(?:02)(?:[0-2]\d)?)))|(?:-{3}(?:[0-2]\d|3[01]))|(?:\d{4}-(?:(?:0[1-9])|1[0-2])))$/),u(p,B,/^(?:(?:(?:(?:[01]\d)|(?:2[0-3]))(?:(?:[0-5]\d){1,2})?)|(?:-(?:[0-5]\d){1,2})|(?:-{2}[0-5]\d))(?:Z|(?:[+-]((?:[01]\d)|(?:2[0-3]))(?:[0-5]\d)?))?$/),u(p,Z,/^(?:(?:(?:\d{4}(?:(?:(?:0[469]|11)(?:[0-2]\d|30))|(?:(?:0[13578]|1[02])(?:[0-2]\d|3[01]))))|(?:\d{2}(?:(?:(?:[02468][048]|[13579][26])(?:02)(?:[0-2]\d))|(?:(:?\d[13579]|[02468][26]|[13579][048])(?:02)(?:[0-2][0-8]|[01]9)))))|(?:-{2}(?:(?:(?:0[469]|11)(?:[0-2]\d|30))|(?:(?:0[13578]|1[02])(?:[0-2]\d|3[01]))|(?:(?:02)(?:[0-2]\d))))|(?:-{3}(?:[0-2]\d|3[01])))(?:T)(?:(?:(?:(?:[01]\d)|(?:2[0-3]))(?:(?:[0-5]\d){1,2})?)(?:Z|(?:[+-]((?:[01]\d)|(?:2[0-3]))(?:[0-5]\d)?))?)$/),u(p,K,new RegExp("(?:".concat(o(_,p).source,"|").concat(o(B,p).source.replace("^","^T"),"|").concat(o(Z,p).source,")"))),u(p,H,/^(?:(?:\d{4}(?:(?:(?:0[469]|11)(?:[0-2]\d|30))|(?:(?:0[13578]|1[02])(?:[0-2]\d|3[01]))))|(?:\d{2}(?:(?:(?:[02468][048]|[13579][26])(?:02)(?:[0-2]\d))|(?:(:?\d[13579]|[02468][26]|[13579][048])(?:02)(?:[0-2][0-8]|[01]9)))))(?:T)(?:(?:(?:(?:[01]\d)|(?:2[0-3]))(?:[0-5]\d){2})(?:Z|(?:[+-]((?:[01]\d)|(?:2[0-3]))(?:[0-5]\d)?))?)$/),u(p,Y,/^(?:[+-]((?:[01]\d)|(?:2[0-3]))(?:[0-5]\d)?)$/),t(q,p,ee).call(p,e,n),s(G,p,n),p.checkAbstractPropertiesAndMethods(),Object.freeze(p),p}return h(r,e),f(r,[{key:"value",get:function(){return"".concat(o(G,this))}},{key:"valueXML",get:function(){var e=this.type.toLowerCase(),r=o(G,this);if("date-and-or-time"===e)switch(!0){case o(_,this).test(r):e="date";break;case o(B,this).test(r):e="time";break;case o(Z,this).test(r):e="date-time"}return"<".concat(e,">").concat(r,"</").concat(e,">")}},{key:"valueJSON",get:function(){var e,r=this.type.toLowerCase();function t(e){return/^\d{8}$/.test(e)?((e=b(e)).splice(4,0,"-"),e.splice(7,0,"-"),e.join("")):/^-{2}\d{4}$/.test(e)?((e=b(e)).splice(4,0,"-"),e.join("")):e}function a(e){for(var r=[],t=0;t<e.length;t+=2)/^\d$/.test(e[t])?(r.push(e[t]),r.push(e[t+1]),/^\d$/.test(e[t+2])&&r.push(":")):(r.push(e[t]),t--);return r.join("")}switch(r){case"date":e=t(o(G,this));break;case"time":case"utc-offset":e=a(o(G,this));break;case"date-time":case"timestamp":e=t((e=o(G,this).split("T"))[0])+"T"+a(e[1]);break;case"date-and-or-time":e=o(G,this).includes("T")?t((e=o(G,this).split("T"))[0])+"T"+a(e[1]):t(o(G,this))}return[r,e]}}])}(I);function ee(e,r){if(void 0===r||void 0===e)throw new O("Value and type for DateTimeType must be supplied");if(!/^(?:(?:date((?:andor)?(?:time))?)|(?:time(?:stamp)?)|(?:utcoffset))$/.test(e))throw new M("Accepted values of type for DateTimeType are date, time, datetime, dateandortime, timestamp or utcoffset");switch(e){case"date":if(!o(_,this).test(r))throw new M("Invalid value for type date of DateTimeType");this.type="DATE";break;case"time":if(!o(B,this).test(r))throw new M("Invalid value for type time of DateTimeType");this.type="TIME";break;case"datetime":if(!o(Z,this).test(r))throw new M("Invalid value for type datetime of DateTimeType");this.type="DATE-TIME";break;case"dateandortime":if(!o(K,this).test(r))throw new M("Invalid value for type dateandortime of DateTimeType");this.type="DATE-AND-OR-TIME";break;case"timestamp":if(!o(H,this).test(r))throw new M("Invalid value for type timestamp of DateTimeType");this.type="TIMESTAMP";break;case"utcoffset":if(!o(Y,this).test(r))throw new M("Invalid value for type utcoffset of DateTimeType");this.type="UTC-OFFSET";break;default:throw new M("Accepted values for type property of type object for DateTimeType are date, time, datetime, dateandortime, timestamp or utcoffset")}}y(Q,"identifier","DateTimeType"),Object.freeze(Q);var re=new WeakMap,te=new WeakSet,ae=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),te),u(n,re,void 0),t(te,n,ne).call(n,e),s(re,n,e),n.type=e[0].type,n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(re,this).reduce((function(e,r){return e.push(r.repr()),e}),[]).join(",")}},{key:"valueXML",get:function(){return o(re,this).reduce((function(e,r){return e+r.reprXML()}),"")}},{key:"valueJSON",get:function(){var e=o(re,this).reduce((function(e,r){return e.push(r.reprJSON().pop()),e}),[]);return e.unshift(this.type.toLowerCase()),e}}])}(I);function ne(e){if(void 0===e)throw new O("Value for DateTimeListType must be supplied");if(!Array.isArray(e))throw new TypeError("Value for DateTimeListType should be passed in an array");var r,t=e[0].type,a=l(e);try{for(a.s();!(r=a.n()).done;){var n=r.value;if(n.type!==t)throw new TypeError("Value for DateTimeListType should be an array of DateTimeTypes of the same type");if("UTC-OFFSET"===n.type)throw new TypeError("Invalid type for value of DateTimeListType");if("DateTimeType"!==n.constructor.identifier)throw new TypeError("Value for DateTimeListType should be an array of DateTimeTypes")}}catch(e){a.e(e)}finally{a.f()}}y(ae,"identifier","DateTimeListType"),Object.freeze(ae);var ie=new WeakMap,oe=new WeakSet,ue=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),oe),u(n,ie,void 0),t(oe,n,se).call(n,e),s(ie,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return"".concat(o(ie,this))}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(o(ie,this),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),o(ie,this)]}}])}(I);function se(e){if(void 0===e)throw new O("Value for IntegerType must be supplied");if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Value for IntegerType must be of type number or bigint");if(/\./.test(e.toString()))throw new M("Invalid value for IntegerType");if(!("number"!=typeof e||-Number.MAX_SAFE_INTEGER<e&&e<Number.MAX_SAFE_INTEGER))throw new M("The maximum value is ".concat(Number.MAX_SAFE_INTEGER,", and the minimum value is ").concat(Number.MIN_SAFE_INTEGER," for number IntegerType"));if("bigint"==typeof e&&!(-9223372036854775809n<e&&e<9223372036854775808n))throw new M("The maximum value is 9223372036854775807n, and the minimum value is -9223372036854775808n for bigint IntegerType")}y(ue,"type","INTEGER"),y(ue,"identifier","IntegerType"),Object.freeze(ue);var ce=new WeakMap,pe=new WeakSet,fe=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),pe),u(n,ce,void 0),t(pe,n,le).call(n,e),s(ce,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(ce,this).reduce((function(e,r){return e.push(r.repr()),e}),[]).join(",")}},{key:"valueXML",get:function(){return o(ce,this).reduce((function(e,r){return e+r.reprXML()}),"")}},{key:"valueJSON",get:function(){var e=o(ce,this).reduce((function(e,r){return e.push(r.reprJSON().pop()),e}),[]);return e.unshift(this.constructor.type.toLowerCase()),e}}])}(I);function le(e){if(void 0===e)throw new O("Value for IntegerListType must be supplied");if(!Array.isArray(e))throw new TypeError("Value for IntegerListType must be passed in an array");var r,t=l(e);try{for(t.s();!(r=t.n()).done;){if("IntegerType"!==r.value.constructor.identifier)throw new TypeError("Invalid type for value of IntegerListType. It should be an array of IntegerTypes")}}catch(e){t.e(e)}finally{t.f()}}y(fe,"type","INTEGER"),y(fe,"identifier","IntegerListType"),Object.freeze(fe);var ye=new WeakMap,de=new WeakSet,he=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),de),u(n,ye,void 0),t(de,n,me).call(n,e),s(ye,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return"".concat(o(ye,this))}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(o(ye,this),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),o(ye,this)]}}])}(I);function me(e){if(void 0===e)throw new O("Value for FloatType must be supplied");if("number"!=typeof e&&!/\./.test(e)||!/^[-+]?\d+\.\d+$/.test(e))throw new TypeError("Invalid value for FloatType")}y(he,"type","FLOAT"),y(he,"identifier","FloatType"),Object.freeze(he);var ve=new WeakMap,Pe=new WeakSet,we=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),Pe),u(n,ve,void 0),t(Pe,n,Te).call(n,e),s(ve,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(ve,this).reduce((function(e,r){return e.push(r.repr()),e}),[]).join(",")}},{key:"valueXML",get:function(){return o(ve,this).reduce((function(e,r){return e+r.reprXML()}),"")}},{key:"valueJSON",get:function(){var e=o(ve,this).reduce((function(e,r){return e.push(r.reprJSON().pop()),e}),[]);return e.unshift(this.constructor.type.toLowerCase()),e}}])}(I);function Te(e){if(void 0===e)throw new O("Value for FloatListType must be supplied");if(!Array.isArray(e))throw new TypeError("Value of FloatListType should be passed in an array");var r,t=l(e);try{for(t.s();!(r=t.n()).done;){if("FloatType"!==r.value.constructor.identifier)throw new TypeError("Value of FloatListType should be an array of FloatTypes")}}catch(e){t.e(e)}finally{t.f()}}y(we,"type","FLOAT"),y(we,"identifier","FloatListType"),Object.freeze(we);var be=new WeakMap,Ae=new WeakMap,ge=new WeakSet,ke=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),ge),u(n,be,void 0),u(n,Ae,/^(?:[a-zA-Z]{2,3}(-[a-zA-Z]{3}){0,3})(-[0-9A-Za-z]+){0,3}(-x(-[0-9A-Za-z]{1,8})+)?(-[0-9A-WY-Za-wy-z]+)?(-[0-9A-Za-z]+)?$/),t(ge,n,Se).call(n,e),s(be,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(be,this)}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(o(be,this),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),o(be,this)]}}])}(I);function Se(e){if(void 0===e)throw new O("Value for LanguageTagType must be supplied");if("string"!=typeof e)throw new TypeError("Value for LanguageTagType should be of type string");if(!o(Ae,this).test(e))throw new M("Invalid language tag")}y(ke,"type","LANGUAGE-TAG"),y(ke,"identifier","LanguageTagType"),Object.freeze(ke);var Oe=new WeakMap,Me=new WeakMap,Le=new WeakSet,Ne=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),Le),u(n,Oe,void 0),u(n,Me,new RegExp("([A-Za-z][A-Za-z0-9+\\-.]*):(?:(//)(?:((?:[A-Za-z0-9\\-._~!$&'()*+,;=:]|%[0-9A-Fa-f]{2})*)@)?((?:\\[(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}|::(?:[0-9A-Fa-f]{1,4}:){5}|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}|(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}|(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}:|(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::)(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)|[Vv][0-9A-Fa-f]+\\.[A-Za-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:[A-Za-z0-9\\-._~!$&'()*+,;=]|%[0-9A-Fa-f]{2})*))(?::([0-9]*))?((?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|/((?:(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)?)|((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|)(?:\\?((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?(?:\\#((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?")),t(Le,n,Ie).call(n,e),s(Oe,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(Oe,this)}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(o(Oe,this),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),o(Oe,this)]}}])}(I);function Ie(e){if(void 0===e)throw new O("Value for URIType must be supplied");if("string"!=typeof e)throw new TypeError("Value for URIType should be of type string");if(!o(Me,this).test(e))throw new M("Invalid URI")}y(Ne,"type","URI"),y(Ne,"identifier","URIType"),Object.freeze(Ne);var Ee=new WeakMap,Xe=new WeakMap,Je=new WeakSet,Ve=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),Je),u(n,Ee,/^[MFONU]$/),u(n,Xe,void 0),t(Je,n,je).call(n,e),s(Xe,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(Xe,this)}},{key:"valueXML",get:function(){return"<sex>".concat(o(Xe,this),"</sex>")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),o(Xe,this)]}}])}(I);function je(e){if(void 0===e)throw new O("Value for SexType must be supplied");if(!o(Ee,this).test(e))throw new M("Invalid sex")}y(Ve,"type","TEXT"),y(Ve,"identifier","SexType"),Object.freeze(Ve);var We=new WeakSet,xe=function(e){function r(e,n){var o;return i(this,r),c(o=a(this,r),We),t(We,o,ze).call(o,e,n),o.targetProp=e.toUpperCase(),o.checkAbstractPropertiesAndMethods(),Object.freeze(o),o}return h(r,e),f(r)}(I);function ze(e,r){var t,a;if(void 0===r||void 0===e)throw new O("Value and target property for SpecialValueType must be supplied");var n,i;switch(!0){case/^KindProperty$/i.test(e):if("string"!=typeof r||!/^(?:individual|group|org|location|application|x-[a-z0-9-]+)$/i.test(r))throw new M("Invalid value for SpecialValueType for KindProperty");this.value=r,this.valueXML="<text>".concat(r,"</text>"),this.valueJSON=[this.constructor.type.toLowerCase(),r];break;case/^NProperty$/i.test(e):if(!Array.isArray(r)||5!==r.length)throw new M("Invalid value for SpecialValueType for NProperty. It should be an array with a length of 5");for(var o=0;o<r.length;o++)if(r[o]&&"TextType"!==r[o].constructor.identifier&&"TextListType"!==r[o].constructor.identifier)throw new TypeError("Invalid value for SpecialValueType for NProperty. The items in the array, if present, should be of type TextType or TextListType");n=b(r);for(var u=0;u<n.length;u++)n[u]&&(n[u]=n[u].repr());this.value=n.join(";"),this.valueXML="",this.valueJSON=[];for(var s=0;s<r.length;s++)switch(s){case 0:r[s]?(this.valueXML+=r[s].reprXML().replaceAll("text>","surname>"),2===(i=r[s].reprJSON()).length?this.valueJSON[s]=i.pop():(i.shift(),this.valueJSON[s]=i)):(this.valueXML+="<surname/>",this.valueJSON[s]="");break;case 1:r[s]?(this.valueXML+=r[s].reprXML().replaceAll("text>","given>"),2===(i=r[s].reprJSON()).length?this.valueJSON[s]=i.pop():(i.shift(),this.valueJSON[s]=i)):(this.valueXML+="<given/>",this.valueJSON[s]="");break;case 2:r[s]?(this.valueXML+=r[s].reprXML().replaceAll("text>","additional>"),2===(i=r[s].reprJSON()).length?this.valueJSON[s]=i.pop():(i.shift(),this.valueJSON[s]=i)):(this.valueXML+="<additional/>",this.valueJSON[s]="");break;case 3:r[s]?(this.valueXML+=r[s].reprXML().replaceAll("text>","prefix>"),2===(i=r[s].reprJSON()).length?this.valueJSON[s]=i.pop():(i.shift(),this.valueJSON[s]=i)):(this.valueXML+="<prefix/>",this.valueJSON[s]="");break;case 4:r[s]?(this.valueXML+=r[s].reprXML().replaceAll("text>","suffix>"),2===(i=r[s].reprJSON()).length?this.valueJSON[s]=i.pop():(i.shift(),this.valueJSON[s]=i)):(this.valueXML+="<suffix/>",this.valueJSON[s]="")}this.valueJSON=[this.constructor.type.toLowerCase(),this.valueJSON];break;case/^GenderProperty$/i.test(e):if(!Array.isArray(r)||2!==r.length)throw new M("Invalid value for SpecialValueType for GenderProperty. It should be an array with a length of 2");if(r[0]&&"SexType"!==r[0].constructor.identifier)throw new TypeError("Invalid value for SpecialValueType for GenderProperty. The first item in the array, if present, should be of type SexType");if(!r[0]&&!r[1]||r[1]&&"TextType"!==r[1].constructor.identifier)throw new TypeError("Invalid value for SpecialValueType for GenderProperty. The second item in the array, if present, should be of type TextType");this.value=r.reduce((function(e,r){return e?"".concat(e,";").concat(r.repr()):r.repr()}),""),this.valueXML=r.reduce((function(e,r){return e+r.reprXML()}),""),this.valueJSON=r.reduce((function(e,r){return e.push(r.reprJSON().pop()),e}),[]),1===this.valueJSON.length?this.valueJSON.unshift(this.constructor.type.toLowerCase()):this.valueJSON=[this.constructor.type.toLowerCase(),this.valueJSON];break;case/^AdrProperty$/i.test(e):if(!Array.isArray(r)||7!==r.length)throw new M("Invalid value for SpecialValueType for AdrProperty. It should be an array with a length of 7");for(var c=0;c<r.length;c++)if(r[c]&&"TextType"!==r[c].constructor.identifier)throw new TypeError("Invalid value for SpecialValueType for AdrProperty. The items in the array, if present, should be of type TextType");n=b(r);for(var p=0;p<n.length;p++)n[p]&&(n[p]=n[p].repr());this.value=n.join(";"),this.valueXML="",this.valueJSON=[];for(var f=0;f<r.length;f++)switch(f){case 0:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","pobox>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<pobox/>",this.valueJSON[f]="");break;case 1:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","ext>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<ext/>",this.valueJSON[f]="");break;case 2:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","street>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<street/>",this.valueJSON[f]="");break;case 3:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","locality>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<locality/>",this.valueJSON[f]="");break;case 4:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","region>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<region/>",this.valueJSON[f]="");break;case 5:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","code>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<code/>",this.valueJSON[f]="");break;case 6:r[f]?(this.valueXML+=r[f].reprXML().replaceAll("text>","country>"),2===(i=r[f].reprJSON()).length?this.valueJSON[f]=i.pop():(i.shift(),this.valueJSON[f]=i)):(this.valueXML+="<country/>",this.valueJSON[f]="")}this.valueJSON=[this.constructor.type.toLowerCase(),this.valueJSON];break;case/^OrgProperty$/i.test(e):if(!(Array.isArray(r)&&r.length>=1))throw new M("Invalid value for SpecialValueType for OrgProperty. It should be an array with at least one item");for(var l=0;l<r.length;l++){var y;if("TextType"!==(null===(y=r[l])||void 0===y||null===(y=y.constructor)||void 0===y?void 0:y.identifier))throw new TypeError("Invalid value for SpecialValueType for OrgProperty. The items in the array should be of type TextType")}this.value=r.reduce((function(e,r){return e?"".concat(e,";").concat(r.repr()):r.repr()}),""),this.valueXML=r.reduce((function(e,r){return e+r.reprXML()}),""),this.valueJSON=r.reduce((function(e,r){return e.push(r.reprJSON().pop()),e}),[]),1===this.valueJSON.length?this.valueJSON.unshift(this.constructor.type.toLowerCase()):this.valueJSON=[this.constructor.type.toLowerCase(),this.valueJSON];break;case/^ClientpidmapProperty$/i.test(e):if(!Array.isArray(r)||2!==r.length)throw new M("Invalid value for SpecialValueType for ClientpidmapProperty. It should be an array with a length of 2");if("IntegerType"!==(null===(t=r[0])||void 0===t||null===(t=t.constructor)||void 0===t?void 0:t.identifier))throw new TypeError("Invalid value for SpecialValueType for ClientpidmapProperty. The first item in the array should be of type IntegerType");if(0>=Number(r[0].repr()))throw new M("Invalid value for SpecialValueType for ClientpidmapProperty. The first item in the array should be a positive integer of type IntegerType. Zero is not allowed");if("URIType"!==(null===(a=r[1])||void 0===a||null===(a=a.constructor)||void 0===a?void 0:a.identifier))throw new TypeError("Invalid value for SpecialValueType for ClientpidmapProperty. The second item in the array should be of type URIType");this.value=r.reduce((function(e,r){return e?"".concat(e,";").concat(r.repr()):r.repr()}),""),this.valueXML=r.reduce((function(e,r){return e+r.reprXML()}),""),this.valueJSON=["unknown",r.reduce((function(e,r){return e.push(r.reprJSON().pop()),e}),[])];break;default:throw new M("Invalid target property for SpecialValueType")}}y(xe,"identifier","SpecialValueType"),y(xe,"type","TEXT"),Object.freeze(xe);var De=new WeakMap,Re=new WeakSet,Ce=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),Re),u(n,De,void 0),t(Re,n,Fe).call(n,e),s(De,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){var e=t(Re,this,Ue).call(this,o(De,this));return/[:;]/.test(e)?'"'.concat(e,'"'):e}},{key:"valueXML",get:function(){return"<".concat(this.constructor.type.toLowerCase(),">").concat(t(Re,this,$e).call(this,o(De,this)),"</").concat(this.constructor.type.toLowerCase(),">")}},{key:"valueJSON",get:function(){return[this.constructor.type.toLowerCase(),o(De,this)]}},{key:"_unsafe_raw_value",get:function(){return o(De,this)}}])}(I);function Fe(e){if(void 0===e||""===e)throw new O("Value for ParameterValueType must be supplied");if("string"!=typeof e)throw new TypeError("Only type string allowed for ParameterValueType value");if(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/.test(e))throw new M("Value includes forbidden characters")}function Ue(e){return e.replaceAll("^","^^").replaceAll("\n","^n").replaceAll('"',"^’")}function $e(e){return e.replaceAll("&","&").replaceAll(">",">").replaceAll("<","<").replaceAll('"',""").replaceAll("'","'")}y(Ce,"type","TEXT"),y(Ce,"identifier","ParameterValueType"),Object.freeze(Ce);var Ge=new WeakMap,_e=function(){return f((function e(){if(i(this,e),u(this,Ge,["param","value","valueXML","valueJSON","identifier"]),this.constructor===e)throw new Error("Cannot create instance of base class")}),[{key:"checkAbstractPropertiesAndMethods",value:function(){var e=this;if(!o(Ge,this).every((function(r){return Object.prototype.hasOwnProperty.call(e,r)||Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(e),r)||Object.prototype.hasOwnProperty.call(e.constructor,r)})))throw new Error("All abstract properties and methods in abstract base class must be defined in child class")}},{key:"repr",value:function(){return"".concat(this.constructor.param||this.param,"=").concat(this.value)}},{key:"reprXML",value:function(){var e,r,t=(null===(e=this.constructor.param)||void 0===e?void 0:e.toLowerCase())||(null===(r=this.param)||void 0===r?void 0:r.toLowerCase());return/^(?:altid|base|calscale|cc|geo|index|label|language|level|mediatype|pid|pref|sort-as|type|tz|value|x-[A-Za-z0-9]+)$/.test(t)?"value"===t?"":"<".concat(t,">").concat(this.valueXML,"</").concat(t,">"):"<unknown>".concat(this.valueXML.replace(/<[a-z\-]+?>/g,"<text>").replace(/<\/[a-z\-]+?>/g,"</text>"),"</unknown>")}},{key:"reprJSON",value:function(){var e,r,t=(null===(e=this.constructor.param)||void 0===e?void 0:e.toLowerCase())||(null===(r=this.param)||void 0===r?void 0:r.toLowerCase());if("value"===t)return{};var a=this.valueJSON;return a.shift(),1===(a=a.map((function(e){return e.toString()}))).length&&(a=a.pop()),y({},t,a)}}])}();Object.freeze(_e);var Be=new WeakMap,Ze=new WeakSet,Ke=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),Ze),u(n,Be,void 0),t(Ze,n,He).call(n,e),s(Be,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(Be,this).repr()}},{key:"valueXML",get:function(){return o(Be,this).reprXML()}},{key:"valueJSON",get:function(){return o(Be,this).reprJSON()}}])}(_e);function He(e){if(void 0===e)throw new O("Language Tag for LanguageParameter must be supplied");if("LanguageTagType"!==e.constructor.identifier)throw new TypeError("The value of the LANGUAGE property parameter should be of type LanguageTagType")}y(Ke,"param","LANGUAGE"),y(Ke,"identifier","LanguageParameter"),Object.freeze(Ke);var Ye=new WeakMap,qe=new WeakSet,Qe=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),qe),u(n,Ye,void 0),t(qe,n,er).call(n,e),s(Ye,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return(o(Ye,this).type||o(Ye,this).constructor.type).toLowerCase()}},{key:"valueXML",get:function(){return""}},{key:"valueJSON",get:function(){return[]}}])}(_e);function er(e){if(void 0===e)throw new O("Value for ValueParameter must be supplied");if(!Object.prototype.hasOwnProperty.call(e,"type")&&!Object.prototype.hasOwnProperty.call(e.constructor,"type"))throw new M("Value for ValueParameter not recognized")}y(Qe,"param","VALUE"),y(Qe,"identifier","ValueParameter"),Object.freeze(Qe);var rr=new WeakMap,tr=new WeakSet,ar=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),tr),u(n,rr,void 0),t(tr,n,nr).call(n,e),s(rr,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(rr,this).repr()}},{key:"valueXML",get:function(){return o(rr,this).reprXML()}},{key:"valueJSON",get:function(){return o(rr,this).reprJSON()}}])}(_e);function nr(e){if(void 0===e)throw new O("Value for PrefParameter must be supplied");if("IntegerType"!==e.constructor.identifier)throw new TypeError("Value for PrefParameter should be of type IntegerType");if(Number(e.repr())<1||Number(e.repr())>100)throw new M("Value for PrefParameter must be between 1 and 100")}y(ar,"param","PREF"),y(ar,"identifier","PrefParameter"),Object.freeze(ar);var ir=new WeakMap,or=new WeakSet,ur=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),or),u(n,ir,void 0),t(or,n,sr).call(n,e),s(ir,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(ir,this).repr()}},{key:"valueXML",get:function(){return o(ir,this).reprXML()}},{key:"valueJSON",get:function(){return o(ir,this).reprJSON()}}])}(_e);function sr(e){if(void 0===e)throw new O("Value for AltidParameter must be supplied");if("ParameterValueType"!==e.constructor.identifier)throw new M("Value for AltidParameter must be of type ParameterValueType")}y(ur,"param","ALTID"),y(ur,"identifier","AltidParameter"),Object.freeze(ur);var cr=new WeakMap,pr=new WeakMap,fr=new WeakSet,lr=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),fr),u(n,cr,void 0),u(n,pr,/^\d+(?:\.\d+)?$/),t(fr,n,yr).call(n,e),s(cr,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return Array.isArray(o(cr,this))?o(cr,this).map((function(e){return Array.isArray(e)?e.map((function(e){return e.repr()})).join("."):e.repr()})).join(","):o(cr,this).repr()}},{key:"valueXML",get:function(){return(Array.isArray(o(cr,this))?o(cr,this).map((function(e){return Array.isArray(e)?"<integer>"+e.map((function(e){return e.repr()})).join(".")+"</integer>":e.reprXML()})).join(""):o(cr,this).reprXML()).replaceAll("integer","text")}},{key:"valueJSON",get:function(){return Array.isArray(o(cr,this))?["integer"].concat(b(o(cr,this).map((function(e){return Array.isArray(e)?Number(e.map((function(e){return e.repr()})).join(".")):e.reprJSON().pop()})))):o(cr,this).reprJSON()}}])}(_e);function yr(e){if(void 0===e)throw new O("Value for PIDParameter must be supplied");if(!Array.isArray(e)&&"IntegerType"!==e.constructor.identifier)throw new M("Invalid value for PIDParameter");if(Array.isArray(e)&&!e.every((function(e){return Array.isArray(e)?2===e.length&&e.every((function(e){return"IntegerType"===e.constructor.identifier})):"IntegerType"===e.constructor.identifier})))throw new M("Invalid value for PIDParameter")}y(lr,"param","PID"),y(lr,"identifier","PIDParameter"),Object.freeze(lr);var dr=new WeakMap,hr=new WeakMap,mr=new WeakMap,vr=new WeakMap,Pr=new WeakSet,wr=function(e){function r(e,n){var o;return i(this,r),c(o=a(this,r),Pr),u(o,dr,void 0),u(o,hr,/^(?:work|home|x-[a-z0-9-]+)$/i),u(o,mr,/^(?:text|voice|fax|cell|video|pager|textphone|main)$/i),u(o,vr,/(?:contact|acquaintance|friend|met|co-worker|colleague|co-resident|neighbor|child|parent|sibling|spouse|kin|muse|crush|date|sweetheart|me|agent|emergency)/i),t(Pr,o,Tr).call(o,e,n),s(dr,o,n),o.targetProp=e.toUpperCase(),o.checkAbstractPropertiesAndMethods(),Object.freeze(o),o}return h(r,e),f(r,[{key:"value",get:function(){return Array.isArray(o(dr,this))?'"'.concat(o(dr,this).map((function(e){return e.repr()})).join(",").replaceAll('"',""),'"'):o(dr,this).repr()}},{key:"valueXML",get:function(){return Array.isArray(o(dr,this))?o(dr,this).map((function(e){return e.reprXML()})).join(""):o(dr,this).reprXML()}},{key:"valueJSON",get:function(){return Array.isArray(o(dr,this))?["text"].concat(b(o(dr,this).map((function(e){return e._unsafe_raw_value})))):o(dr,this).reprJSON()}}])}(_e);function Tr(e,r){var t=this;if(void 0===r||void 0===e)throw new O("Value and target property for TypeParameter must be supplied");if((Array.isArray(r)||"ParameterValueType"!==r.constructor.identifier)&&(!Array.isArray(r)||!r.every((function(e){return"ParameterValueType"===e.constructor.identifier}))))throw new TypeError("Value for TypeParameter must be of type ParameterValueType or an array of ParameterValueTypes");var a=new RegExp("(?:".concat(o(mr,this).source,"|").concat(o(hr,this).source,")"),"i"),n=new RegExp("(?:".concat(o(vr,this).source,"|").concat(o(hr,this).source,")"),"i");switch(!0){case/^TelProperty$/i.test(e):if((Array.isArray(r)||!a.test(r.repr()))&&(!Array.isArray(r)||!r.every((function(e){return a.test(e.repr())}))))throw new M("Invalid value for TypeParameter for TelProperty");break;case/^RelatedProperty$/i.test(e):if((Array.isArray(r)||!n.test(r.repr()))&&(!Array.isArray(r)||!r.every((function(e){return n.test(e.repr())}))))throw new M("Invalid value for TypeParameter for RelatedProperty");break;default:if((Array.isArray(r)||!o(hr,this).test(r.repr()))&&(!Array.isArray(r)||!r.every((function(e){return o(hr,t).test(e.repr())}))))throw new M("Invalid value for TypeParameter")}}y(wr,"param","TYPE"),y(wr,"identifier","TypeParameter"),Object.freeze(wr);var br=new WeakMap,Ar=new WeakMap,gr=new WeakMap,kr=new WeakSet,Sr=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),kr),u(n,br,/^(?:[A-Za-z0-9!#\$&\.\+\-\^_]){1,127}\/(?:[A-Za-z0-9!#\$&\.\+\-\^_]){1,127}$/),u(n,Ar,/^[A-Za-z0-9!#\$&\.\+\-\^_]+=[A-Za-z0-9!#\$&\.\+\-\^_]+$/),u(n,gr,void 0),t(kr,n,Or).call(n,e),s(gr,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return Array.isArray(o(gr,this))?'"'.concat(o(gr,this).map((function(e){return e.repr()})).join(";"),'"'):o(gr,this).repr()}},{key:"valueXML",get:function(){return Array.isArray(o(gr,this))?"<text>"+o(gr,this).map((function(e){return e.reprXML()})).join(";").replace(/<\/?text>/g,"")+"</text>":o(gr,this).reprXML()}},{key:"valueJSON",get:function(){return Array.isArray(o(gr,this))?["text",o(gr,this).map((function(e){return e._unsafe_raw_value})).join(";")]:o(gr,this).reprJSON()}}])}(_e);function Or(e){if(void 0===e)throw new O("Value for MediatypeParameter must be supplied");if(!Array.isArray(e)&&"ParameterValueType"!==e.constructor.identifier||Array.isArray(e)&&!e.every((function(e){return"ParameterValueType"===e.constructor.identifier})))throw new TypeError("Value for MediatypeParameter must be of ParameterValueType or an array of ParameterValueTypes");if(!Array.isArray(e)&&!o(br,this).test(e.repr()))throw new M("Invalid media type");if(Array.isArray(e)){if(2!==e.length)throw new M("Invalid value for MediatypeParameter. It should be an array with a length of 2");if(!o(br,this).test(e[0].repr()))throw new M("Invalid media type");if(!o(Ar,this).test(e[1].repr()))throw new M("Invalid media type")}}y(Sr,"param","MEDIATYPE"),y(Sr,"identifier","MediatypeParameter"),Object.freeze(Sr);var Mr=new WeakMap,Lr=new WeakMap,Nr=new WeakSet,Ir=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),Nr),u(n,Mr,void 0),u(n,Lr,/^(?:gregorian|[Xx]-[A-Za-z0-9-]+)$/),t(Nr,n,Er).call(n,e),s(Mr,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(Mr,this).repr()}},{key:"valueXML",get:function(){return o(Mr,this).reprXML()}},{key:"valueJSON",get:function(){return o(Mr,this).reprJSON()}}])}(_e);function Er(e){if(void 0===e)throw new O("Value for CalscaleParameter must be supplied");if("ParameterValueType"!==e.constructor.identifier)throw new O("Value for CalscaleParameter must of type ParameterValueType");if(!o(Lr,this).test(e.repr()))throw new M("Invalid calscale value")}y(Ir,"param","CALSCALE"),y(Ir,"identifier","CalscaleParameter"),Object.freeze(Ir);var Xr=new WeakMap,Jr=new WeakSet,Vr=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),Jr),u(n,Xr,void 0),t(Jr,n,jr).call(n,e),s(Xr,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return Array.isArray(o(Xr,this))?'"'.concat(o(Xr,this).map((function(e){return e.repr()})).join(",").replaceAll('"',""),'"'):o(Xr,this).repr()}},{key:"valueXML",get:function(){return Array.isArray(o(Xr,this))?o(Xr,this).map((function(e){return e.reprXML()})).join(""):o(Xr,this).reprXML()}},{key:"valueJSON",get:function(){return Array.isArray(o(Xr,this))?["text"].concat(b(o(Xr,this).map((function(e){return e._unsafe_raw_value})))):o(Xr,this).reprJSON()}}])}(_e);function jr(e){if(void 0===e)throw new O("Value for SortAsParameter must be supplied");if((Array.isArray(e)||"ParameterValueType"!==e.constructor.identifier)&&(!Array.isArray(e)||!e.every((function(e){return"ParameterValueType"===e.constructor.identifier}))))throw new TypeError("Value for SortAsParameter must be of type ParameterValueType or an array of ParameterValueTypes")}y(Vr,"param","SORT-AS"),y(Vr,"identifier","SortAsParameter"),Object.freeze(Vr);var Wr=new WeakMap,xr=new WeakSet,zr=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),xr),u(n,Wr,void 0),t(xr,n,Dr).call(n,e),s(Wr,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return'"'.concat(o(Wr,this).repr(),'"')}},{key:"valueXML",get:function(){return o(Wr,this).reprXML()}},{key:"valueJSON",get:function(){return o(Wr,this).reprJSON()}}])}(_e);function Dr(e){if(void 0===e)throw new O("Value for GeoParameter must be supplied");if("URIType"!==e.constructor.identifier)throw new TypeError("Value for GeoParameter must be of type URIType")}y(zr,"param","GEO"),y(zr,"identifier","GeoParameter"),Object.freeze(zr);var Rr=new WeakMap,Cr=new WeakSet,Fr=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),Cr),u(n,Rr,void 0),t(Cr,n,Ur).call(n,e),s(Rr,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return"URIType"===o(Rr,this).constructor.identifier?'"'.concat(o(Rr,this).repr(),'"'):o(Rr,this).repr()}},{key:"valueXML",get:function(){return o(Rr,this).reprXML()}},{key:"valueJSON",get:function(){return o(Rr,this).reprJSON()}}])}(_e);function Ur(e){if(void 0===e)throw new O("Value for TzParameter must be supplied");if("ParameterValueType"!==e.constructor.identifier&&"URIType"!==e.constructor.identifier&&("DateTimeType"!==e.constructor.identifier||"UTC-OFFSET"!==e.type))throw new TypeError("Invalid type for value for TzParameter")}y(Fr,"param","TZ"),y(Fr,"identifier","TzParameter"),Object.freeze(Fr);var $r=new WeakMap,Gr=new WeakMap,_r=new WeakMap,Br=new WeakSet,Zr=function(e){function r(e,n){var o;return i(this,r),c(o=a(this,r),Br),u(o,$r,void 0),u(o,Gr,void 0),u(o,_r,/^x-[a-z0-9-]+$/i),t(Br,o,Kr).call(o,e,n),s(Gr,o,e),s($r,o,n),o.checkAbstractPropertiesAndMethods(),Object.freeze(o),o}return h(r,e),f(r,[{key:"param",get:function(){return"".concat(o(Gr,this))}},{key:"value",get:function(){return o($r,this).repr()}},{key:"valueXML",get:function(){return o($r,this).reprXML()}},{key:"valueJSON",get:function(){return o($r,this).reprJSON()}}])}(_e);function Kr(e,r){if(void 0===e||void 0===r)throw new O("Parameter name and value for AnyParameter must be supplied");if(!o(_r,this).test(e))throw new M("Invalid parameter name for AnyParameter");if("ParameterValueType"!==r.constructor.identifier)throw new M("Invalid value for AnyParameter")}y(Zr,"identifier","AnyParameter"),Object.freeze(Zr);var Hr=new WeakMap,Yr=new WeakSet,qr=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),Yr),u(n,Hr,void 0),t(Yr,n,Qr).call(n,e),s(Hr,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(Hr,this).repr()}},{key:"valueXML",get:function(){return o(Hr,this).reprXML()}},{key:"valueJSON",get:function(){return o(Hr,this).reprJSON()}}])}(_e);function Qr(e){if(void 0===e)throw new O("Value for LabelParameter must be supplied");if("ParameterValueType"!==e.constructor.identifier)throw new TypeError("Value for LabelParameter should be of type ParameterValueType")}y(qr,"param","LABEL"),y(qr,"identifier","LabelParameter"),Object.freeze(qr);var et=new WeakMap,rt=new WeakSet,tt=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),rt),u(n,et,void 0),t(rt,n,at).call(n,e),s(et,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(et,this).repr()}},{key:"valueXML",get:function(){return o(et,this).reprXML()}},{key:"valueJSON",get:function(){return o(et,this).reprJSON()}}])}(_e);function at(e){if(void 0===e)throw new O("Value for CCParameter must be supplied");if("ParameterValueType"!==e.constructor.identifier||!/^[A-Za-z0-9]{2}$/.test(e.repr()))throw new M("Invalid value for CCParameter")}y(tt,"param","CC"),y(tt,"identifier","CCParameter"),Object.freeze(tt);var nt=new WeakMap,it=new WeakSet,ot=function(e){function r(e){var n;return i(this,r),c(n=a(this,r),it),u(n,nt,void 0),t(it,n,ut).call(n,e),s(nt,n,e),n.checkAbstractPropertiesAndMethods(),Object.freeze(n),n}return h(r,e),f(r,[{key:"value",get:function(){return o(nt,this).repr()}},{key:"valueXML",get:function(){return o(nt,this).reprXML()}},{key:"valueJSON",get:function(){return o(nt,this).reprJSON()}}])}(_e);function ut(e){if(void 0===e)throw new O("Value for IndexParameter must be supplied");if("IntegerType"!==e.constructor.identifier||!(Number(e.repr())>0))throw new M("Invalid value for IndexParameter. Must be a positive integer")}y(ot,"param","INDEX"),y(ot,"identifier","IndexParameter"),Object.freeze(ot);var st=new WeakMap,ct=new WeakMap,pt=new WeakMap,ft=new WeakSet,lt=function(e){function r(e,n){var o;return i(this,r),c(o=a(this,r),ft),u(o,st,/^(?:beginner|average|expert)$/),u(o,ct,/^(?:high|medium|low)$/),u(o,pt,void 0),t(ft,o,yt).call(o,e,n),s(pt,o,n),o.targetProp=e.toUpperCase(),o.checkAbstractPropertiesAndMethods(),Object.freeze(o),o}return h(r,e