12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537 |
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/ParseError.js
- function _typeof(obj) {
- "@babel/helpers - typeof";
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
- return typeof obj2;
- } : function(obj2) {
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
- }, _typeof(obj);
- }
- function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function");
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
- Object.defineProperty(subClass, "prototype", { writable: false });
- if (superClass)
- _setPrototypeOf(subClass, superClass);
- }
- function _createSuper(Derived) {
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
- return function _createSuperInternal() {
- var Super = _getPrototypeOf(Derived), result2;
- if (hasNativeReflectConstruct) {
- var NewTarget = _getPrototypeOf(this).constructor;
- result2 = Reflect.construct(Super, arguments, NewTarget);
- } else {
- result2 = Super.apply(this, arguments);
- }
- return _possibleConstructorReturn(this, result2);
- };
- }
- function _possibleConstructorReturn(self, call) {
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
- return call;
- } else if (call !== void 0) {
- throw new TypeError("Derived constructors may only return object or undefined");
- }
- return _assertThisInitialized(self);
- }
- function _assertThisInitialized(self) {
- if (self === void 0) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return self;
- }
- function _wrapNativeSuper(Class) {
- var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
- _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
- if (Class2 === null || !_isNativeFunction(Class2))
- return Class2;
- if (typeof Class2 !== "function") {
- throw new TypeError("Super expression must either be null or a function");
- }
- if (typeof _cache !== "undefined") {
- if (_cache.has(Class2))
- return _cache.get(Class2);
- _cache.set(Class2, Wrapper);
- }
- function Wrapper() {
- return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
- }
- Wrapper.prototype = Object.create(Class2.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } });
- return _setPrototypeOf(Wrapper, Class2);
- };
- return _wrapNativeSuper(Class);
- }
- function _construct(Parent, args, Class) {
- if (_isNativeReflectConstruct()) {
- _construct = Reflect.construct;
- } else {
- _construct = function _construct2(Parent2, args2, Class2) {
- var a = [null];
- a.push.apply(a, args2);
- var Constructor = Function.bind.apply(Parent2, a);
- var instance = new Constructor();
- if (Class2)
- _setPrototypeOf(instance, Class2.prototype);
- return instance;
- };
- }
- return _construct.apply(null, arguments);
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !Reflect.construct)
- return false;
- if (Reflect.construct.sham)
- return false;
- if (typeof Proxy === "function")
- return true;
- try {
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
- }));
- return true;
- } catch (e) {
- return false;
- }
- }
- function _isNativeFunction(fn) {
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
- }
- function _setPrototypeOf(o, p) {
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
- o2.__proto__ = p2;
- return o2;
- };
- return _setPrototypeOf(o, p);
- }
- function _getPrototypeOf(o) {
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
- return o2.__proto__ || Object.getPrototypeOf(o2);
- };
- return _getPrototypeOf(o);
- }
- var ParseError = function(_Error) {
- _inherits(ParseError2, _Error);
- var _super = _createSuper(ParseError2);
- function ParseError2(code) {
- var _this;
- _classCallCheck(this, ParseError2);
- _this = _super.call(this, code);
- Object.setPrototypeOf(_assertThisInitialized(_this), ParseError2.prototype);
- _this.name = _this.constructor.name;
- return _this;
- }
- return _createClass(ParseError2);
- }(_wrapNativeSuper(Error));
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/tools/semver-compare.js
- function semver_compare_default(a, b) {
- a = a.split("-");
- b = b.split("-");
- var pa = a[0].split(".");
- var pb = b[0].split(".");
- for (var i = 0; i < 3; i++) {
- var na = Number(pa[i]);
- var nb = Number(pb[i]);
- if (na > nb)
- return 1;
- if (nb > na)
- return -1;
- if (!isNaN(na) && isNaN(nb))
- return 1;
- if (isNaN(na) && !isNaN(nb))
- return -1;
- }
- if (a[1] && b[1]) {
- return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;
- }
- return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/isObject.js
- var objectConstructor = {}.constructor;
- function isObject(object) {
- return object !== void 0 && object !== null && object.constructor === objectConstructor;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/metadata.js
- function _typeof2(obj) {
- "@babel/helpers - typeof";
- return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
- return typeof obj2;
- } : function(obj2) {
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
- }, _typeof2(obj);
- }
- function _classCallCheck2(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties2(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass2(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties2(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties2(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- var V3 = "1.2.0";
- var V4 = "1.7.35";
- var DEFAULT_EXT_PREFIX = " ext. ";
- var CALLING_CODE_REG_EXP = /^\d+$/;
- var Metadata = function() {
- function Metadata2(metadata) {
- _classCallCheck2(this, Metadata2);
- validateMetadata(metadata);
- this.metadata = metadata;
- setVersion.call(this, metadata);
- }
- _createClass2(Metadata2, [{
- key: "getCountries",
- value: function getCountries2() {
- return Object.keys(this.metadata.countries).filter(function(_) {
- return _ !== "001";
- });
- }
- }, {
- key: "getCountryMetadata",
- value: function getCountryMetadata(countryCode) {
- return this.metadata.countries[countryCode];
- }
- }, {
- key: "nonGeographic",
- value: function nonGeographic() {
- if (this.v1 || this.v2 || this.v3)
- return;
- return this.metadata.nonGeographic || this.metadata.nonGeographical;
- }
- }, {
- key: "hasCountry",
- value: function hasCountry(country2) {
- return this.getCountryMetadata(country2) !== void 0;
- }
- }, {
- key: "hasCallingCode",
- value: function hasCallingCode(callingCode) {
- if (this.getCountryCodesForCallingCode(callingCode)) {
- return true;
- }
- if (this.nonGeographic()) {
- if (this.nonGeographic()[callingCode]) {
- return true;
- }
- } else {
- var countryCodes = this.countryCallingCodes()[callingCode];
- if (countryCodes && countryCodes.length === 1 && countryCodes[0] === "001") {
- return true;
- }
- }
- }
- }, {
- key: "isNonGeographicCallingCode",
- value: function isNonGeographicCallingCode(callingCode) {
- if (this.nonGeographic()) {
- return this.nonGeographic()[callingCode] ? true : false;
- } else {
- return this.getCountryCodesForCallingCode(callingCode) ? false : true;
- }
- }
- // Deprecated.
- }, {
- key: "country",
- value: function country2(countryCode) {
- return this.selectNumberingPlan(countryCode);
- }
- }, {
- key: "selectNumberingPlan",
- value: function selectNumberingPlan(countryCode, callingCode) {
- if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) {
- callingCode = countryCode;
- countryCode = null;
- }
- if (countryCode && countryCode !== "001") {
- if (!this.hasCountry(countryCode)) {
- throw new Error("Unknown country: ".concat(countryCode));
- }
- this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this);
- } else if (callingCode) {
- if (!this.hasCallingCode(callingCode)) {
- throw new Error("Unknown calling code: ".concat(callingCode));
- }
- this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);
- } else {
- this.numberingPlan = void 0;
- }
- return this;
- }
- }, {
- key: "getCountryCodesForCallingCode",
- value: function getCountryCodesForCallingCode(callingCode) {
- var countryCodes = this.countryCallingCodes()[callingCode];
- if (countryCodes) {
- if (countryCodes.length === 1 && countryCodes[0].length === 3) {
- return;
- }
- return countryCodes;
- }
- }
- }, {
- key: "getCountryCodeForCallingCode",
- value: function getCountryCodeForCallingCode(callingCode) {
- var countryCodes = this.getCountryCodesForCallingCode(callingCode);
- if (countryCodes) {
- return countryCodes[0];
- }
- }
- }, {
- key: "getNumberingPlanMetadata",
- value: function getNumberingPlanMetadata(callingCode) {
- var countryCode = this.getCountryCodeForCallingCode(callingCode);
- if (countryCode) {
- return this.getCountryMetadata(countryCode);
- }
- if (this.nonGeographic()) {
- var metadata = this.nonGeographic()[callingCode];
- if (metadata) {
- return metadata;
- }
- } else {
- var countryCodes = this.countryCallingCodes()[callingCode];
- if (countryCodes && countryCodes.length === 1 && countryCodes[0] === "001") {
- return this.metadata.countries["001"];
- }
- }
- }
- // Deprecated.
- }, {
- key: "countryCallingCode",
- value: function countryCallingCode() {
- return this.numberingPlan.callingCode();
- }
- // Deprecated.
- }, {
- key: "IDDPrefix",
- value: function IDDPrefix() {
- return this.numberingPlan.IDDPrefix();
- }
- // Deprecated.
- }, {
- key: "defaultIDDPrefix",
- value: function defaultIDDPrefix() {
- return this.numberingPlan.defaultIDDPrefix();
- }
- // Deprecated.
- }, {
- key: "nationalNumberPattern",
- value: function nationalNumberPattern() {
- return this.numberingPlan.nationalNumberPattern();
- }
- // Deprecated.
- }, {
- key: "possibleLengths",
- value: function possibleLengths() {
- return this.numberingPlan.possibleLengths();
- }
- // Deprecated.
- }, {
- key: "formats",
- value: function formats() {
- return this.numberingPlan.formats();
- }
- // Deprecated.
- }, {
- key: "nationalPrefixForParsing",
- value: function nationalPrefixForParsing() {
- return this.numberingPlan.nationalPrefixForParsing();
- }
- // Deprecated.
- }, {
- key: "nationalPrefixTransformRule",
- value: function nationalPrefixTransformRule() {
- return this.numberingPlan.nationalPrefixTransformRule();
- }
- // Deprecated.
- }, {
- key: "leadingDigits",
- value: function leadingDigits() {
- return this.numberingPlan.leadingDigits();
- }
- // Deprecated.
- }, {
- key: "hasTypes",
- value: function hasTypes() {
- return this.numberingPlan.hasTypes();
- }
- // Deprecated.
- }, {
- key: "type",
- value: function type(_type) {
- return this.numberingPlan.type(_type);
- }
- // Deprecated.
- }, {
- key: "ext",
- value: function ext() {
- return this.numberingPlan.ext();
- }
- }, {
- key: "countryCallingCodes",
- value: function countryCallingCodes() {
- if (this.v1)
- return this.metadata.country_phone_code_to_countries;
- return this.metadata.country_calling_codes;
- }
- // Deprecated.
- }, {
- key: "chooseCountryByCountryCallingCode",
- value: function chooseCountryByCountryCallingCode(callingCode) {
- return this.selectNumberingPlan(callingCode);
- }
- }, {
- key: "hasSelectedNumberingPlan",
- value: function hasSelectedNumberingPlan() {
- return this.numberingPlan !== void 0;
- }
- }]);
- return Metadata2;
- }();
- var NumberingPlan = function() {
- function NumberingPlan2(metadata, globalMetadataObject) {
- _classCallCheck2(this, NumberingPlan2);
- this.globalMetadataObject = globalMetadataObject;
- this.metadata = metadata;
- setVersion.call(this, globalMetadataObject.metadata);
- }
- _createClass2(NumberingPlan2, [{
- key: "callingCode",
- value: function callingCode() {
- return this.metadata[0];
- }
- // Formatting information for regions which share
- // a country calling code is contained by only one region
- // for performance reasons. For example, for NANPA region
- // ("North American Numbering Plan Administration",
- // which includes USA, Canada, Cayman Islands, Bahamas, etc)
- // it will be contained in the metadata for `US`.
- }, {
- key: "getDefaultCountryMetadataForRegion",
- value: function getDefaultCountryMetadataForRegion() {
- return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());
- }
- // Is always present.
- }, {
- key: "IDDPrefix",
- value: function IDDPrefix() {
- if (this.v1 || this.v2)
- return;
- return this.metadata[1];
- }
- // Is only present when a country supports multiple IDD prefixes.
- }, {
- key: "defaultIDDPrefix",
- value: function defaultIDDPrefix() {
- if (this.v1 || this.v2)
- return;
- return this.metadata[12];
- }
- }, {
- key: "nationalNumberPattern",
- value: function nationalNumberPattern() {
- if (this.v1 || this.v2)
- return this.metadata[1];
- return this.metadata[2];
- }
- // "possible length" data is always present in Google's metadata.
- }, {
- key: "possibleLengths",
- value: function possibleLengths() {
- if (this.v1)
- return;
- return this.metadata[this.v2 ? 2 : 3];
- }
- }, {
- key: "_getFormats",
- value: function _getFormats(metadata) {
- return metadata[this.v1 ? 2 : this.v2 ? 3 : 4];
- }
- // For countries of the same region (e.g. NANPA)
- // formats are all stored in the "main" country for that region.
- // E.g. "RU" and "KZ", "US" and "CA".
- }, {
- key: "formats",
- value: function formats() {
- var _this = this;
- var formats2 = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];
- return formats2.map(function(_) {
- return new Format(_, _this);
- });
- }
- }, {
- key: "nationalPrefix",
- value: function nationalPrefix() {
- return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];
- }
- }, {
- key: "_getNationalPrefixFormattingRule",
- value: function _getNationalPrefixFormattingRule(metadata) {
- return metadata[this.v1 ? 4 : this.v2 ? 5 : 6];
- }
- // For countries of the same region (e.g. NANPA)
- // national prefix formatting rule is stored in the "main" country for that region.
- // E.g. "RU" and "KZ", "US" and "CA".
- }, {
- key: "nationalPrefixFormattingRule",
- value: function nationalPrefixFormattingRule() {
- return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());
- }
- }, {
- key: "_nationalPrefixForParsing",
- value: function _nationalPrefixForParsing() {
- return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];
- }
- }, {
- key: "nationalPrefixForParsing",
- value: function nationalPrefixForParsing() {
- return this._nationalPrefixForParsing() || this.nationalPrefix();
- }
- }, {
- key: "nationalPrefixTransformRule",
- value: function nationalPrefixTransformRule() {
- return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];
- }
- }, {
- key: "_getNationalPrefixIsOptionalWhenFormatting",
- value: function _getNationalPrefixIsOptionalWhenFormatting() {
- return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];
- }
- // For countries of the same region (e.g. NANPA)
- // "national prefix is optional when formatting" flag is
- // stored in the "main" country for that region.
- // E.g. "RU" and "KZ", "US" and "CA".
- }, {
- key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
- value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
- return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());
- }
- }, {
- key: "leadingDigits",
- value: function leadingDigits() {
- return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];
- }
- }, {
- key: "types",
- value: function types() {
- return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];
- }
- }, {
- key: "hasTypes",
- value: function hasTypes() {
- if (this.types() && this.types().length === 0) {
- return false;
- }
- return !!this.types();
- }
- }, {
- key: "type",
- value: function type(_type2) {
- if (this.hasTypes() && getType(this.types(), _type2)) {
- return new Type(getType(this.types(), _type2), this);
- }
- }
- }, {
- key: "ext",
- value: function ext() {
- if (this.v1 || this.v2)
- return DEFAULT_EXT_PREFIX;
- return this.metadata[13] || DEFAULT_EXT_PREFIX;
- }
- }]);
- return NumberingPlan2;
- }();
- var Format = function() {
- function Format2(format, metadata) {
- _classCallCheck2(this, Format2);
- this._format = format;
- this.metadata = metadata;
- }
- _createClass2(Format2, [{
- key: "pattern",
- value: function pattern() {
- return this._format[0];
- }
- }, {
- key: "format",
- value: function format() {
- return this._format[1];
- }
- }, {
- key: "leadingDigitsPatterns",
- value: function leadingDigitsPatterns() {
- return this._format[2] || [];
- }
- }, {
- key: "nationalPrefixFormattingRule",
- value: function nationalPrefixFormattingRule() {
- return this._format[3] || this.metadata.nationalPrefixFormattingRule();
- }
- }, {
- key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
- value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
- return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
- }
- }, {
- key: "nationalPrefixIsMandatoryWhenFormattingInNationalFormat",
- value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {
- return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
- }
- // Checks whether national prefix formatting rule contains national prefix.
- }, {
- key: "usesNationalPrefix",
- value: function usesNationalPrefix() {
- return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a "dummy" one.
- !FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) ? true : false;
- }
- }, {
- key: "internationalFormat",
- value: function internationalFormat() {
- return this._format[5] || this.format();
- }
- }]);
- return Format2;
- }();
- var FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\(?\$1\)?$/;
- var Type = function() {
- function Type2(type, metadata) {
- _classCallCheck2(this, Type2);
- this.type = type;
- this.metadata = metadata;
- }
- _createClass2(Type2, [{
- key: "pattern",
- value: function pattern() {
- if (this.metadata.v1)
- return this.type;
- return this.type[0];
- }
- }, {
- key: "possibleLengths",
- value: function possibleLengths() {
- if (this.metadata.v1)
- return;
- return this.type[1] || this.metadata.possibleLengths();
- }
- }]);
- return Type2;
- }();
- function getType(types, type) {
- switch (type) {
- case "FIXED_LINE":
- return types[0];
- case "MOBILE":
- return types[1];
- case "TOLL_FREE":
- return types[2];
- case "PREMIUM_RATE":
- return types[3];
- case "PERSONAL_NUMBER":
- return types[4];
- case "VOICEMAIL":
- return types[5];
- case "UAN":
- return types[6];
- case "PAGER":
- return types[7];
- case "VOIP":
- return types[8];
- case "SHARED_COST":
- return types[9];
- }
- }
- function validateMetadata(metadata) {
- if (!metadata) {
- throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");
- }
- if (!isObject(metadata) || !isObject(metadata.countries)) {
- throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(isObject(metadata) ? "an object of shape: { " + Object.keys(metadata).join(", ") + " }" : "a " + typeOf(metadata) + ": " + metadata, "."));
- }
- }
- var typeOf = function typeOf2(_) {
- return _typeof2(_);
- };
- function getExtPrefix(country2, metadata) {
- metadata = new Metadata(metadata);
- if (metadata.hasCountry(country2)) {
- return metadata.country(country2).ext();
- }
- return DEFAULT_EXT_PREFIX;
- }
- function getCountryCallingCode(country2, metadata) {
- metadata = new Metadata(metadata);
- if (metadata.hasCountry(country2)) {
- return metadata.country(country2).countryCallingCode();
- }
- throw new Error("Unknown country: ".concat(country2));
- }
- function isSupportedCountry(country2, metadata) {
- return metadata.countries.hasOwnProperty(country2);
- }
- function setVersion(metadata) {
- var version = metadata.version;
- if (typeof version === "number") {
- this.v1 = version === 1;
- this.v2 = version === 2;
- this.v3 = version === 3;
- this.v4 = version === 4;
- } else {
- if (!version) {
- this.v1 = true;
- } else if (semver_compare_default(version, V3) === -1) {
- this.v2 = true;
- } else if (semver_compare_default(version, V4) === -1) {
- this.v3 = true;
- } else {
- this.v4 = true;
- }
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/parseDigits.js
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray(o, minLen);
- }
- function _arrayLikeToArray(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- var DIGITS = {
- "0": "0",
- "1": "1",
- "2": "2",
- "3": "3",
- "4": "4",
- "5": "5",
- "6": "6",
- "7": "7",
- "8": "8",
- "9": "9",
- "0": "0",
- // Fullwidth digit 0
- "1": "1",
- // Fullwidth digit 1
- "2": "2",
- // Fullwidth digit 2
- "3": "3",
- // Fullwidth digit 3
- "4": "4",
- // Fullwidth digit 4
- "5": "5",
- // Fullwidth digit 5
- "6": "6",
- // Fullwidth digit 6
- "7": "7",
- // Fullwidth digit 7
- "8": "8",
- // Fullwidth digit 8
- "9": "9",
- // Fullwidth digit 9
- "٠": "0",
- // Arabic-indic digit 0
- "١": "1",
- // Arabic-indic digit 1
- "٢": "2",
- // Arabic-indic digit 2
- "٣": "3",
- // Arabic-indic digit 3
- "٤": "4",
- // Arabic-indic digit 4
- "٥": "5",
- // Arabic-indic digit 5
- "٦": "6",
- // Arabic-indic digit 6
- "٧": "7",
- // Arabic-indic digit 7
- "٨": "8",
- // Arabic-indic digit 8
- "٩": "9",
- // Arabic-indic digit 9
- "۰": "0",
- // Eastern-Arabic digit 0
- "۱": "1",
- // Eastern-Arabic digit 1
- "۲": "2",
- // Eastern-Arabic digit 2
- "۳": "3",
- // Eastern-Arabic digit 3
- "۴": "4",
- // Eastern-Arabic digit 4
- "۵": "5",
- // Eastern-Arabic digit 5
- "۶": "6",
- // Eastern-Arabic digit 6
- "۷": "7",
- // Eastern-Arabic digit 7
- "۸": "8",
- // Eastern-Arabic digit 8
- "۹": "9"
- // Eastern-Arabic digit 9
- };
- function parseDigit(character) {
- return DIGITS[character];
- }
- function parseDigits(string) {
- var result2 = "";
- for (var _iterator = _createForOfIteratorHelperLoose(string.split("")), _step; !(_step = _iterator()).done; ) {
- var character = _step.value;
- var digit = parseDigit(character);
- if (digit) {
- result2 += digit;
- }
- }
- return result2;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js
- function _createForOfIteratorHelperLoose2(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray2(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray2(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray2(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray2(o, minLen);
- }
- function _arrayLikeToArray2(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function parseIncompletePhoneNumber(string) {
- var result2 = "";
- for (var _iterator = _createForOfIteratorHelperLoose2(string.split("")), _step; !(_step = _iterator()).done; ) {
- var character = _step.value;
- result2 += parsePhoneNumberCharacter(character, result2) || "";
- }
- return result2;
- }
- function parsePhoneNumberCharacter(character, prevParsedCharacters, emitEvent) {
- if (character === "+") {
- if (prevParsedCharacters) {
- if (typeof emitEvent === "function") {
- emitEvent("end");
- }
- return;
- }
- return "+";
- }
- return parseDigit(character);
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/constants.js
- var MIN_LENGTH_FOR_NSN = 2;
- var MAX_LENGTH_FOR_NSN = 17;
- var MAX_LENGTH_COUNTRY_CODE = 3;
- var VALID_DIGITS = "0-90-9٠-٩۰-۹";
- var DASHES = "-‐-―−ー-";
- var SLASHES = "//";
- var DOTS = "..";
- var WHITESPACE = " ";
- var BRACKETS = "()()[]\\[\\]";
- var TILDES = "~⁓∼~";
- var VALID_PUNCTUATION = "".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);
- var PLUS_CHARS = "++";
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js
- var RFC3966_EXTN_PREFIX = ";ext=";
- var getExtensionDigitsPattern = function getExtensionDigitsPattern2(maxLength) {
- return "([".concat(VALID_DIGITS, "]{1,").concat(maxLength, "})");
- };
- function createExtensionPattern(purpose) {
- var extLimitAfterExplicitLabel = "20";
- var extLimitAfterLikelyLabel = "15";
- var extLimitAfterAmbiguousChar = "9";
- var extLimitWhenNotSure = "6";
- var possibleSeparatorsBetweenNumberAndExtLabel = "[ \\t,]*";
- var possibleCharsAfterExtLabel = "[:\\..]?[ \\t,-]*";
- var optionalExtnSuffix = "#?";
- var explicitExtLabels = "(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)";
- var ambiguousExtLabels = "(?:[xx##~~]|int|int)";
- var ambiguousSeparator = "[- ]+";
- var possibleSeparatorsNumberExtLabelNoComma = "[ \\t]*";
- var autoDiallingAndExtLabelsFound = "(?:,{2}|;)";
- var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel);
- var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix;
- var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
- var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + "#";
- var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix;
- var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + "(?:,)+" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
- return rfcExtn + "|" + explicitExtn + "|" + ambiguousExtn + "|" + americanStyleExtnWithSuffix + "|" + autoDiallingExtn + "|" + onlyCommasExtn;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js
- var MIN_LENGTH_PHONE_NUMBER_PATTERN = "[" + VALID_DIGITS + "]{" + MIN_LENGTH_FOR_NSN + "}";
- var VALID_PHONE_NUMBER = "[" + PLUS_CHARS + "]{0,1}(?:[" + VALID_PUNCTUATION + "]*[" + VALID_DIGITS + "]){3,}[" + VALID_PUNCTUATION + VALID_DIGITS + "]*";
- var VALID_PHONE_NUMBER_START_REG_EXP = new RegExp("^[" + PLUS_CHARS + "]{0,1}(?:[" + VALID_PUNCTUATION + "]*[" + VALID_DIGITS + "]){1,2}$", "i");
- var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER + // Phone number extensions
- "(?:" + createExtensionPattern() + ")?";
- var VALID_PHONE_NUMBER_PATTERN = new RegExp(
- // Either a short two-digit-only phone number
- "^" + MIN_LENGTH_PHONE_NUMBER_PATTERN + "$|^" + VALID_PHONE_NUMBER_WITH_EXTENSION + "$",
- "i"
- );
- function isViablePhoneNumber(number) {
- return number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number);
- }
- function isViablePhoneNumberStart(number) {
- return VALID_PHONE_NUMBER_START_REG_EXP.test(number);
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/RFC3966.js
- function _slicedToArray(arr, i) {
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray3(arr, i) || _nonIterableRest();
- }
- function _nonIterableRest() {
- 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 _iterableToArrayLimit(arr, i) {
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
- if (_i == null)
- return;
- var _arr = [];
- var _n = true;
- var _d = false;
- var _s, _e;
- try {
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i && _arr.length === i)
- break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null)
- _i["return"]();
- } finally {
- if (_d)
- throw _e;
- }
- }
- return _arr;
- }
- function _arrayWithHoles(arr) {
- if (Array.isArray(arr))
- return arr;
- }
- function _createForOfIteratorHelperLoose3(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray3(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray3(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray3(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray3(o, minLen);
- }
- function _arrayLikeToArray3(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function parseRFC3966(text) {
- var number;
- var ext;
- text = text.replace(/^tel:/, "tel=");
- for (var _iterator = _createForOfIteratorHelperLoose3(text.split(";")), _step; !(_step = _iterator()).done; ) {
- var part = _step.value;
- var _part$split = part.split("="), _part$split2 = _slicedToArray(_part$split, 2), name = _part$split2[0], value = _part$split2[1];
- switch (name) {
- case "tel":
- number = value;
- break;
- case "ext":
- ext = value;
- break;
- case "phone-context":
- if (value[0] === "+") {
- number = value + number;
- }
- break;
- }
- }
- if (!isViablePhoneNumber(number)) {
- return {};
- }
- var result2 = {
- number
- };
- if (ext) {
- result2.ext = ext;
- }
- return result2;
- }
- function formatRFC3966(_ref) {
- var number = _ref.number, ext = _ref.ext;
- if (!number) {
- return "";
- }
- if (number[0] !== "+") {
- throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');
- }
- return "tel:".concat(number).concat(ext ? ";ext=" + ext : "");
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.util.js
- function _createForOfIteratorHelperLoose4(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray4(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray4(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray4(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray4(o, minLen);
- }
- function _arrayLikeToArray4(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- var DIGIT_PLACEHOLDER = "x";
- var DIGIT_PLACEHOLDER_MATCHER = new RegExp(DIGIT_PLACEHOLDER);
- function repeat(string, times) {
- if (times < 1) {
- return "";
- }
- var result2 = "";
- while (times > 1) {
- if (times & 1) {
- result2 += string;
- }
- times >>= 1;
- string += string;
- }
- return result2 + string;
- }
- function cutAndStripNonPairedParens(string, cutBeforeIndex) {
- if (string[cutBeforeIndex] === ")") {
- cutBeforeIndex++;
- }
- return stripNonPairedParens(string.slice(0, cutBeforeIndex));
- }
- function stripNonPairedParens(string) {
- var dangling_braces = [];
- var i = 0;
- while (i < string.length) {
- if (string[i] === "(") {
- dangling_braces.push(i);
- } else if (string[i] === ")") {
- dangling_braces.pop();
- }
- i++;
- }
- var start = 0;
- var cleared_string = "";
- dangling_braces.push(string.length);
- for (var _i = 0, _dangling_braces = dangling_braces; _i < _dangling_braces.length; _i++) {
- var index = _dangling_braces[_i];
- cleared_string += string.slice(start, index);
- start = index + 1;
- }
- return cleared_string;
- }
- function populateTemplateWithDigits(template, position, digits) {
- for (var _iterator2 = _createForOfIteratorHelperLoose4(digits.split("")), _step2; !(_step2 = _iterator2()).done; ) {
- var digit = _step2.value;
- if (template.slice(position + 1).search(DIGIT_PLACEHOLDER_MATCHER) < 0) {
- return;
- }
- position = template.search(DIGIT_PLACEHOLDER_MATCHER);
- template = template.replace(DIGIT_PLACEHOLDER_MATCHER, digit);
- }
- return [template, position];
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/mergeArrays.js
- function _createForOfIteratorHelperLoose5(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray5(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray5(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray5(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray5(o, minLen);
- }
- function _arrayLikeToArray5(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function mergeArrays(a, b) {
- var merged = a.slice();
- for (var _iterator = _createForOfIteratorHelperLoose5(b), _step; !(_step = _iterator()).done; ) {
- var element = _step.value;
- if (a.indexOf(element) < 0) {
- merged.push(element);
- }
- }
- return merged.sort(function(a2, b2) {
- return a2 - b2;
- });
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js
- function checkNumberLength(nationalNumber, metadata) {
- return checkNumberLengthForType(nationalNumber, void 0, metadata);
- }
- function checkNumberLengthForType(nationalNumber, type, metadata) {
- var type_info = metadata.type(type);
- var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths();
- if (!possible_lengths) {
- return "IS_POSSIBLE";
- }
- if (type === "FIXED_LINE_OR_MOBILE") {
- if (!metadata.type("FIXED_LINE")) {
- return checkNumberLengthForType(nationalNumber, "MOBILE", metadata);
- }
- var mobile_type = metadata.type("MOBILE");
- if (mobile_type) {
- possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths());
- }
- } else if (type && !type_info) {
- return "INVALID_LENGTH";
- }
- var actual_length = nationalNumber.length;
- var minimum_length = possible_lengths[0];
- if (minimum_length === actual_length) {
- return "IS_POSSIBLE";
- }
- if (minimum_length > actual_length) {
- return "TOO_SHORT";
- }
- if (possible_lengths[possible_lengths.length - 1] < actual_length) {
- return "TOO_LONG";
- }
- return possible_lengths.indexOf(actual_length, 1) >= 0 ? "IS_POSSIBLE" : "INVALID_LENGTH";
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js
- function applyInternationalSeparatorStyle(formattedNumber) {
- return formattedNumber.replace(new RegExp("[".concat(VALID_PUNCTUATION, "]+"), "g"), " ").trim();
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js
- var FIRST_GROUP_PATTERN = /(\$\d)/;
- function formatNationalNumberUsingFormat(number, format, _ref) {
- var useInternationalFormat = _ref.useInternationalFormat, withNationalPrefix = _ref.withNationalPrefix, carrierCode = _ref.carrierCode, metadata = _ref.metadata;
- var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : (
- // This library doesn't use `domestic_carrier_code_formatting_rule`,
- // because that one is only used when formatting phone numbers
- // for dialing from a mobile phone, and this is not a dialing library.
- // carrierCode && format.domesticCarrierCodeFormattingRule()
- // // First, replace the $CC in the formatting rule with the desired carrier code.
- // // Then, replace the $FG in the formatting rule with the first group
- // // and the carrier code combined in the appropriate way.
- // ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))
- // : (
- // withNationalPrefix && format.nationalPrefixFormattingRule()
- // ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())
- // : format.format()
- // )
- withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format()
- ));
- if (useInternationalFormat) {
- return applyInternationalSeparatorStyle(formattedNumber);
- }
- return formattedNumber;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js
- function formatCompleteNumber(state, format, _ref) {
- var metadata = _ref.metadata, shouldTryNationalPrefixFormattingRule = _ref.shouldTryNationalPrefixFormattingRule, getSeparatorAfterNationalPrefix = _ref.getSeparatorAfterNationalPrefix;
- var matcher = new RegExp("^(?:".concat(format.pattern(), ")$"));
- if (matcher.test(state.nationalSignificantNumber)) {
- return formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, {
- metadata,
- shouldTryNationalPrefixFormattingRule,
- getSeparatorAfterNationalPrefix
- });
- }
- }
- function canFormatCompleteNumber(nationalSignificantNumber, metadata) {
- return checkNumberLength(nationalSignificantNumber, metadata) === "IS_POSSIBLE";
- }
- function formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, _ref2) {
- var metadata = _ref2.metadata, shouldTryNationalPrefixFormattingRule = _ref2.shouldTryNationalPrefixFormattingRule, getSeparatorAfterNationalPrefix = _ref2.getSeparatorAfterNationalPrefix;
- var nationalSignificantNumber = state.nationalSignificantNumber, international = state.international, nationalPrefix = state.nationalPrefix, carrierCode = state.carrierCode;
- if (shouldTryNationalPrefixFormattingRule(format)) {
- var formattedNumber = formatNationalNumber(state, format, {
- useNationalPrefixFormattingRule: true,
- getSeparatorAfterNationalPrefix,
- metadata
- });
- if (formattedNumber) {
- return formattedNumber;
- }
- }
- return formatNationalNumber(state, format, {
- useNationalPrefixFormattingRule: false,
- getSeparatorAfterNationalPrefix,
- metadata
- });
- }
- function formatNationalNumber(state, format, _ref3) {
- var metadata = _ref3.metadata, useNationalPrefixFormattingRule = _ref3.useNationalPrefixFormattingRule, getSeparatorAfterNationalPrefix = _ref3.getSeparatorAfterNationalPrefix;
- var formattedNationalNumber = formatNationalNumberUsingFormat(state.nationalSignificantNumber, format, {
- carrierCode: state.carrierCode,
- useInternationalFormat: state.international,
- withNationalPrefix: useNationalPrefixFormattingRule,
- metadata
- });
- if (!useNationalPrefixFormattingRule) {
- if (state.nationalPrefix) {
- formattedNationalNumber = state.nationalPrefix + getSeparatorAfterNationalPrefix(format) + formattedNationalNumber;
- } else if (state.complexPrefixBeforeNationalSignificantNumber) {
- formattedNationalNumber = state.complexPrefixBeforeNationalSignificantNumber + " " + formattedNationalNumber;
- }
- }
- if (isValidFormattedNationalNumber(formattedNationalNumber, state)) {
- return formattedNationalNumber;
- }
- }
- function isValidFormattedNationalNumber(formattedNationalNumber, state) {
- return parseDigits(formattedNationalNumber) === state.getNationalDigits();
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js
- function _classCallCheck3(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties3(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass3(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties3(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties3(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- var PatternParser = function() {
- function PatternParser2() {
- _classCallCheck3(this, PatternParser2);
- }
- _createClass3(PatternParser2, [{
- key: "parse",
- value: function parse2(pattern) {
- this.context = [{
- or: true,
- instructions: []
- }];
- this.parsePattern(pattern);
- if (this.context.length !== 1) {
- throw new Error("Non-finalized contexts left when pattern parse ended");
- }
- var _this$context$ = this.context[0], branches = _this$context$.branches, instructions = _this$context$.instructions;
- if (branches) {
- return {
- op: "|",
- args: branches.concat([expandSingleElementArray(instructions)])
- };
- }
- if (instructions.length === 0) {
- throw new Error("Pattern is required");
- }
- if (instructions.length === 1) {
- return instructions[0];
- }
- return instructions;
- }
- }, {
- key: "startContext",
- value: function startContext(context) {
- this.context.push(context);
- }
- }, {
- key: "endContext",
- value: function endContext() {
- this.context.pop();
- }
- }, {
- key: "getContext",
- value: function getContext() {
- return this.context[this.context.length - 1];
- }
- }, {
- key: "parsePattern",
- value: function parsePattern(pattern) {
- if (!pattern) {
- throw new Error("Pattern is required");
- }
- var match = pattern.match(OPERATOR);
- if (!match) {
- if (ILLEGAL_CHARACTER_REGEXP.test(pattern)) {
- throw new Error("Illegal characters found in a pattern: ".concat(pattern));
- }
- this.getContext().instructions = this.getContext().instructions.concat(pattern.split(""));
- return;
- }
- var operator = match[1];
- var before = pattern.slice(0, match.index);
- var rightPart = pattern.slice(match.index + operator.length);
- switch (operator) {
- case "(?:":
- if (before) {
- this.parsePattern(before);
- }
- this.startContext({
- or: true,
- instructions: [],
- branches: []
- });
- break;
- case ")":
- if (!this.getContext().or) {
- throw new Error('")" operator must be preceded by "(?:" operator');
- }
- if (before) {
- this.parsePattern(before);
- }
- if (this.getContext().instructions.length === 0) {
- throw new Error('No instructions found after "|" operator in an "or" group');
- }
- var _this$getContext = this.getContext(), branches = _this$getContext.branches;
- branches.push(expandSingleElementArray(this.getContext().instructions));
- this.endContext();
- this.getContext().instructions.push({
- op: "|",
- args: branches
- });
- break;
- case "|":
- if (!this.getContext().or) {
- throw new Error('"|" operator can only be used inside "or" groups');
- }
- if (before) {
- this.parsePattern(before);
- }
- if (!this.getContext().branches) {
- if (this.context.length === 1) {
- this.getContext().branches = [];
- } else {
- throw new Error('"branches" not found in an "or" group context');
- }
- }
- this.getContext().branches.push(expandSingleElementArray(this.getContext().instructions));
- this.getContext().instructions = [];
- break;
- case "[":
- if (before) {
- this.parsePattern(before);
- }
- this.startContext({
- oneOfSet: true
- });
- break;
- case "]":
- if (!this.getContext().oneOfSet) {
- throw new Error('"]" operator must be preceded by "[" operator');
- }
- this.endContext();
- this.getContext().instructions.push({
- op: "[]",
- args: parseOneOfSet(before)
- });
- break;
- default:
- throw new Error("Unknown operator: ".concat(operator));
- }
- if (rightPart) {
- this.parsePattern(rightPart);
- }
- }
- }]);
- return PatternParser2;
- }();
- function parseOneOfSet(pattern) {
- var values = [];
- var i = 0;
- while (i < pattern.length) {
- if (pattern[i] === "-") {
- if (i === 0 || i === pattern.length - 1) {
- throw new Error("Couldn't parse a one-of set pattern: ".concat(pattern));
- }
- var prevValue = pattern[i - 1].charCodeAt(0) + 1;
- var nextValue = pattern[i + 1].charCodeAt(0) - 1;
- var value = prevValue;
- while (value <= nextValue) {
- values.push(String.fromCharCode(value));
- value++;
- }
- } else {
- values.push(pattern[i]);
- }
- i++;
- }
- return values;
- }
- var ILLEGAL_CHARACTER_REGEXP = /[\(\)\[\]\?\:\|]/;
- var OPERATOR = new RegExp(
- // any of:
- "(\\||\\(\\?\\:|\\)|\\[|\\])"
- );
- function expandSingleElementArray(array) {
- if (array.length === 1) {
- return array[0];
- }
- return array;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js
- function _createForOfIteratorHelperLoose6(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray6(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray6(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray6(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray6(o, minLen);
- }
- function _arrayLikeToArray6(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function _classCallCheck4(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties4(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass4(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties4(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties4(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- var PatternMatcher = function() {
- function PatternMatcher2(pattern) {
- _classCallCheck4(this, PatternMatcher2);
- this.matchTree = new PatternParser().parse(pattern);
- }
- _createClass4(PatternMatcher2, [{
- key: "match",
- value: function match(string) {
- var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, allowOverflow = _ref.allowOverflow;
- if (!string) {
- throw new Error("String is required");
- }
- var result2 = _match(string.split(""), this.matchTree, true);
- if (result2 && result2.match) {
- delete result2.matchedChars;
- }
- if (result2 && result2.overflow) {
- if (!allowOverflow) {
- return;
- }
- }
- return result2;
- }
- }]);
- return PatternMatcher2;
- }();
- function _match(characters, tree, last) {
- if (typeof tree === "string") {
- var characterString = characters.join("");
- if (tree.indexOf(characterString) === 0) {
- if (characters.length === tree.length) {
- return {
- match: true,
- matchedChars: characters
- };
- }
- return {
- partialMatch: true
- // matchedChars: characters
- };
- }
- if (characterString.indexOf(tree) === 0) {
- if (last) {
- if (characters.length > tree.length) {
- return {
- overflow: true
- };
- }
- }
- return {
- match: true,
- matchedChars: characters.slice(0, tree.length)
- };
- }
- return;
- }
- if (Array.isArray(tree)) {
- var restCharacters = characters.slice();
- var i = 0;
- while (i < tree.length) {
- var subtree = tree[i];
- var result2 = _match(restCharacters, subtree, last && i === tree.length - 1);
- if (!result2) {
- return;
- } else if (result2.overflow) {
- return result2;
- } else if (result2.match) {
- restCharacters = restCharacters.slice(result2.matchedChars.length);
- if (restCharacters.length === 0) {
- if (i === tree.length - 1) {
- return {
- match: true,
- matchedChars: characters
- };
- } else {
- return {
- partialMatch: true
- // matchedChars: characters
- };
- }
- }
- } else {
- if (result2.partialMatch) {
- return {
- partialMatch: true
- // matchedChars: characters
- };
- } else {
- throw new Error("Unsupported match result:\n".concat(JSON.stringify(result2, null, 2)));
- }
- }
- i++;
- }
- if (last) {
- return {
- overflow: true
- };
- }
- return {
- match: true,
- matchedChars: characters.slice(0, characters.length - restCharacters.length)
- };
- }
- switch (tree.op) {
- case "|":
- var partialMatch;
- for (var _iterator = _createForOfIteratorHelperLoose6(tree.args), _step; !(_step = _iterator()).done; ) {
- var branch = _step.value;
- var _result = _match(characters, branch, last);
- if (_result) {
- if (_result.overflow) {
- return _result;
- } else if (_result.match) {
- return {
- match: true,
- matchedChars: _result.matchedChars
- };
- } else {
- if (_result.partialMatch) {
- partialMatch = true;
- } else {
- throw new Error("Unsupported match result:\n".concat(JSON.stringify(_result, null, 2)));
- }
- }
- }
- }
- if (partialMatch) {
- return {
- partialMatch: true
- // matchedChars: ...
- };
- }
- return;
- case "[]":
- for (var _iterator2 = _createForOfIteratorHelperLoose6(tree.args), _step2; !(_step2 = _iterator2()).done; ) {
- var _char = _step2.value;
- if (characters[0] === _char) {
- if (characters.length === 1) {
- return {
- match: true,
- matchedChars: characters
- };
- }
- if (last) {
- return {
- overflow: true
- };
- }
- return {
- match: true,
- matchedChars: [_char]
- };
- }
- }
- return;
- default:
- throw new Error("Unsupported instruction tree: ".concat(tree));
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js
- function _createForOfIteratorHelperLoose7(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray7(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray7(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray7(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray7(o, minLen);
- }
- function _arrayLikeToArray7(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function _classCallCheck5(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties5(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass5(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties5(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties5(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- var DUMMY_DIGIT = "9";
- var LONGEST_NATIONAL_PHONE_NUMBER_LENGTH = 15;
- var LONGEST_DUMMY_PHONE_NUMBER = repeat(DUMMY_DIGIT, LONGEST_NATIONAL_PHONE_NUMBER_LENGTH);
- var NATIONAL_PREFIX_SEPARATORS_PATTERN = /[- ]/;
- var SUPPORT_LEGACY_FORMATTING_PATTERNS = true;
- var CREATE_CHARACTER_CLASS_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function() {
- return /\[([^\[\]])*\]/g;
- };
- var CREATE_STANDALONE_DIGIT_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function() {
- return /\d(?=[^,}][^,}])/g;
- };
- var NON_ALTERING_FORMAT_REG_EXP = new RegExp("[" + VALID_PUNCTUATION + "]*\\$1[" + VALID_PUNCTUATION + "]*(\\$\\d[" + VALID_PUNCTUATION + "]*)*$");
- var MIN_LEADING_DIGITS_LENGTH = 3;
- var AsYouTypeFormatter = function() {
- function AsYouTypeFormatter2(_ref) {
- var state = _ref.state, metadata = _ref.metadata;
- _classCallCheck5(this, AsYouTypeFormatter2);
- this.metadata = metadata;
- this.resetFormat();
- }
- _createClass5(AsYouTypeFormatter2, [{
- key: "resetFormat",
- value: function resetFormat() {
- this.chosenFormat = void 0;
- this.template = void 0;
- this.nationalNumberTemplate = void 0;
- this.populatedNationalNumberTemplate = void 0;
- this.populatedNationalNumberTemplatePosition = -1;
- }
- }, {
- key: "reset",
- value: function reset(numberingPlan, state) {
- this.resetFormat();
- if (numberingPlan) {
- this.isNANP = numberingPlan.callingCode() === "1";
- this.matchingFormats = numberingPlan.formats();
- if (state.nationalSignificantNumber) {
- this.narrowDownMatchingFormats(state);
- }
- } else {
- this.isNANP = void 0;
- this.matchingFormats = [];
- }
- }
- /**
- * Formats an updated phone number.
- * @param {string} nextDigits — Additional phone number digits.
- * @param {object} state — `AsYouType` state.
- * @return {[string]} Returns undefined if the updated phone number can't be formatted using any of the available formats.
- */
- }, {
- key: "format",
- value: function format(nextDigits, state) {
- var _this = this;
- if (canFormatCompleteNumber(state.nationalSignificantNumber, this.metadata)) {
- for (var _iterator = _createForOfIteratorHelperLoose7(this.matchingFormats), _step; !(_step = _iterator()).done; ) {
- var format2 = _step.value;
- var formattedCompleteNumber = formatCompleteNumber(state, format2, {
- metadata: this.metadata,
- shouldTryNationalPrefixFormattingRule: function shouldTryNationalPrefixFormattingRule(format3) {
- return _this.shouldTryNationalPrefixFormattingRule(format3, {
- international: state.international,
- nationalPrefix: state.nationalPrefix
- });
- },
- getSeparatorAfterNationalPrefix: function getSeparatorAfterNationalPrefix(format3) {
- return _this.getSeparatorAfterNationalPrefix(format3);
- }
- });
- if (formattedCompleteNumber) {
- this.resetFormat();
- this.chosenFormat = format2;
- this.setNationalNumberTemplate(formattedCompleteNumber.replace(/\d/g, DIGIT_PLACEHOLDER), state);
- this.populatedNationalNumberTemplate = formattedCompleteNumber;
- this.populatedNationalNumberTemplatePosition = this.template.lastIndexOf(DIGIT_PLACEHOLDER);
- return formattedCompleteNumber;
- }
- }
- }
- return this.formatNationalNumberWithNextDigits(nextDigits, state);
- }
- // Formats the next phone number digits.
- }, {
- key: "formatNationalNumberWithNextDigits",
- value: function formatNationalNumberWithNextDigits(nextDigits, state) {
- var previouslyChosenFormat = this.chosenFormat;
- var newlyChosenFormat = this.chooseFormat(state);
- if (newlyChosenFormat) {
- if (newlyChosenFormat === previouslyChosenFormat) {
- return this.formatNextNationalNumberDigits(nextDigits);
- } else {
- return this.formatNextNationalNumberDigits(state.getNationalDigits());
- }
- }
- }
- }, {
- key: "narrowDownMatchingFormats",
- value: function narrowDownMatchingFormats(_ref2) {
- var _this2 = this;
- var nationalSignificantNumber = _ref2.nationalSignificantNumber, nationalPrefix = _ref2.nationalPrefix, international = _ref2.international;
- var leadingDigits = nationalSignificantNumber;
- var leadingDigitsPatternIndex = leadingDigits.length - MIN_LEADING_DIGITS_LENGTH;
- if (leadingDigitsPatternIndex < 0) {
- leadingDigitsPatternIndex = 0;
- }
- this.matchingFormats = this.matchingFormats.filter(function(format) {
- return _this2.formatSuits(format, international, nationalPrefix) && _this2.formatMatches(format, leadingDigits, leadingDigitsPatternIndex);
- });
- if (this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1) {
- this.resetFormat();
- }
- }
- }, {
- key: "formatSuits",
- value: function formatSuits(format, international, nationalPrefix) {
- if (nationalPrefix && !format.usesNationalPrefix() && // !format.domesticCarrierCodeFormattingRule() &&
- !format.nationalPrefixIsOptionalWhenFormattingInNationalFormat()) {
- return false;
- }
- if (!international && !nationalPrefix && format.nationalPrefixIsMandatoryWhenFormattingInNationalFormat()) {
- return false;
- }
- return true;
- }
- }, {
- key: "formatMatches",
- value: function formatMatches(format, leadingDigits, leadingDigitsPatternIndex) {
- var leadingDigitsPatternsCount = format.leadingDigitsPatterns().length;
- if (leadingDigitsPatternsCount === 0) {
- return true;
- }
- leadingDigitsPatternIndex = Math.min(leadingDigitsPatternIndex, leadingDigitsPatternsCount - 1);
- var leadingDigitsPattern = format.leadingDigitsPatterns()[leadingDigitsPatternIndex];
- if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) {
- try {
- return new PatternMatcher(leadingDigitsPattern).match(leadingDigits, {
- allowOverflow: true
- }) !== void 0;
- } catch (error) {
- console.error(error);
- return true;
- }
- }
- return new RegExp("^(".concat(leadingDigitsPattern, ")")).test(leadingDigits);
- }
- }, {
- key: "getFormatFormat",
- value: function getFormatFormat(format, international) {
- return international ? format.internationalFormat() : format.format();
- }
- }, {
- key: "chooseFormat",
- value: function chooseFormat(state) {
- var _this3 = this;
- var _loop = function _loop2() {
- var format = _step2.value;
- if (_this3.chosenFormat === format) {
- return "break";
- }
- if (!NON_ALTERING_FORMAT_REG_EXP.test(_this3.getFormatFormat(format, state.international))) {
- return "continue";
- }
- if (!_this3.createTemplateForFormat(format, state)) {
- _this3.matchingFormats = _this3.matchingFormats.filter(function(_) {
- return _ !== format;
- });
- return "continue";
- }
- _this3.chosenFormat = format;
- return "break";
- };
- for (var _iterator2 = _createForOfIteratorHelperLoose7(this.matchingFormats.slice()), _step2; !(_step2 = _iterator2()).done; ) {
- var _ret = _loop();
- if (_ret === "break")
- break;
- if (_ret === "continue")
- continue;
- }
- if (!this.chosenFormat) {
- this.resetFormat();
- }
- return this.chosenFormat;
- }
- }, {
- key: "createTemplateForFormat",
- value: function createTemplateForFormat(format, state) {
- if (SUPPORT_LEGACY_FORMATTING_PATTERNS && format.pattern().indexOf("|") >= 0) {
- return;
- }
- var template = this.getTemplateForFormat(format, state);
- if (template) {
- this.setNationalNumberTemplate(template, state);
- return true;
- }
- }
- }, {
- key: "getSeparatorAfterNationalPrefix",
- value: function getSeparatorAfterNationalPrefix(format) {
- if (this.isNANP) {
- return " ";
- }
- if (format && format.nationalPrefixFormattingRule() && NATIONAL_PREFIX_SEPARATORS_PATTERN.test(format.nationalPrefixFormattingRule())) {
- return " ";
- }
- return "";
- }
- }, {
- key: "getInternationalPrefixBeforeCountryCallingCode",
- value: function getInternationalPrefixBeforeCountryCallingCode(_ref3, options) {
- var IDDPrefix = _ref3.IDDPrefix, missingPlus = _ref3.missingPlus;
- if (IDDPrefix) {
- return options && options.spacing === false ? IDDPrefix : IDDPrefix + " ";
- }
- if (missingPlus) {
- return "";
- }
- return "+";
- }
- }, {
- key: "getTemplate",
- value: function getTemplate(state) {
- if (!this.template) {
- return;
- }
- var index = -1;
- var i = 0;
- var internationalPrefix = state.international ? this.getInternationalPrefixBeforeCountryCallingCode(state, {
- spacing: false
- }) : "";
- while (i < internationalPrefix.length + state.getDigitsWithoutInternationalPrefix().length) {
- index = this.template.indexOf(DIGIT_PLACEHOLDER, index + 1);
- i++;
- }
- return cutAndStripNonPairedParens(this.template, index + 1);
- }
- }, {
- key: "setNationalNumberTemplate",
- value: function setNationalNumberTemplate(template, state) {
- this.nationalNumberTemplate = template;
- this.populatedNationalNumberTemplate = template;
- this.populatedNationalNumberTemplatePosition = -1;
- if (state.international) {
- this.template = this.getInternationalPrefixBeforeCountryCallingCode(state).replace(/[\d\+]/g, DIGIT_PLACEHOLDER) + repeat(DIGIT_PLACEHOLDER, state.callingCode.length) + " " + template;
- } else {
- this.template = template;
- }
- }
- /**
- * Generates formatting template for a national phone number,
- * optionally containing a national prefix, for a format.
- * @param {Format} format
- * @param {string} nationalPrefix
- * @return {string}
- */
- }, {
- key: "getTemplateForFormat",
- value: function getTemplateForFormat(format, _ref4) {
- var nationalSignificantNumber = _ref4.nationalSignificantNumber, international = _ref4.international, nationalPrefix = _ref4.nationalPrefix, complexPrefixBeforeNationalSignificantNumber = _ref4.complexPrefixBeforeNationalSignificantNumber;
- var pattern = format.pattern();
- if (SUPPORT_LEGACY_FORMATTING_PATTERNS) {
- pattern = pattern.replace(CREATE_CHARACTER_CLASS_PATTERN(), "\\d").replace(CREATE_STANDALONE_DIGIT_PATTERN(), "\\d");
- }
- var digits = LONGEST_DUMMY_PHONE_NUMBER.match(pattern)[0];
- if (nationalSignificantNumber.length > digits.length) {
- return;
- }
- var strictPattern = new RegExp("^" + pattern + "$");
- var nationalNumberDummyDigits = nationalSignificantNumber.replace(/\d/g, DUMMY_DIGIT);
- if (strictPattern.test(nationalNumberDummyDigits)) {
- digits = nationalNumberDummyDigits;
- }
- var numberFormat = this.getFormatFormat(format, international);
- var nationalPrefixIncludedInTemplate;
- if (this.shouldTryNationalPrefixFormattingRule(format, {
- international,
- nationalPrefix
- })) {
- var numberFormatWithNationalPrefix = numberFormat.replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule());
- if (parseDigits(format.nationalPrefixFormattingRule()) === (nationalPrefix || "") + parseDigits("$1")) {
- numberFormat = numberFormatWithNationalPrefix;
- nationalPrefixIncludedInTemplate = true;
- if (nationalPrefix) {
- var i = nationalPrefix.length;
- while (i > 0) {
- numberFormat = numberFormat.replace(/\d/, DIGIT_PLACEHOLDER);
- i--;
- }
- }
- }
- }
- var template = digits.replace(new RegExp(pattern), numberFormat).replace(new RegExp(DUMMY_DIGIT, "g"), DIGIT_PLACEHOLDER);
- if (!nationalPrefixIncludedInTemplate) {
- if (complexPrefixBeforeNationalSignificantNumber) {
- template = repeat(DIGIT_PLACEHOLDER, complexPrefixBeforeNationalSignificantNumber.length) + " " + template;
- } else if (nationalPrefix) {
- template = repeat(DIGIT_PLACEHOLDER, nationalPrefix.length) + this.getSeparatorAfterNationalPrefix(format) + template;
- }
- }
- if (international) {
- template = applyInternationalSeparatorStyle(template);
- }
- return template;
- }
- }, {
- key: "formatNextNationalNumberDigits",
- value: function formatNextNationalNumberDigits(digits) {
- var result2 = populateTemplateWithDigits(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, digits);
- if (!result2) {
- this.resetFormat();
- return;
- }
- this.populatedNationalNumberTemplate = result2[0];
- this.populatedNationalNumberTemplatePosition = result2[1];
- return cutAndStripNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1);
- }
- }, {
- key: "shouldTryNationalPrefixFormattingRule",
- value: function shouldTryNationalPrefixFormattingRule(format, _ref5) {
- var international = _ref5.international, nationalPrefix = _ref5.nationalPrefix;
- if (format.nationalPrefixFormattingRule()) {
- var usesNationalPrefix = format.usesNationalPrefix();
- if (usesNationalPrefix && nationalPrefix || !usesNationalPrefix && !international) {
- return true;
- }
- }
- }
- }]);
- return AsYouTypeFormatter2;
- }();
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/isPossible.js
- function isPossiblePhoneNumber(input, options, metadata) {
- if (options === void 0) {
- options = {};
- }
- metadata = new Metadata(metadata);
- if (options.v2) {
- if (!input.countryCallingCode) {
- throw new Error("Invalid phone number object passed");
- }
- metadata.selectNumberingPlan(input.countryCallingCode);
- } else {
- if (!input.phone) {
- return false;
- }
- if (input.country) {
- if (!metadata.hasCountry(input.country)) {
- throw new Error("Unknown country: ".concat(input.country));
- }
- metadata.country(input.country);
- } else {
- if (!input.countryCallingCode) {
- throw new Error("Invalid phone number object passed");
- }
- metadata.selectNumberingPlan(input.countryCallingCode);
- }
- }
- if (metadata.possibleLengths()) {
- return isPossibleNumber(input.phone || input.nationalNumber, metadata);
- } else {
- if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {
- return true;
- } else {
- throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
- }
- }
- }
- function isPossibleNumber(nationalNumber, metadata) {
- switch (checkNumberLength(nationalNumber, metadata)) {
- case "IS_POSSIBLE":
- return true;
- default:
- return false;
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js
- function matchesEntirely(text, regular_expression) {
- text = text || "";
- return new RegExp("^(?:" + regular_expression + ")$").test(text);
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/getNumberType.js
- function _createForOfIteratorHelperLoose8(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray8(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray8(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray8(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray8(o, minLen);
- }
- function _arrayLikeToArray8(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- var NON_FIXED_LINE_PHONE_TYPES = ["MOBILE", "PREMIUM_RATE", "TOLL_FREE", "SHARED_COST", "VOIP", "PERSONAL_NUMBER", "PAGER", "UAN", "VOICEMAIL"];
- function getNumberType(input, options, metadata) {
- options = options || {};
- if (!input.country && !input.countryCallingCode) {
- return;
- }
- metadata = new Metadata(metadata);
- metadata.selectNumberingPlan(input.country, input.countryCallingCode);
- var nationalNumber = options.v2 ? input.nationalNumber : input.phone;
- if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {
- return;
- }
- if (isNumberTypeEqualTo(nationalNumber, "FIXED_LINE", metadata)) {
- if (metadata.type("MOBILE") && metadata.type("MOBILE").pattern() === "") {
- return "FIXED_LINE_OR_MOBILE";
- }
- if (!metadata.type("MOBILE")) {
- return "FIXED_LINE_OR_MOBILE";
- }
- if (isNumberTypeEqualTo(nationalNumber, "MOBILE", metadata)) {
- return "FIXED_LINE_OR_MOBILE";
- }
- return "FIXED_LINE";
- }
- for (var _iterator = _createForOfIteratorHelperLoose8(NON_FIXED_LINE_PHONE_TYPES), _step; !(_step = _iterator()).done; ) {
- var type = _step.value;
- if (isNumberTypeEqualTo(nationalNumber, type, metadata)) {
- return type;
- }
- }
- }
- function isNumberTypeEqualTo(nationalNumber, type, metadata) {
- type = metadata.type(type);
- if (!type || !type.pattern()) {
- return false;
- }
- if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) {
- return false;
- }
- return matchesEntirely(nationalNumber, type.pattern());
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/isValid.js
- function isValidNumber(input, options, metadata) {
- options = options || {};
- metadata = new Metadata(metadata);
- metadata.selectNumberingPlan(input.country, input.countryCallingCode);
- if (metadata.hasTypes()) {
- return getNumberType(input, options, metadata.metadata) !== void 0;
- }
- var nationalNumber = options.v2 ? input.nationalNumber : input.phone;
- return matchesEntirely(nationalNumber, metadata.nationalNumberPattern());
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js
- function getPossibleCountriesForNumber(callingCode, nationalNumber, metadata) {
- var _metadata = new Metadata(metadata);
- var possibleCountries = _metadata.getCountryCodesForCallingCode(callingCode);
- if (!possibleCountries) {
- return [];
- }
- return possibleCountries.filter(function(country2) {
- return couldNationalNumberBelongToCountry(nationalNumber, country2, metadata);
- });
- }
- function couldNationalNumberBelongToCountry(nationalNumber, country2, metadata) {
- var _metadata = new Metadata(metadata);
- _metadata.selectNumberingPlan(country2);
- if (_metadata.numberingPlan.possibleLengths().indexOf(nationalNumber.length) >= 0) {
- return true;
- }
- return false;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js
- var SINGLE_IDD_PREFIX_REG_EXP = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;
- function getIddPrefix(country2, callingCode, metadata) {
- var countryMetadata = new Metadata(metadata);
- countryMetadata.selectNumberingPlan(country2, callingCode);
- if (countryMetadata.defaultIDDPrefix()) {
- return countryMetadata.defaultIDDPrefix();
- }
- if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) {
- return countryMetadata.IDDPrefix();
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/format.js
- function _createForOfIteratorHelperLoose9(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray9(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray9(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray9(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray9(o, minLen);
- }
- function _arrayLikeToArray9(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
- _defineProperty(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- var DEFAULT_OPTIONS = {
- formatExtension: function formatExtension(formattedNumber, extension, metadata) {
- return "".concat(formattedNumber).concat(metadata.ext()).concat(extension);
- }
- };
- function formatNumber2(input, format, options, metadata) {
- if (options) {
- options = _objectSpread(_objectSpread({}, DEFAULT_OPTIONS), options);
- } else {
- options = DEFAULT_OPTIONS;
- }
- metadata = new Metadata(metadata);
- if (input.country && input.country !== "001") {
- if (!metadata.hasCountry(input.country)) {
- throw new Error("Unknown country: ".concat(input.country));
- }
- metadata.country(input.country);
- } else if (input.countryCallingCode) {
- metadata.selectNumberingPlan(input.countryCallingCode);
- } else
- return input.phone || "";
- var countryCallingCode = metadata.countryCallingCode();
- var nationalNumber = options.v2 ? input.nationalNumber : input.phone;
- var number;
- switch (format) {
- case "NATIONAL":
- if (!nationalNumber) {
- return "";
- }
- number = formatNationalNumber2(nationalNumber, input.carrierCode, "NATIONAL", metadata, options);
- return addExtension(number, input.ext, metadata, options.formatExtension);
- case "INTERNATIONAL":
- if (!nationalNumber) {
- return "+".concat(countryCallingCode);
- }
- number = formatNationalNumber2(nationalNumber, null, "INTERNATIONAL", metadata, options);
- number = "+".concat(countryCallingCode, " ").concat(number);
- return addExtension(number, input.ext, metadata, options.formatExtension);
- case "E.164":
- return "+".concat(countryCallingCode).concat(nationalNumber);
- case "RFC3966":
- return formatRFC3966({
- number: "+".concat(countryCallingCode).concat(nationalNumber),
- ext: input.ext
- });
- case "IDD":
- if (!options.fromCountry) {
- return;
- }
- var formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata);
- return addExtension(formattedNumber, input.ext, metadata, options.formatExtension);
- default:
- throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(format, '"'));
- }
- }
- function formatNationalNumber2(number, carrierCode, formatAs, metadata, options) {
- var format = chooseFormatForNumber(metadata.formats(), number);
- if (!format) {
- return number;
- }
- return formatNationalNumberUsingFormat(number, format, {
- useInternationalFormat: formatAs === "INTERNATIONAL",
- withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true,
- carrierCode,
- metadata
- });
- }
- function chooseFormatForNumber(availableFormats, nationalNnumber) {
- for (var _iterator = _createForOfIteratorHelperLoose9(availableFormats), _step; !(_step = _iterator()).done; ) {
- var format = _step.value;
- if (format.leadingDigitsPatterns().length > 0) {
- var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1];
- if (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) {
- continue;
- }
- }
- if (matchesEntirely(nationalNnumber, format.pattern())) {
- return format;
- }
- }
- }
- function addExtension(formattedNumber, ext, metadata, formatExtension2) {
- return ext ? formatExtension2(formattedNumber, ext, metadata) : formattedNumber;
- }
- function formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) {
- var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata);
- if (fromCountryCallingCode === countryCallingCode) {
- var formattedNumber = formatNationalNumber2(nationalNumber, carrierCode, "NATIONAL", metadata);
- if (countryCallingCode === "1") {
- return countryCallingCode + " " + formattedNumber;
- }
- return formattedNumber;
- }
- var iddPrefix = getIddPrefix(fromCountry, void 0, metadata.metadata);
- if (iddPrefix) {
- return "".concat(iddPrefix, " ").concat(countryCallingCode, " ").concat(formatNationalNumber2(nationalNumber, null, "INTERNATIONAL", metadata));
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/PhoneNumber.js
- function ownKeys2(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys2(Object(source), true).forEach(function(key) {
- _defineProperty2(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys2(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _defineProperty2(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function _classCallCheck6(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties6(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass6(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties6(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties6(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;
- var PhoneNumber = function() {
- function PhoneNumber2(countryOrCountryCallingCode, nationalNumber, metadata) {
- _classCallCheck6(this, PhoneNumber2);
- if (!countryOrCountryCallingCode) {
- throw new TypeError("`country` or `countryCallingCode` not passed");
- }
- if (!nationalNumber) {
- throw new TypeError("`nationalNumber` not passed");
- }
- if (!metadata) {
- throw new TypeError("`metadata` not passed");
- }
- var _getCountryAndCountry = getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadata), country2 = _getCountryAndCountry.country, countryCallingCode = _getCountryAndCountry.countryCallingCode;
- this.country = country2;
- this.countryCallingCode = countryCallingCode;
- this.nationalNumber = nationalNumber;
- this.number = "+" + this.countryCallingCode + this.nationalNumber;
- this.getMetadata = function() {
- return metadata;
- };
- }
- _createClass6(PhoneNumber2, [{
- key: "setExt",
- value: function setExt(ext) {
- this.ext = ext;
- }
- }, {
- key: "getPossibleCountries",
- value: function getPossibleCountries() {
- if (this.country) {
- return [this.country];
- }
- return getPossibleCountriesForNumber(this.countryCallingCode, this.nationalNumber, this.getMetadata());
- }
- }, {
- key: "isPossible",
- value: function isPossible() {
- return isPossiblePhoneNumber(this, {
- v2: true
- }, this.getMetadata());
- }
- }, {
- key: "isValid",
- value: function isValid() {
- return isValidNumber(this, {
- v2: true
- }, this.getMetadata());
- }
- }, {
- key: "isNonGeographic",
- value: function isNonGeographic() {
- var metadata = new Metadata(this.getMetadata());
- return metadata.isNonGeographicCallingCode(this.countryCallingCode);
- }
- }, {
- key: "isEqual",
- value: function isEqual(phoneNumber) {
- return this.number === phoneNumber.number && this.ext === phoneNumber.ext;
- }
- // This function was originally meant to be an equivalent for `validatePhoneNumberLength()`,
- // but later it was found out that it doesn't include the possible `TOO_SHORT` result
- // returned from `parsePhoneNumberWithError()` in the original `validatePhoneNumberLength()`,
- // so eventually I simply commented out this method from the `PhoneNumber` class
- // and just left the `validatePhoneNumberLength()` function, even though that one would require
- // and additional step to also validate the actual country / calling code of the phone number.
- // validateLength() {
- // const metadata = new Metadata(this.getMetadata())
- // metadata.selectNumberingPlan(this.countryCallingCode)
- // const result = checkNumberLength(this.nationalNumber, metadata)
- // if (result !== 'IS_POSSIBLE') {
- // return result
- // }
- // }
- }, {
- key: "getType",
- value: function getType2() {
- return getNumberType(this, {
- v2: true
- }, this.getMetadata());
- }
- }, {
- key: "format",
- value: function format(_format, options) {
- return formatNumber2(this, _format, options ? _objectSpread2(_objectSpread2({}, options), {}, {
- v2: true
- }) : {
- v2: true
- }, this.getMetadata());
- }
- }, {
- key: "formatNational",
- value: function formatNational(options) {
- return this.format("NATIONAL", options);
- }
- }, {
- key: "formatInternational",
- value: function formatInternational(options) {
- return this.format("INTERNATIONAL", options);
- }
- }, {
- key: "getURI",
- value: function getURI(options) {
- return this.format("RFC3966", options);
- }
- }]);
- return PhoneNumber2;
- }();
- var isCountryCode = function isCountryCode2(value) {
- return /^[A-Z]{2}$/.test(value);
- };
- function getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadataJson) {
- var country2;
- var countryCallingCode;
- var metadata = new Metadata(metadataJson);
- if (isCountryCode(countryOrCountryCallingCode)) {
- country2 = countryOrCountryCallingCode;
- metadata.selectNumberingPlan(country2);
- countryCallingCode = metadata.countryCallingCode();
- } else {
- countryCallingCode = countryOrCountryCallingCode;
- if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
- if (metadata.isNonGeographicCallingCode(countryCallingCode)) {
- country2 = "001";
- }
- }
- }
- return {
- country: country2,
- countryCallingCode
- };
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/AsYouTypeState.js
- function _classCallCheck7(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties7(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass7(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties7(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties7(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- var AsYouTypeState = function() {
- function AsYouTypeState2(_ref) {
- var onCountryChange = _ref.onCountryChange, onCallingCodeChange = _ref.onCallingCodeChange;
- _classCallCheck7(this, AsYouTypeState2);
- this.onCountryChange = onCountryChange;
- this.onCallingCodeChange = onCallingCodeChange;
- }
- _createClass7(AsYouTypeState2, [{
- key: "reset",
- value: function reset(_ref2) {
- var country2 = _ref2.country, callingCode = _ref2.callingCode;
- this.international = false;
- this.missingPlus = false;
- this.IDDPrefix = void 0;
- this.callingCode = void 0;
- this.digits = "";
- this.resetNationalSignificantNumber();
- this.initCountryAndCallingCode(country2, callingCode);
- }
- }, {
- key: "resetNationalSignificantNumber",
- value: function resetNationalSignificantNumber() {
- this.nationalSignificantNumber = this.getNationalDigits();
- this.nationalSignificantNumberMatchesInput = true;
- this.nationalPrefix = void 0;
- this.carrierCode = void 0;
- this.complexPrefixBeforeNationalSignificantNumber = void 0;
- }
- }, {
- key: "update",
- value: function update(properties) {
- for (var _i = 0, _Object$keys = Object.keys(properties); _i < _Object$keys.length; _i++) {
- var key = _Object$keys[_i];
- this[key] = properties[key];
- }
- }
- }, {
- key: "initCountryAndCallingCode",
- value: function initCountryAndCallingCode(country2, callingCode) {
- this.setCountry(country2);
- this.setCallingCode(callingCode);
- }
- }, {
- key: "setCountry",
- value: function setCountry(country2) {
- this.country = country2;
- this.onCountryChange(country2);
- }
- }, {
- key: "setCallingCode",
- value: function setCallingCode(callingCode) {
- this.callingCode = callingCode;
- this.onCallingCodeChange(callingCode, this.country);
- }
- }, {
- key: "startInternationalNumber",
- value: function startInternationalNumber(country2, callingCode) {
- this.international = true;
- this.initCountryAndCallingCode(country2, callingCode);
- }
- }, {
- key: "appendDigits",
- value: function appendDigits(nextDigits) {
- this.digits += nextDigits;
- }
- }, {
- key: "appendNationalSignificantNumberDigits",
- value: function appendNationalSignificantNumberDigits(nextDigits) {
- this.nationalSignificantNumber += nextDigits;
- }
- /**
- * Returns the part of `this.digits` that corresponds to the national number.
- * Basically, all digits that have been input by the user, except for the
- * international prefix and the country calling code part
- * (if the number is an international one).
- * @return {string}
- */
- }, {
- key: "getNationalDigits",
- value: function getNationalDigits() {
- if (this.international) {
- return this.digits.slice((this.IDDPrefix ? this.IDDPrefix.length : 0) + (this.callingCode ? this.callingCode.length : 0));
- }
- return this.digits;
- }
- }, {
- key: "getDigitsWithoutInternationalPrefix",
- value: function getDigitsWithoutInternationalPrefix() {
- if (this.international) {
- if (this.IDDPrefix) {
- return this.digits.slice(this.IDDPrefix.length);
- }
- }
- return this.digits;
- }
- }]);
- return AsYouTypeState2;
- }();
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js
- var CAPTURING_DIGIT_PATTERN = new RegExp("([" + VALID_DIGITS + "])");
- function stripIddPrefix(number, country2, callingCode, metadata) {
- if (!country2) {
- return;
- }
- var countryMetadata = new Metadata(metadata);
- countryMetadata.selectNumberingPlan(country2, callingCode);
- var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix());
- if (number.search(IDDPrefixPattern) !== 0) {
- return;
- }
- number = number.slice(number.match(IDDPrefixPattern)[0].length);
- var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);
- if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {
- if (matchedGroups[1] === "0") {
- return;
- }
- }
- return number;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js
- function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {
- if (number && metadata.numberingPlan.nationalPrefixForParsing()) {
- var prefixPattern = new RegExp("^(?:" + metadata.numberingPlan.nationalPrefixForParsing() + ")");
- var prefixMatch = prefixPattern.exec(number);
- if (prefixMatch) {
- var nationalNumber;
- var carrierCode;
- var capturedGroupsCount = prefixMatch.length - 1;
- var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];
- if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {
- nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule());
- if (capturedGroupsCount > 1) {
- carrierCode = prefixMatch[1];
- }
- } else {
- var prefixBeforeNationalNumber = prefixMatch[0];
- nationalNumber = number.slice(prefixBeforeNationalNumber.length);
- if (hasCapturedGroups) {
- carrierCode = prefixMatch[1];
- }
- }
- var nationalPrefix;
- if (hasCapturedGroups) {
- var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);
- var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup);
- if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) {
- nationalPrefix = metadata.numberingPlan.nationalPrefix();
- }
- } else {
- nationalPrefix = prefixMatch[0];
- }
- return {
- nationalNumber,
- nationalPrefix,
- carrierCode
- };
- }
- }
- return {
- nationalNumber: number
- };
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js
- function extractNationalNumber(number, metadata) {
- var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata), carrierCode = _extractNationalNumbe.carrierCode, nationalNumber = _extractNationalNumbe.nationalNumber;
- if (nationalNumber !== number) {
- if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata)) {
- return {
- nationalNumber: number
- };
- }
- if (metadata.possibleLengths()) {
- if (!isPossibleIncompleteNationalNumber(nationalNumber, metadata)) {
- return {
- nationalNumber: number
- };
- }
- }
- }
- return {
- nationalNumber,
- carrierCode
- };
- }
- function shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) {
- if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) {
- return false;
- }
- return true;
- }
- function isPossibleIncompleteNationalNumber(nationalNumber, metadata) {
- switch (checkNumberLength(nationalNumber, metadata)) {
- case "TOO_SHORT":
- case "INVALID_LENGTH":
- return false;
- default:
- return true;
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js
- function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country2, callingCode, metadata) {
- var countryCallingCode = country2 ? getCountryCallingCode(country2, metadata) : callingCode;
- if (number.indexOf(countryCallingCode) === 0) {
- metadata = new Metadata(metadata);
- metadata.selectNumberingPlan(country2, callingCode);
- var possibleShorterNumber = number.slice(countryCallingCode.length);
- var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, metadata), possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;
- var _extractNationalNumbe2 = extractNationalNumber(number, metadata), nationalNumber = _extractNationalNumbe2.nationalNumber;
- if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, metadata) === "TOO_LONG") {
- return {
- countryCallingCode,
- number: possibleShorterNumber
- };
- }
- }
- return {
- number
- };
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js
- function extractCountryCallingCode(number, country2, callingCode, metadata) {
- if (!number) {
- return {};
- }
- var isNumberWithIddPrefix;
- if (number[0] !== "+") {
- var numberWithoutIDD = stripIddPrefix(number, country2, callingCode, metadata);
- if (numberWithoutIDD && numberWithoutIDD !== number) {
- isNumberWithIddPrefix = true;
- number = "+" + numberWithoutIDD;
- } else {
- if (country2 || callingCode) {
- var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country2, callingCode, metadata), countryCallingCode = _extractCountryCallin.countryCallingCode, shorterNumber = _extractCountryCallin.number;
- if (countryCallingCode) {
- return {
- countryCallingCodeSource: "FROM_NUMBER_WITHOUT_PLUS_SIGN",
- countryCallingCode,
- number: shorterNumber
- };
- }
- }
- return {
- // No need to set it to `UNSPECIFIED`. It can be just `undefined`.
- // countryCallingCodeSource: 'UNSPECIFIED',
- number
- };
- }
- }
- if (number[1] === "0") {
- return {};
- }
- metadata = new Metadata(metadata);
- var i = 2;
- while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {
- var _countryCallingCode = number.slice(1, i);
- if (metadata.hasCallingCode(_countryCallingCode)) {
- metadata.selectNumberingPlan(_countryCallingCode);
- return {
- countryCallingCodeSource: isNumberWithIddPrefix ? "FROM_NUMBER_WITH_IDD" : "FROM_NUMBER_WITH_PLUS_SIGN",
- countryCallingCode: _countryCallingCode,
- number: number.slice(i)
- };
- }
- i++;
- }
- return {};
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/AsYouTypeParser.js
- function _slicedToArray2(arr, i) {
- return _arrayWithHoles2(arr) || _iterableToArrayLimit2(arr, i) || _unsupportedIterableToArray10(arr, i) || _nonIterableRest2();
- }
- function _nonIterableRest2() {
- 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 _unsupportedIterableToArray10(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray10(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray10(o, minLen);
- }
- function _arrayLikeToArray10(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function _iterableToArrayLimit2(arr, i) {
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
- if (_i == null)
- return;
- var _arr = [];
- var _n = true;
- var _d = false;
- var _s, _e;
- try {
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i && _arr.length === i)
- break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null)
- _i["return"]();
- } finally {
- if (_d)
- throw _e;
- }
- }
- return _arr;
- }
- function _arrayWithHoles2(arr) {
- if (Array.isArray(arr))
- return arr;
- }
- function _classCallCheck8(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties8(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass8(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties8(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties8(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART = "[" + VALID_PUNCTUATION + VALID_DIGITS + "]+";
- var VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN = new RegExp("^" + VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART + "$", "i");
- var VALID_FORMATTED_PHONE_NUMBER_PART = "(?:[" + PLUS_CHARS + "][" + VALID_PUNCTUATION + VALID_DIGITS + "]*|[" + VALID_PUNCTUATION + VALID_DIGITS + "]+)";
- var AFTER_PHONE_NUMBER_DIGITS_END_PATTERN = new RegExp("[^" + VALID_PUNCTUATION + VALID_DIGITS + "]+.*$");
- var COMPLEX_NATIONAL_PREFIX = /[^\d\[\]]/;
- var AsYouTypeParser = function() {
- function AsYouTypeParser2(_ref) {
- var defaultCountry = _ref.defaultCountry, defaultCallingCode = _ref.defaultCallingCode, metadata = _ref.metadata, onNationalSignificantNumberChange = _ref.onNationalSignificantNumberChange;
- _classCallCheck8(this, AsYouTypeParser2);
- this.defaultCountry = defaultCountry;
- this.defaultCallingCode = defaultCallingCode;
- this.metadata = metadata;
- this.onNationalSignificantNumberChange = onNationalSignificantNumberChange;
- }
- _createClass8(AsYouTypeParser2, [{
- key: "input",
- value: function input(text, state) {
- var _extractFormattedDigi = extractFormattedDigitsAndPlus(text), _extractFormattedDigi2 = _slicedToArray2(_extractFormattedDigi, 2), formattedDigits = _extractFormattedDigi2[0], hasPlus = _extractFormattedDigi2[1];
- var digits = parseDigits(formattedDigits);
- var justLeadingPlus;
- if (hasPlus) {
- if (!state.digits) {
- state.startInternationalNumber();
- if (!digits) {
- justLeadingPlus = true;
- }
- }
- }
- if (digits) {
- this.inputDigits(digits, state);
- }
- return {
- digits,
- justLeadingPlus
- };
- }
- /**
- * Inputs "next" phone number digits.
- * @param {string} digits
- * @return {string} [formattedNumber] Formatted national phone number (if it can be formatted at this stage). Returning `undefined` means "don't format the national phone number at this stage".
- */
- }, {
- key: "inputDigits",
- value: function inputDigits(nextDigits, state) {
- var digits = state.digits;
- var hasReceivedThreeLeadingDigits = digits.length < 3 && digits.length + nextDigits.length >= 3;
- state.appendDigits(nextDigits);
- if (hasReceivedThreeLeadingDigits) {
- this.extractIddPrefix(state);
- }
- if (this.isWaitingForCountryCallingCode(state)) {
- if (!this.extractCountryCallingCode(state)) {
- return;
- }
- } else {
- state.appendNationalSignificantNumberDigits(nextDigits);
- }
- if (!state.international) {
- if (!this.hasExtractedNationalSignificantNumber) {
- this.extractNationalSignificantNumber(state.getNationalDigits(), function(stateUpdate) {
- return state.update(stateUpdate);
- });
- }
- }
- }
- }, {
- key: "isWaitingForCountryCallingCode",
- value: function isWaitingForCountryCallingCode(_ref2) {
- var international = _ref2.international, callingCode = _ref2.callingCode;
- return international && !callingCode;
- }
- // Extracts a country calling code from a number
- // being entered in internatonal format.
- }, {
- key: "extractCountryCallingCode",
- value: function extractCountryCallingCode2(state) {
- var _extractCountryCallin = extractCountryCallingCode("+" + state.getDigitsWithoutInternationalPrefix(), this.defaultCountry, this.defaultCallingCode, this.metadata.metadata), countryCallingCode = _extractCountryCallin.countryCallingCode, number = _extractCountryCallin.number;
- if (countryCallingCode) {
- state.setCallingCode(countryCallingCode);
- state.update({
- nationalSignificantNumber: number
- });
- return true;
- }
- }
- }, {
- key: "reset",
- value: function reset(numberingPlan) {
- if (numberingPlan) {
- this.hasSelectedNumberingPlan = true;
- var nationalPrefixForParsing = numberingPlan._nationalPrefixForParsing();
- this.couldPossiblyExtractAnotherNationalSignificantNumber = nationalPrefixForParsing && COMPLEX_NATIONAL_PREFIX.test(nationalPrefixForParsing);
- } else {
- this.hasSelectedNumberingPlan = void 0;
- this.couldPossiblyExtractAnotherNationalSignificantNumber = void 0;
- }
- }
- /**
- * Extracts a national (significant) number from user input.
- * Google's library is different in that it only applies `national_prefix_for_parsing`
- * and doesn't apply `national_prefix_transform_rule` after that.
- * https://github.com/google/libphonenumber/blob/a3d70b0487875475e6ad659af404943211d26456/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L539
- * @return {boolean} [extracted]
- */
- }, {
- key: "extractNationalSignificantNumber",
- value: function extractNationalSignificantNumber(nationalDigits, setState) {
- if (!this.hasSelectedNumberingPlan) {
- return;
- }
- var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata), nationalPrefix = _extractNationalNumbe.nationalPrefix, nationalNumber = _extractNationalNumbe.nationalNumber, carrierCode = _extractNationalNumbe.carrierCode;
- if (nationalNumber === nationalDigits) {
- return;
- }
- this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);
- return true;
- }
- /**
- * In Google's code this function is called "attempt to extract longer NDD".
- * "Some national prefixes are a substring of others", they say.
- * @return {boolean} [result] — Returns `true` if extracting a national prefix produced different results from what they were.
- */
- }, {
- key: "extractAnotherNationalSignificantNumber",
- value: function extractAnotherNationalSignificantNumber(nationalDigits, prevNationalSignificantNumber, setState) {
- if (!this.hasExtractedNationalSignificantNumber) {
- return this.extractNationalSignificantNumber(nationalDigits, setState);
- }
- if (!this.couldPossiblyExtractAnotherNationalSignificantNumber) {
- return;
- }
- var _extractNationalNumbe2 = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata), nationalPrefix = _extractNationalNumbe2.nationalPrefix, nationalNumber = _extractNationalNumbe2.nationalNumber, carrierCode = _extractNationalNumbe2.carrierCode;
- if (nationalNumber === prevNationalSignificantNumber) {
- return;
- }
- this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);
- return true;
- }
- }, {
- key: "onExtractedNationalNumber",
- value: function onExtractedNationalNumber(nationalPrefix, carrierCode, nationalSignificantNumber, nationalDigits, setState) {
- var complexPrefixBeforeNationalSignificantNumber;
- var nationalSignificantNumberMatchesInput;
- var nationalSignificantNumberIndex = nationalDigits.lastIndexOf(nationalSignificantNumber);
- if (nationalSignificantNumberIndex >= 0 && nationalSignificantNumberIndex === nationalDigits.length - nationalSignificantNumber.length) {
- nationalSignificantNumberMatchesInput = true;
- var prefixBeforeNationalNumber = nationalDigits.slice(0, nationalSignificantNumberIndex);
- if (prefixBeforeNationalNumber !== nationalPrefix) {
- complexPrefixBeforeNationalSignificantNumber = prefixBeforeNationalNumber;
- }
- }
- setState({
- nationalPrefix,
- carrierCode,
- nationalSignificantNumber,
- nationalSignificantNumberMatchesInput,
- complexPrefixBeforeNationalSignificantNumber
- });
- this.hasExtractedNationalSignificantNumber = true;
- this.onNationalSignificantNumberChange();
- }
- }, {
- key: "reExtractNationalSignificantNumber",
- value: function reExtractNationalSignificantNumber(state) {
- if (this.extractAnotherNationalSignificantNumber(state.getNationalDigits(), state.nationalSignificantNumber, function(stateUpdate) {
- return state.update(stateUpdate);
- })) {
- return true;
- }
- if (this.extractIddPrefix(state)) {
- this.extractCallingCodeAndNationalSignificantNumber(state);
- return true;
- }
- if (this.fixMissingPlus(state)) {
- this.extractCallingCodeAndNationalSignificantNumber(state);
- return true;
- }
- }
- }, {
- key: "extractIddPrefix",
- value: function extractIddPrefix(state) {
- var international = state.international, IDDPrefix = state.IDDPrefix, digits = state.digits, nationalSignificantNumber = state.nationalSignificantNumber;
- if (international || IDDPrefix) {
- return;
- }
- var numberWithoutIDD = stripIddPrefix(digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata);
- if (numberWithoutIDD !== void 0 && numberWithoutIDD !== digits) {
- state.update({
- IDDPrefix: digits.slice(0, digits.length - numberWithoutIDD.length)
- });
- this.startInternationalNumber(state, {
- country: void 0,
- callingCode: void 0
- });
- return true;
- }
- }
- }, {
- key: "fixMissingPlus",
- value: function fixMissingPlus(state) {
- if (!state.international) {
- var _extractCountryCallin2 = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(state.digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata), newCallingCode = _extractCountryCallin2.countryCallingCode, number = _extractCountryCallin2.number;
- if (newCallingCode) {
- state.update({
- missingPlus: true
- });
- this.startInternationalNumber(state, {
- country: state.country,
- callingCode: newCallingCode
- });
- return true;
- }
- }
- }
- }, {
- key: "startInternationalNumber",
- value: function startInternationalNumber(state, _ref3) {
- var country2 = _ref3.country, callingCode = _ref3.callingCode;
- state.startInternationalNumber(country2, callingCode);
- if (state.nationalSignificantNumber) {
- state.resetNationalSignificantNumber();
- this.onNationalSignificantNumberChange();
- this.hasExtractedNationalSignificantNumber = void 0;
- }
- }
- }, {
- key: "extractCallingCodeAndNationalSignificantNumber",
- value: function extractCallingCodeAndNationalSignificantNumber(state) {
- if (this.extractCountryCallingCode(state)) {
- this.extractNationalSignificantNumber(state.getNationalDigits(), function(stateUpdate) {
- return state.update(stateUpdate);
- });
- }
- }
- }]);
- return AsYouTypeParser2;
- }();
- function extractFormattedPhoneNumber(text) {
- var startsAt = text.search(VALID_FORMATTED_PHONE_NUMBER_PART);
- if (startsAt < 0) {
- return;
- }
- text = text.slice(startsAt);
- var hasPlus;
- if (text[0] === "+") {
- hasPlus = true;
- text = text.slice("+".length);
- }
- text = text.replace(AFTER_PHONE_NUMBER_DIGITS_END_PATTERN, "");
- if (hasPlus) {
- text = "+" + text;
- }
- return text;
- }
- function _extractFormattedDigitsAndPlus(text) {
- var extractedNumber = extractFormattedPhoneNumber(text) || "";
- if (extractedNumber[0] === "+") {
- return [extractedNumber.slice("+".length), true];
- }
- return [extractedNumber];
- }
- function extractFormattedDigitsAndPlus(text) {
- var _extractFormattedDigi3 = _extractFormattedDigitsAndPlus(text), _extractFormattedDigi4 = _slicedToArray2(_extractFormattedDigi3, 2), formattedDigits = _extractFormattedDigi4[0], hasPlus = _extractFormattedDigi4[1];
- if (!VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN.test(formattedDigits)) {
- formattedDigits = "";
- }
- return [formattedDigits, hasPlus];
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js
- function _createForOfIteratorHelperLoose10(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray11(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray11(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray11(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray11(o, minLen);
- }
- function _arrayLikeToArray11(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
- var countries = _ref.countries, defaultCountry = _ref.defaultCountry, metadata = _ref.metadata;
- metadata = new Metadata(metadata);
- for (var _iterator = _createForOfIteratorHelperLoose10(countries), _step; !(_step = _iterator()).done; ) {
- var country2 = _step.value;
- metadata.country(country2);
- if (metadata.leadingDigits()) {
- if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) {
- return country2;
- }
- } else if (getNumberType({
- phone: nationalPhoneNumber,
- country: country2
- }, void 0, metadata.metadata)) {
- return country2;
- }
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js
- var USE_NON_GEOGRAPHIC_COUNTRY_CODE2 = false;
- function getCountryByCallingCode(callingCode, _ref) {
- var nationalPhoneNumber = _ref.nationalNumber, defaultCountry = _ref.defaultCountry, metadata = _ref.metadata;
- if (USE_NON_GEOGRAPHIC_COUNTRY_CODE2) {
- if (metadata.isNonGeographicCallingCode(callingCode)) {
- return "001";
- }
- }
- var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);
- if (!possibleCountries) {
- return;
- }
- if (possibleCountries.length === 1) {
- return possibleCountries[0];
- }
- return getCountryByNationalNumber(nationalPhoneNumber, {
- countries: possibleCountries,
- defaultCountry,
- metadata: metadata.metadata
- });
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/AsYouType.js
- function _slicedToArray3(arr, i) {
- return _arrayWithHoles3(arr) || _iterableToArrayLimit3(arr, i) || _unsupportedIterableToArray12(arr, i) || _nonIterableRest3();
- }
- function _nonIterableRest3() {
- 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 _unsupportedIterableToArray12(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray12(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray12(o, minLen);
- }
- function _arrayLikeToArray12(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function _iterableToArrayLimit3(arr, i) {
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
- if (_i == null)
- return;
- var _arr = [];
- var _n = true;
- var _d = false;
- var _s, _e;
- try {
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i && _arr.length === i)
- break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null)
- _i["return"]();
- } finally {
- if (_d)
- throw _e;
- }
- }
- return _arr;
- }
- function _arrayWithHoles3(arr) {
- if (Array.isArray(arr))
- return arr;
- }
- function _classCallCheck9(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties9(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass9(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties9(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties9(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- var USE_NON_GEOGRAPHIC_COUNTRY_CODE3 = false;
- var AsYouType = function() {
- function AsYouType2(optionsOrDefaultCountry, metadata) {
- _classCallCheck9(this, AsYouType2);
- this.metadata = new Metadata(metadata);
- var _this$getCountryAndCa = this.getCountryAndCallingCode(optionsOrDefaultCountry), _this$getCountryAndCa2 = _slicedToArray3(_this$getCountryAndCa, 2), defaultCountry = _this$getCountryAndCa2[0], defaultCallingCode = _this$getCountryAndCa2[1];
- this.defaultCountry = defaultCountry;
- this.defaultCallingCode = defaultCallingCode;
- this.reset();
- }
- _createClass9(AsYouType2, [{
- key: "getCountryAndCallingCode",
- value: function getCountryAndCallingCode(optionsOrDefaultCountry) {
- var defaultCountry;
- var defaultCallingCode;
- if (optionsOrDefaultCountry) {
- if (isObject(optionsOrDefaultCountry)) {
- defaultCountry = optionsOrDefaultCountry.defaultCountry;
- defaultCallingCode = optionsOrDefaultCountry.defaultCallingCode;
- } else {
- defaultCountry = optionsOrDefaultCountry;
- }
- }
- if (defaultCountry && !this.metadata.hasCountry(defaultCountry)) {
- defaultCountry = void 0;
- }
- if (defaultCallingCode) {
- if (USE_NON_GEOGRAPHIC_COUNTRY_CODE3) {
- if (this.metadata.isNonGeographicCallingCode(defaultCallingCode)) {
- defaultCountry = "001";
- }
- }
- }
- return [defaultCountry, defaultCallingCode];
- }
- /**
- * Inputs "next" phone number characters.
- * @param {string} text
- * @return {string} Formatted phone number characters that have been input so far.
- */
- }, {
- key: "input",
- value: function input(text) {
- var _this$parser$input = this.parser.input(text, this.state), digits = _this$parser$input.digits, justLeadingPlus = _this$parser$input.justLeadingPlus;
- if (justLeadingPlus) {
- this.formattedOutput = "+";
- } else if (digits) {
- this.determineTheCountryIfNeeded();
- if (this.state.nationalSignificantNumber) {
- this.formatter.narrowDownMatchingFormats(this.state);
- }
- var formattedNationalNumber;
- if (this.metadata.hasSelectedNumberingPlan()) {
- formattedNationalNumber = this.formatter.format(digits, this.state);
- }
- if (formattedNationalNumber === void 0) {
- if (this.parser.reExtractNationalSignificantNumber(this.state)) {
- this.determineTheCountryIfNeeded();
- var nationalDigits = this.state.getNationalDigits();
- if (nationalDigits) {
- formattedNationalNumber = this.formatter.format(nationalDigits, this.state);
- }
- }
- }
- this.formattedOutput = formattedNationalNumber ? this.getFullNumber(formattedNationalNumber) : this.getNonFormattedNumber();
- }
- return this.formattedOutput;
- }
- }, {
- key: "reset",
- value: function reset() {
- var _this = this;
- this.state = new AsYouTypeState({
- onCountryChange: function onCountryChange(country2) {
- _this.country = country2;
- },
- onCallingCodeChange: function onCallingCodeChange(callingCode, country2) {
- _this.metadata.selectNumberingPlan(country2, callingCode);
- _this.formatter.reset(_this.metadata.numberingPlan, _this.state);
- _this.parser.reset(_this.metadata.numberingPlan);
- }
- });
- this.formatter = new AsYouTypeFormatter({
- state: this.state,
- metadata: this.metadata
- });
- this.parser = new AsYouTypeParser({
- defaultCountry: this.defaultCountry,
- defaultCallingCode: this.defaultCallingCode,
- metadata: this.metadata,
- state: this.state,
- onNationalSignificantNumberChange: function onNationalSignificantNumberChange() {
- _this.determineTheCountryIfNeeded();
- _this.formatter.reset(_this.metadata.numberingPlan, _this.state);
- }
- });
- this.state.reset({
- country: this.defaultCountry,
- callingCode: this.defaultCallingCode
- });
- this.formattedOutput = "";
- return this;
- }
- /**
- * Returns `true` if the phone number is being input in international format.
- * In other words, returns `true` if and only if the parsed phone number starts with a `"+"`.
- * @return {boolean}
- */
- }, {
- key: "isInternational",
- value: function isInternational() {
- return this.state.international;
- }
- /**
- * Returns the "calling code" part of the phone number when it's being input
- * in an international format.
- * If no valid calling code has been entered so far, returns `undefined`.
- * @return {string} [callingCode]
- */
- }, {
- key: "getCallingCode",
- value: function getCallingCode() {
- if (this.isInternational()) {
- return this.state.callingCode;
- }
- }
- // A legacy alias.
- }, {
- key: "getCountryCallingCode",
- value: function getCountryCallingCode2() {
- return this.getCallingCode();
- }
- /**
- * Returns a two-letter country code of the phone number.
- * Returns `undefined` for "non-geographic" phone numbering plans.
- * Returns `undefined` if no phone number has been input yet.
- * @return {string} [country]
- */
- }, {
- key: "getCountry",
- value: function getCountry() {
- var digits = this.state.digits;
- if (digits) {
- return this._getCountry();
- }
- }
- /**
- * Returns a two-letter country code of the phone number.
- * Returns `undefined` for "non-geographic" phone numbering plans.
- * @return {string} [country]
- */
- }, {
- key: "_getCountry",
- value: function _getCountry() {
- var country2 = this.state.country;
- if (USE_NON_GEOGRAPHIC_COUNTRY_CODE3) {
- if (country2 === "001") {
- return;
- }
- }
- return country2;
- }
- }, {
- key: "determineTheCountryIfNeeded",
- value: function determineTheCountryIfNeeded() {
- if (!this.state.country || this.isCountryCallingCodeAmbiguous()) {
- this.determineTheCountry();
- }
- }
- // Prepends `+CountryCode ` in case of an international phone number
- }, {
- key: "getFullNumber",
- value: function getFullNumber(formattedNationalNumber) {
- var _this2 = this;
- if (this.isInternational()) {
- var prefix = function prefix2(text) {
- return _this2.formatter.getInternationalPrefixBeforeCountryCallingCode(_this2.state, {
- spacing: text ? true : false
- }) + text;
- };
- var callingCode = this.state.callingCode;
- if (!callingCode) {
- return prefix("".concat(this.state.getDigitsWithoutInternationalPrefix()));
- }
- if (!formattedNationalNumber) {
- return prefix(callingCode);
- }
- return prefix("".concat(callingCode, " ").concat(formattedNationalNumber));
- }
- return formattedNationalNumber;
- }
- }, {
- key: "getNonFormattedNationalNumberWithPrefix",
- value: function getNonFormattedNationalNumberWithPrefix() {
- var _this$state = this.state, nationalSignificantNumber = _this$state.nationalSignificantNumber, complexPrefixBeforeNationalSignificantNumber = _this$state.complexPrefixBeforeNationalSignificantNumber, nationalPrefix = _this$state.nationalPrefix;
- var number = nationalSignificantNumber;
- var prefix = complexPrefixBeforeNationalSignificantNumber || nationalPrefix;
- if (prefix) {
- number = prefix + number;
- }
- return number;
- }
- }, {
- key: "getNonFormattedNumber",
- value: function getNonFormattedNumber() {
- var nationalSignificantNumberMatchesInput = this.state.nationalSignificantNumberMatchesInput;
- return this.getFullNumber(nationalSignificantNumberMatchesInput ? this.getNonFormattedNationalNumberWithPrefix() : this.state.getNationalDigits());
- }
- }, {
- key: "getNonFormattedTemplate",
- value: function getNonFormattedTemplate() {
- var number = this.getNonFormattedNumber();
- if (number) {
- return number.replace(/[\+\d]/g, DIGIT_PLACEHOLDER);
- }
- }
- }, {
- key: "isCountryCallingCodeAmbiguous",
- value: function isCountryCallingCodeAmbiguous() {
- var callingCode = this.state.callingCode;
- var countryCodes = this.metadata.getCountryCodesForCallingCode(callingCode);
- return countryCodes && countryCodes.length > 1;
- }
- // Determines the country of the phone number
- // entered so far based on the country phone code
- // and the national phone number.
- }, {
- key: "determineTheCountry",
- value: function determineTheCountry() {
- this.state.setCountry(getCountryByCallingCode(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, {
- nationalNumber: this.state.nationalSignificantNumber,
- defaultCountry: this.defaultCountry,
- metadata: this.metadata
- }));
- }
- /**
- * Returns a E.164 phone number value for the user's input.
- *
- * For example, for country `"US"` and input `"(222) 333-4444"`
- * it will return `"+12223334444"`.
- *
- * For international phone number input, it will also auto-correct
- * some minor errors such as using a national prefix when writing
- * an international phone number. For example, if the user inputs
- * `"+44 0 7400 000000"` then it will return an auto-corrected
- * `"+447400000000"` phone number value.
- *
- * Will return `undefined` if no digits have been input,
- * or when inputting a phone number in national format and no
- * default country or default "country calling code" have been set.
- *
- * @return {string} [value]
- */
- }, {
- key: "getNumberValue",
- value: function getNumberValue() {
- var _this$state2 = this.state, digits = _this$state2.digits, callingCode = _this$state2.callingCode, country2 = _this$state2.country, nationalSignificantNumber = _this$state2.nationalSignificantNumber;
- if (!digits) {
- return;
- }
- if (this.isInternational()) {
- if (callingCode) {
- return "+" + callingCode + nationalSignificantNumber;
- } else {
- return "+" + digits;
- }
- } else {
- if (country2 || callingCode) {
- var callingCode_ = country2 ? this.metadata.countryCallingCode() : callingCode;
- return "+" + callingCode_ + nationalSignificantNumber;
- }
- }
- }
- /**
- * Returns an instance of `PhoneNumber` class.
- * Will return `undefined` if no national (significant) number
- * digits have been entered so far, or if no `defaultCountry` has been
- * set and the user enters a phone number not in international format.
- */
- }, {
- key: "getNumber",
- value: function getNumber() {
- var _this$state3 = this.state, nationalSignificantNumber = _this$state3.nationalSignificantNumber, carrierCode = _this$state3.carrierCode, callingCode = _this$state3.callingCode;
- var country2 = this._getCountry();
- if (!nationalSignificantNumber) {
- return;
- }
- if (!country2 && !callingCode) {
- return;
- }
- if (country2) {
- if (country2 === this.defaultCountry) {
- var metadata = new Metadata(this.metadata.metadata);
- metadata.selectNumberingPlan(country2);
- var _callingCode = metadata.numberingPlan.callingCode();
- var ambiguousCountries = this.metadata.getCountryCodesForCallingCode(_callingCode);
- if (ambiguousCountries.length > 1) {
- var exactCountry = getCountryByNationalNumber(nationalSignificantNumber, {
- countries: ambiguousCountries,
- defaultCountry: this.defaultCountry,
- metadata: this.metadata.metadata
- });
- if (exactCountry) {
- country2 = exactCountry;
- }
- }
- }
- }
- var phoneNumber = new PhoneNumber(country2 || callingCode, nationalSignificantNumber, this.metadata.metadata);
- if (carrierCode) {
- phoneNumber.carrierCode = carrierCode;
- }
- return phoneNumber;
- }
- /**
- * Returns `true` if the phone number is "possible".
- * Is just a shortcut for `PhoneNumber.isPossible()`.
- * @return {boolean}
- */
- }, {
- key: "isPossible",
- value: function isPossible() {
- var phoneNumber = this.getNumber();
- if (!phoneNumber) {
- return false;
- }
- return phoneNumber.isPossible();
- }
- /**
- * Returns `true` if the phone number is "valid".
- * Is just a shortcut for `PhoneNumber.isValid()`.
- * @return {boolean}
- */
- }, {
- key: "isValid",
- value: function isValid() {
- var phoneNumber = this.getNumber();
- if (!phoneNumber) {
- return false;
- }
- return phoneNumber.isValid();
- }
- /**
- * @deprecated
- * This method is used in `react-phone-number-input/source/input-control.js`
- * in versions before `3.0.16`.
- */
- }, {
- key: "getNationalNumber",
- value: function getNationalNumber() {
- return this.state.nationalSignificantNumber;
- }
- /**
- * Returns the phone number characters entered by the user.
- * @return {string}
- */
- }, {
- key: "getChars",
- value: function getChars() {
- return (this.state.international ? "+" : "") + this.state.digits;
- }
- /**
- * Returns the template for the formatted phone number.
- * @return {string}
- */
- }, {
- key: "getTemplate",
- value: function getTemplate() {
- return this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || "";
- }
- }]);
- return AsYouType2;
- }();
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js
- var EXTN_PATTERN = new RegExp("(?:" + createExtensionPattern() + ")$", "i");
- function extractExtension(number) {
- var start = number.search(EXTN_PATTERN);
- if (start < 0) {
- return {};
- }
- var numberWithoutExtension = number.slice(0, start);
- var matches = number.match(EXTN_PATTERN);
- var i = 1;
- while (i < matches.length) {
- if (matches[i]) {
- return {
- number: numberWithoutExtension,
- ext: matches[i]
- };
- }
- i++;
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js
- var PLUS_SIGN = "+";
- var RFC3966_VISUAL_SEPARATOR_ = "[\\-\\.\\(\\)]?";
- var RFC3966_PHONE_DIGIT_ = "([" + VALID_DIGITS + "]|" + RFC3966_VISUAL_SEPARATOR_ + ")";
- var RFC3966_GLOBAL_NUMBER_DIGITS_ = "^\\" + PLUS_SIGN + RFC3966_PHONE_DIGIT_ + "*[" + VALID_DIGITS + "]" + RFC3966_PHONE_DIGIT_ + "*$";
- var RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_ = new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_, "g");
- var ALPHANUM_ = VALID_DIGITS;
- var RFC3966_DOMAINLABEL_ = "[" + ALPHANUM_ + "]+((\\-)*[" + ALPHANUM_ + "])*";
- var VALID_ALPHA_ = "a-zA-Z";
- var RFC3966_TOPLABEL_ = "[" + VALID_ALPHA_ + "]+((\\-)*[" + ALPHANUM_ + "])*";
- var RFC3966_DOMAINNAME_ = "^(" + RFC3966_DOMAINLABEL_ + "\\.)*" + RFC3966_TOPLABEL_ + "\\.?$";
- var RFC3966_DOMAINNAME_PATTERN_ = new RegExp(RFC3966_DOMAINNAME_, "g");
- var RFC3966_PREFIX_ = "tel:";
- var RFC3966_PHONE_CONTEXT_ = ";phone-context=";
- var RFC3966_ISDN_SUBADDRESS_ = ";isub=";
- function extractPhoneContext(numberToExtractFrom) {
- var indexOfPhoneContext = numberToExtractFrom.indexOf(RFC3966_PHONE_CONTEXT_);
- if (indexOfPhoneContext < 0) {
- return null;
- }
- var phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT_.length;
- if (phoneContextStart >= numberToExtractFrom.length) {
- return "";
- }
- var phoneContextEnd = numberToExtractFrom.indexOf(";", phoneContextStart);
- if (phoneContextEnd >= 0) {
- return numberToExtractFrom.substring(phoneContextStart, phoneContextEnd);
- } else {
- return numberToExtractFrom.substring(phoneContextStart);
- }
- }
- function isPhoneContextValid(phoneContext) {
- if (phoneContext === null) {
- return true;
- }
- if (phoneContext.length === 0) {
- return false;
- }
- return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(phoneContext) || RFC3966_DOMAINNAME_PATTERN_.test(phoneContext);
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js
- function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(numberToParse, _ref) {
- var extractFormattedPhoneNumber2 = _ref.extractFormattedPhoneNumber;
- var phoneContext = extractPhoneContext(numberToParse);
- if (!isPhoneContextValid(phoneContext)) {
- throw new ParseError("NOT_A_NUMBER");
- }
- var phoneNumberString;
- if (phoneContext === null) {
- phoneNumberString = extractFormattedPhoneNumber2(numberToParse) || "";
- } else {
- phoneNumberString = "";
- if (phoneContext.charAt(0) === PLUS_SIGN) {
- phoneNumberString += phoneContext;
- }
- var indexOfRfc3966Prefix = numberToParse.indexOf(RFC3966_PREFIX_);
- var indexOfNationalNumber;
- if (indexOfRfc3966Prefix >= 0) {
- indexOfNationalNumber = indexOfRfc3966Prefix + RFC3966_PREFIX_.length;
- } else {
- indexOfNationalNumber = 0;
- }
- var indexOfPhoneContext = numberToParse.indexOf(RFC3966_PHONE_CONTEXT_);
- phoneNumberString += numberToParse.substring(indexOfNationalNumber, indexOfPhoneContext);
- }
- var indexOfIsdn = phoneNumberString.indexOf(RFC3966_ISDN_SUBADDRESS_);
- if (indexOfIsdn > 0) {
- phoneNumberString = phoneNumberString.substring(0, indexOfIsdn);
- }
- if (phoneNumberString !== "") {
- return phoneNumberString;
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/parse.js
- var MAX_INPUT_STRING_LENGTH = 250;
- var PHONE_NUMBER_START_PATTERN = new RegExp("[" + PLUS_CHARS + VALID_DIGITS + "]");
- var AFTER_PHONE_NUMBER_END_PATTERN = new RegExp("[^" + VALID_DIGITS + "#]+$");
- var USE_NON_GEOGRAPHIC_COUNTRY_CODE4 = false;
- function parse(text, options, metadata) {
- options = options || {};
- metadata = new Metadata(metadata);
- if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) {
- if (options.v2) {
- throw new ParseError("INVALID_COUNTRY");
- }
- throw new Error("Unknown country: ".concat(options.defaultCountry));
- }
- var _parseInput = parseInput(text, options.v2, options.extract), formattedPhoneNumber = _parseInput.number, ext = _parseInput.ext, error = _parseInput.error;
- if (!formattedPhoneNumber) {
- if (options.v2) {
- if (error === "TOO_SHORT") {
- throw new ParseError("TOO_SHORT");
- }
- throw new ParseError("NOT_A_NUMBER");
- }
- return {};
- }
- var _parsePhoneNumber = parsePhoneNumber(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode, metadata), country2 = _parsePhoneNumber.country, nationalNumber = _parsePhoneNumber.nationalNumber, countryCallingCode = _parsePhoneNumber.countryCallingCode, countryCallingCodeSource = _parsePhoneNumber.countryCallingCodeSource, carrierCode = _parsePhoneNumber.carrierCode;
- if (!metadata.hasSelectedNumberingPlan()) {
- if (options.v2) {
- throw new ParseError("INVALID_COUNTRY");
- }
- return {};
- }
- if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) {
- if (options.v2) {
- throw new ParseError("TOO_SHORT");
- }
- return {};
- }
- if (nationalNumber.length > MAX_LENGTH_FOR_NSN) {
- if (options.v2) {
- throw new ParseError("TOO_LONG");
- }
- return {};
- }
- if (options.v2) {
- var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata);
- if (country2) {
- phoneNumber.country = country2;
- }
- if (carrierCode) {
- phoneNumber.carrierCode = carrierCode;
- }
- if (ext) {
- phoneNumber.ext = ext;
- }
- phoneNumber.__countryCallingCodeSource = countryCallingCodeSource;
- return phoneNumber;
- }
- var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country2) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false;
- if (!options.extended) {
- return valid ? result(country2, nationalNumber, ext) : {};
- }
- return {
- country: country2,
- countryCallingCode,
- carrierCode,
- valid,
- possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, metadata) ? true : false,
- phone: nationalNumber,
- ext
- };
- }
- function _extractFormattedPhoneNumber(text, extract, throwOnError) {
- if (!text) {
- return;
- }
- if (text.length > MAX_INPUT_STRING_LENGTH) {
- if (throwOnError) {
- throw new ParseError("TOO_LONG");
- }
- return;
- }
- if (extract === false) {
- return text;
- }
- var startsAt = text.search(PHONE_NUMBER_START_PATTERN);
- if (startsAt < 0) {
- return;
- }
- return text.slice(startsAt).replace(AFTER_PHONE_NUMBER_END_PATTERN, "");
- }
- function parseInput(text, v2, extract) {
- var number = extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(text, {
- extractFormattedPhoneNumber: function extractFormattedPhoneNumber2(text2) {
- return _extractFormattedPhoneNumber(text2, extract, v2);
- }
- });
- if (!number) {
- return {};
- }
- if (!isViablePhoneNumber(number)) {
- if (isViablePhoneNumberStart(number)) {
- return {
- error: "TOO_SHORT"
- };
- }
- return {};
- }
- var withExtensionStripped = extractExtension(number);
- if (withExtensionStripped.ext) {
- return withExtensionStripped;
- }
- return {
- number
- };
- }
- function result(country2, nationalNumber, ext) {
- var result2 = {
- country: country2,
- phone: nationalNumber
- };
- if (ext) {
- result2.ext = ext;
- }
- return result2;
- }
- function parsePhoneNumber(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) {
- var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), defaultCountry, defaultCallingCode, metadata.metadata), countryCallingCodeSource = _extractCountryCallin.countryCallingCodeSource, countryCallingCode = _extractCountryCallin.countryCallingCode, number = _extractCountryCallin.number;
- var country2;
- if (countryCallingCode) {
- metadata.selectNumberingPlan(countryCallingCode);
- } else if (number && (defaultCountry || defaultCallingCode)) {
- metadata.selectNumberingPlan(defaultCountry, defaultCallingCode);
- if (defaultCountry) {
- country2 = defaultCountry;
- } else {
- if (USE_NON_GEOGRAPHIC_COUNTRY_CODE4) {
- if (metadata.isNonGeographicCallingCode(defaultCallingCode)) {
- country2 = "001";
- }
- }
- }
- countryCallingCode = defaultCallingCode || getCountryCallingCode(defaultCountry, metadata.metadata);
- } else
- return {};
- if (!number) {
- return {
- countryCallingCodeSource,
- countryCallingCode
- };
- }
- var _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), metadata), nationalNumber = _extractNationalNumbe.nationalNumber, carrierCode = _extractNationalNumbe.carrierCode;
- var exactCountry = getCountryByCallingCode(countryCallingCode, {
- nationalNumber,
- defaultCountry,
- metadata
- });
- if (exactCountry) {
- country2 = exactCountry;
- if (exactCountry === "001") {
- } else {
- metadata.country(country2);
- }
- }
- return {
- country: country2,
- countryCallingCode,
- countryCallingCodeSource,
- nationalNumber,
- carrierCode
- };
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js
- function ownKeys3(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread3(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys3(Object(source), true).forEach(function(key) {
- _defineProperty3(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys3(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _defineProperty3(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function parsePhoneNumberWithError(text, options, metadata) {
- return parse(text, _objectSpread3(_objectSpread3({}, options), {}, {
- v2: true
- }), metadata);
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/normalizeArguments.js
- function ownKeys4(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread4(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys4(Object(source), true).forEach(function(key) {
- _defineProperty4(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys4(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _defineProperty4(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function _slicedToArray4(arr, i) {
- return _arrayWithHoles4(arr) || _iterableToArrayLimit4(arr, i) || _unsupportedIterableToArray13(arr, i) || _nonIterableRest4();
- }
- function _nonIterableRest4() {
- 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 _unsupportedIterableToArray13(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray13(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray13(o, minLen);
- }
- function _arrayLikeToArray13(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function _iterableToArrayLimit4(arr, i) {
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
- if (_i == null)
- return;
- var _arr = [];
- var _n = true;
- var _d = false;
- var _s, _e;
- try {
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i && _arr.length === i)
- break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null)
- _i["return"]();
- } finally {
- if (_d)
- throw _e;
- }
- }
- return _arr;
- }
- function _arrayWithHoles4(arr) {
- if (Array.isArray(arr))
- return arr;
- }
- function normalizeArguments(args) {
- var _Array$prototype$slic = Array.prototype.slice.call(args), _Array$prototype$slic2 = _slicedToArray4(_Array$prototype$slic, 4), arg_1 = _Array$prototype$slic2[0], arg_2 = _Array$prototype$slic2[1], arg_3 = _Array$prototype$slic2[2], arg_4 = _Array$prototype$slic2[3];
- var text;
- var options;
- var metadata;
- if (typeof arg_1 === "string") {
- text = arg_1;
- } else
- throw new TypeError("A text for parsing must be a string.");
- if (!arg_2 || typeof arg_2 === "string") {
- if (arg_4) {
- options = arg_3;
- metadata = arg_4;
- } else {
- options = void 0;
- metadata = arg_3;
- }
- if (arg_2) {
- options = _objectSpread4({
- defaultCountry: arg_2
- }, options);
- }
- } else if (isObject(arg_2)) {
- if (arg_3) {
- options = arg_2;
- metadata = arg_3;
- } else {
- metadata = arg_2;
- }
- } else
- throw new Error("Invalid second argument: ".concat(arg_2));
- return {
- text,
- options,
- metadata
- };
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError.js
- function parsePhoneNumberWithError2() {
- var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
- return parsePhoneNumberWithError(text, options, metadata);
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js
- function ownKeys5(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread5(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys5(Object(source), true).forEach(function(key) {
- _defineProperty5(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys5(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _defineProperty5(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function parsePhoneNumber2(text, options, metadata) {
- if (options && options.defaultCountry && !isSupportedCountry(options.defaultCountry, metadata)) {
- options = _objectSpread5(_objectSpread5({}, options), {}, {
- defaultCountry: void 0
- });
- }
- try {
- return parsePhoneNumberWithError(text, options, metadata);
- } catch (error) {
- if (error instanceof ParseError) {
- } else {
- throw error;
- }
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/parsePhoneNumber.js
- function parsePhoneNumber3() {
- var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
- return parsePhoneNumber2(text, options, metadata);
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/isValidPhoneNumber.js
- function ownKeys6(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread6(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys6(Object(source), true).forEach(function(key) {
- _defineProperty6(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys6(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _defineProperty6(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function isValidPhoneNumber() {
- var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
- options = _objectSpread6(_objectSpread6({}, options), {}, {
- extract: false
- });
- var phoneNumber = parsePhoneNumber2(text, options, metadata);
- return phoneNumber && phoneNumber.isValid() || false;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/isPossiblePhoneNumber.js
- function ownKeys7(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread7(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys7(Object(source), true).forEach(function(key) {
- _defineProperty7(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys7(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _defineProperty7(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function isPossiblePhoneNumber2() {
- var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
- options = _objectSpread7(_objectSpread7({}, options), {}, {
- extract: false
- });
- var phoneNumber = parsePhoneNumber2(text, options, metadata);
- return phoneNumber && phoneNumber.isPossible() || false;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/validatePhoneNumberLength.js
- function ownKeys8(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread8(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys8(Object(source), true).forEach(function(key) {
- _defineProperty8(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys8(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _defineProperty8(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function validatePhoneNumberLength() {
- var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
- options = _objectSpread8(_objectSpread8({}, options), {}, {
- extract: false
- });
- try {
- var phoneNumber = parsePhoneNumberWithError(text, options, metadata);
- metadata = new Metadata(metadata);
- metadata.selectNumberingPlan(phoneNumber.countryCallingCode);
- var result2 = checkNumberLength(phoneNumber.nationalNumber, metadata);
- if (result2 !== "IS_POSSIBLE") {
- return result2;
- }
- } catch (error) {
- if (error instanceof ParseError) {
- return error.message;
- } else {
- throw error;
- }
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/findNumbers/LRUCache.js
- function _defineProperties10(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass10(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties10(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties10(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- function _classCallCheck10(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- var Node = _createClass10(function Node2(key, value) {
- var next = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
- var prev = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
- _classCallCheck10(this, Node2);
- this.key = key;
- this.value = value;
- this.next = next;
- this.prev = prev;
- });
- var LRUCache = function() {
- function LRUCache2() {
- var limit2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 10;
- _classCallCheck10(this, LRUCache2);
- this.size = 0;
- this.limit = limit2;
- this.head = null;
- this.tail = null;
- this.cache = {};
- }
- _createClass10(LRUCache2, [{
- key: "put",
- value: function put(key, value) {
- this.ensureLimit();
- if (!this.head) {
- this.head = this.tail = new Node(key, value);
- } else {
- var node = new Node(key, value, this.head);
- this.head.prev = node;
- this.head = node;
- }
- this.cache[key] = this.head;
- this.size++;
- }
- // Read from cache map and make that node as new Head of LinkedList
- }, {
- key: "get",
- value: function get(key) {
- if (this.cache[key]) {
- var value = this.cache[key].value;
- this.remove(key);
- this.put(key, value);
- return value;
- }
- console.log("Item not available in cache for key ".concat(key));
- }
- }, {
- key: "ensureLimit",
- value: function ensureLimit() {
- if (this.size === this.limit) {
- this.remove(this.tail.key);
- }
- }
- }, {
- key: "remove",
- value: function remove(key) {
- var node = this.cache[key];
- if (node.prev !== null) {
- node.prev.next = node.next;
- } else {
- this.head = node.next;
- }
- if (node.next !== null) {
- node.next.prev = node.prev;
- } else {
- this.tail = node.prev;
- }
- delete this.cache[key];
- this.size--;
- }
- }, {
- key: "clear",
- value: function clear() {
- this.head = null;
- this.tail = null;
- this.size = 0;
- this.cache = {};
- }
- // // Invokes the callback function with every node of the chain and the index of the node.
- // forEach(fn) {
- // let node = this.head;
- // let counter = 0;
- // while (node) {
- // fn(node, counter);
- // node = node.next;
- // counter++;
- // }
- // }
- // // To iterate over LRU with a 'for...of' loop
- // *[Symbol.iterator]() {
- // let node = this.head;
- // while (node) {
- // yield node;
- // node = node.next;
- // }
- // }
- }]);
- return LRUCache2;
- }();
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/findNumbers/RegExpCache.js
- function _classCallCheck11(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties11(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass11(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties11(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties11(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- var RegExpCache = function() {
- function RegExpCache2(size) {
- _classCallCheck11(this, RegExpCache2);
- this.cache = new LRUCache(size);
- }
- _createClass11(RegExpCache2, [{
- key: "getPatternForRegExp",
- value: function getPatternForRegExp(pattern) {
- var regExp = this.cache.get(pattern);
- if (!regExp) {
- regExp = new RegExp("^" + pattern);
- this.cache.put(pattern, regExp);
- }
- return regExp;
- }
- }]);
- return RegExpCache2;
- }();
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/findNumbers/util.js
- function limit(lower, upper) {
- if (lower < 0 || upper <= 0 || upper < lower) {
- throw new TypeError();
- }
- return "{".concat(lower, ",").concat(upper, "}");
- }
- function trimAfterFirstMatch(regexp, string) {
- var index = string.search(regexp);
- if (index >= 0) {
- return string.slice(0, index);
- }
- return string;
- }
- function startsWith(string, substring) {
- return string.indexOf(substring) === 0;
- }
- function endsWith(string, substring) {
- return string.indexOf(substring, string.length - substring.length) === string.length - substring.length;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/findNumbers/utf-8.js
- var _pZ = " - \u2028\u2029 ";
- var pZ = "[".concat(_pZ, "]");
- var PZ = "[^".concat(_pZ, "]");
- var _pN = "0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9";
- var _pNd = "0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9";
- var pNd = "[".concat(_pNd, "]");
- var _pL = "A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";
- var pL = "[".concat(_pL, "]");
- var pL_regexp = new RegExp(pL);
- var _pSc = "$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩";
- var pSc = "[".concat(_pSc, "]");
- var pSc_regexp = new RegExp(pSc);
- var _pMn = "̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦";
- var pMn = "[".concat(_pMn, "]");
- var pMn_regexp = new RegExp(pMn);
- var _InBasic_Latin = "\0-";
- var _InLatin_1_Supplement = "-ÿ";
- var _InLatin_Extended_A = "Ā-ſ";
- var _InLatin_Extended_Additional = "Ḁ-ỿ";
- var _InLatin_Extended_B = "ƀ-ɏ";
- var _InCombining_Diacritical_Marks = "̀-ͯ";
- var latinLetterRegexp = new RegExp("[" + _InBasic_Latin + _InLatin_1_Supplement + _InLatin_Extended_A + _InLatin_Extended_Additional + _InLatin_Extended_B + _InCombining_Diacritical_Marks + "]");
- function isLatinLetter(letter) {
- if (!pL_regexp.test(letter) && !pMn_regexp.test(letter)) {
- return false;
- }
- return latinLetterRegexp.test(letter);
- }
- function isInvalidPunctuationSymbol(character) {
- return character === "%" || pSc_regexp.test(character);
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/findNumbers/matchPhoneNumberStringAgainstPhoneNumber.js
- function matchPhoneNumberStringAgainstPhoneNumber(phoneNumberString, phoneNumber, metadata) {
- var phoneNumberStringContainsCallingCode = true;
- var parsedPhoneNumber = parsePhoneNumber3(phoneNumberString, metadata);
- if (!parsedPhoneNumber) {
- phoneNumberStringContainsCallingCode = false;
- parsedPhoneNumber = parsePhoneNumber3(phoneNumberString, {
- defaultCallingCode: phoneNumber.countryCallingCode
- }, metadata);
- }
- if (!parsedPhoneNumber) {
- return "INVALID_NUMBER";
- }
- if (phoneNumber.ext) {
- if (parsedPhoneNumber.ext !== phoneNumber.ext) {
- return "NO_MATCH";
- }
- } else {
- if (parsedPhoneNumber.ext) {
- return "NO_MATCH";
- }
- }
- if (phoneNumberStringContainsCallingCode) {
- if (phoneNumber.countryCallingCode !== parsedPhoneNumber.countryCallingCode) {
- return "NO_MATCH";
- }
- }
- if (phoneNumber.number === parsedPhoneNumber.number) {
- if (phoneNumberStringContainsCallingCode) {
- return "EXACT_MATCH";
- } else {
- return "NSN_MATCH";
- }
- }
- if (phoneNumber.nationalNumber.indexOf(parsedPhoneNumber.nationalNumber) === 0 || parsedPhoneNumber.nationalNumber.indexOf(phoneNumber.nationalNumber) === 0) {
- return "SHORT_NSN_MATCH";
- }
- return "NO_MATCH";
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/findNumbers/Leniency.js
- function _createForOfIteratorHelperLoose11(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray14(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray14(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray14(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray14(o, minLen);
- }
- function _arrayLikeToArray14(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- var Leniency_default = {
- /**
- * Phone numbers accepted are "possible", but not necessarily "valid".
- */
- POSSIBLE: function POSSIBLE(phoneNumber, _ref) {
- var candidate = _ref.candidate, metadata = _ref.metadata;
- return true;
- },
- /**
- * Phone numbers accepted are "possible" and "valid".
- * Numbers written in national format must have their national-prefix
- * present if it is usually written for a number of this type.
- */
- VALID: function VALID(phoneNumber, _ref2) {
- var candidate = _ref2.candidate, defaultCountry = _ref2.defaultCountry, metadata = _ref2.metadata;
- if (!phoneNumber.isValid() || !containsOnlyValidXChars(phoneNumber, candidate, metadata)) {
- return false;
- }
- return true;
- },
- /**
- * Phone numbers accepted are "valid" and
- * are grouped in a possible way for this locale. For example, a US number written as
- * "65 02 53 00 00" and "650253 0000" are not accepted at this leniency level, whereas
- * "650 253 0000", "650 2530000" or "6502530000" are.
- * Numbers with more than one '/' symbol in the national significant number
- * are also dropped at this level.
- *
- * Warning: This level might result in lower coverage especially for regions outside of
- * country code "+1". If you are not sure about which level to use,
- * email the discussion group libphonenumber-discuss@googlegroups.com.
- */
- STRICT_GROUPING: function STRICT_GROUPING(phoneNumber, _ref3) {
- var candidate = _ref3.candidate, defaultCountry = _ref3.defaultCountry, metadata = _ref3.metadata, regExpCache = _ref3.regExpCache;
- if (!phoneNumber.isValid() || !containsOnlyValidXChars(phoneNumber, candidate, metadata) || containsMoreThanOneSlashInNationalNumber(phoneNumber, candidate) || !isNationalPrefixPresentIfRequired(phoneNumber, {
- defaultCountry,
- metadata
- })) {
- return false;
- }
- return checkNumberGroupingIsValid(phoneNumber, candidate, metadata, allNumberGroupsRemainGrouped, regExpCache);
- },
- /**
- * Phone numbers accepted are "valid" and are grouped in the same way
- * that we would have formatted it, or as a single block.
- * For example, a US number written as "650 2530000" is not accepted
- * at this leniency level, whereas "650 253 0000" or "6502530000" are.
- * Numbers with more than one '/' symbol are also dropped at this level.
- *
- * Warning: This level might result in lower coverage especially for regions outside of
- * country code "+1". If you are not sure about which level to use, email the discussion group
- * libphonenumber-discuss@googlegroups.com.
- */
- EXACT_GROUPING: function EXACT_GROUPING(phoneNumber, _ref4) {
- var candidate = _ref4.candidate, defaultCountry = _ref4.defaultCountry, metadata = _ref4.metadata, regExpCache = _ref4.regExpCache;
- if (!phoneNumber.isValid() || !containsOnlyValidXChars(phoneNumber, candidate, metadata) || containsMoreThanOneSlashInNationalNumber(phoneNumber, candidate) || !isNationalPrefixPresentIfRequired(phoneNumber, {
- defaultCountry,
- metadata
- })) {
- return false;
- }
- return checkNumberGroupingIsValid(phoneNumber, candidate, metadata, allNumberGroupsAreExactlyPresent, regExpCache);
- }
- };
- function containsOnlyValidXChars(phoneNumber, candidate, metadata) {
- for (var index = 0; index < candidate.length - 1; index++) {
- var charAtIndex = candidate.charAt(index);
- if (charAtIndex === "x" || charAtIndex === "X") {
- var charAtNextIndex = candidate.charAt(index + 1);
- if (charAtNextIndex === "x" || charAtNextIndex === "X") {
- index++;
- if (matchPhoneNumberStringAgainstPhoneNumber(candidate.substring(index), phoneNumber, metadata) !== "NSN_MATCH") {
- return false;
- }
- } else {
- var ext = parseDigits(candidate.substring(index));
- if (ext) {
- if (phoneNumber.ext !== ext) {
- return false;
- }
- } else {
- if (phoneNumber.ext) {
- return false;
- }
- }
- }
- }
- }
- return true;
- }
- function isNationalPrefixPresentIfRequired(phoneNumber, _ref5) {
- var defaultCountry = _ref5.defaultCountry, _metadata = _ref5.metadata;
- if (phoneNumber.__countryCallingCodeSource !== "FROM_DEFAULT_COUNTRY") {
- return true;
- }
- var metadata = new Metadata(_metadata);
- metadata.selectNumberingPlan(phoneNumber.countryCallingCode);
- var phoneNumberRegion = phoneNumber.country || getCountryByCallingCode(phoneNumber.countryCallingCode, {
- nationalNumber: phoneNumber.nationalNumber,
- defaultCountry,
- metadata
- });
- var nationalNumber = phoneNumber.nationalNumber;
- var format = chooseFormatForNumber(metadata.numberingPlan.formats(), nationalNumber);
- if (format.nationalPrefixFormattingRule()) {
- if (metadata.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()) {
- return true;
- }
- if (!format.usesNationalPrefix()) {
- return true;
- }
- return Boolean(phoneNumber.nationalPrefix);
- }
- return true;
- }
- function containsMoreThanOneSlashInNationalNumber(phoneNumber, candidate) {
- var firstSlashInBodyIndex = candidate.indexOf("/");
- if (firstSlashInBodyIndex < 0) {
- return false;
- }
- var secondSlashInBodyIndex = candidate.indexOf("/", firstSlashInBodyIndex + 1);
- if (secondSlashInBodyIndex < 0) {
- return false;
- }
- var candidateHasCountryCode = phoneNumber.__countryCallingCodeSource === "FROM_NUMBER_WITH_PLUS_SIGN" || phoneNumber.__countryCallingCodeSource === "FROM_NUMBER_WITHOUT_PLUS_SIGN";
- if (candidateHasCountryCode && parseDigits(candidate.substring(0, firstSlashInBodyIndex)) === phoneNumber.countryCallingCode) {
- return candidate.slice(secondSlashInBodyIndex + 1).indexOf("/") >= 0;
- }
- return true;
- }
- function checkNumberGroupingIsValid(number, candidate, metadata, checkGroups, regExpCache) {
- throw new Error("This part of code hasn't been ported");
- var normalizedCandidate = normalizeDigits(
- candidate,
- true
- /* keep non-digits */
- );
- var formattedNumberGroups = getNationalNumberGroups(metadata, number, null);
- if (checkGroups(metadata, number, normalizedCandidate, formattedNumberGroups)) {
- return true;
- }
- var alternateFormats = MetadataManager.getAlternateFormatsForCountry(number.getCountryCode());
- var nationalSignificantNumber = util.getNationalSignificantNumber(number);
- if (alternateFormats) {
- for (var _iterator = _createForOfIteratorHelperLoose11(alternateFormats.numberFormats()), _step; !(_step = _iterator()).done; ) {
- var alternateFormat = _step.value;
- if (alternateFormat.leadingDigitsPatterns().length > 0) {
- var leadingDigitsRegExp = regExpCache.getPatternForRegExp("^" + alternateFormat.leadingDigitsPatterns()[0]);
- if (!leadingDigitsRegExp.test(nationalSignificantNumber)) {
- continue;
- }
- }
- formattedNumberGroups = getNationalNumberGroups(metadata, number, alternateFormat);
- if (checkGroups(metadata, number, normalizedCandidate, formattedNumberGroups)) {
- return true;
- }
- }
- }
- return false;
- }
- function getNationalNumberGroups(metadata, number, formattingPattern) {
- throw new Error("This part of code hasn't been ported");
- if (formattingPattern) {
- var nationalSignificantNumber = util.getNationalSignificantNumber(number);
- return util.formatNsnUsingPattern(nationalSignificantNumber, formattingPattern, "RFC3966", metadata).split("-");
- }
- var rfc3966Format = formatNumber(number, "RFC3966", metadata);
- var endIndex = rfc3966Format.indexOf(";");
- if (endIndex < 0) {
- endIndex = rfc3966Format.length;
- }
- var startIndex = rfc3966Format.indexOf("-") + 1;
- return rfc3966Format.slice(startIndex, endIndex).split("-");
- }
- function allNumberGroupsAreExactlyPresent(metadata, number, normalizedCandidate, formattedNumberGroups) {
- throw new Error("This part of code hasn't been ported");
- var candidateGroups = normalizedCandidate.split(NON_DIGITS_PATTERN);
- var candidateNumberGroupIndex = number.hasExtension() ? candidateGroups.length - 2 : candidateGroups.length - 1;
- if (candidateGroups.length == 1 || candidateGroups[candidateNumberGroupIndex].contains(util.getNationalSignificantNumber(number))) {
- return true;
- }
- var formattedNumberGroupIndex = formattedNumberGroups.length - 1;
- while (formattedNumberGroupIndex > 0 && candidateNumberGroupIndex >= 0) {
- if (candidateGroups[candidateNumberGroupIndex] !== formattedNumberGroups[formattedNumberGroupIndex]) {
- return false;
- }
- formattedNumberGroupIndex--;
- candidateNumberGroupIndex--;
- }
- return candidateNumberGroupIndex >= 0 && endsWith(candidateGroups[candidateNumberGroupIndex], formattedNumberGroups[0]);
- }
- function allNumberGroupsRemainGrouped(metadata, number, normalizedCandidate, formattedNumberGroups) {
- throw new Error("This part of code hasn't been ported");
- var fromIndex = 0;
- if (number.getCountryCodeSource() !== CountryCodeSource.FROM_DEFAULT_COUNTRY) {
- var countryCode = String(number.getCountryCode());
- fromIndex = normalizedCandidate.indexOf(countryCode) + countryCode.length();
- }
- for (var i = 0; i < formattedNumberGroups.length; i++) {
- fromIndex = normalizedCandidate.indexOf(formattedNumberGroups[i], fromIndex);
- if (fromIndex < 0) {
- return false;
- }
- fromIndex += formattedNumberGroups[i].length();
- if (i == 0 && fromIndex < normalizedCandidate.length()) {
- var region = util.getRegionCodeForCountryCode(number.getCountryCode());
- if (util.getNddPrefixForRegion(region, true) != null && Character.isDigit(normalizedCandidate.charAt(fromIndex))) {
- var nationalSignificantNumber = util.getNationalSignificantNumber(number);
- return startsWith(normalizedCandidate.slice(fromIndex - formattedNumberGroups[i].length), nationalSignificantNumber);
- }
- }
- }
- return normalizedCandidate.slice(fromIndex).contains(number.getExtension());
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/findNumbers/parsePreCandidate.js
- var SECOND_NUMBER_START_PATTERN = /[\\/] *x/;
- function parsePreCandidate(candidate) {
- return trimAfterFirstMatch(SECOND_NUMBER_START_PATTERN, candidate);
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/findNumbers/isValidPreCandidate.js
- var SLASH_SEPARATED_DATES = /(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/;
- var TIME_STAMPS = /[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/;
- var TIME_STAMPS_SUFFIX_LEADING = /^:[0-5]\d/;
- function isValidPreCandidate(candidate, offset, text) {
- if (SLASH_SEPARATED_DATES.test(candidate)) {
- return false;
- }
- if (TIME_STAMPS.test(candidate)) {
- var followingText = text.slice(offset + candidate.length);
- if (TIME_STAMPS_SUFFIX_LEADING.test(followingText)) {
- return false;
- }
- }
- return true;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/findNumbers/isValidCandidate.js
- var OPENING_PARENS = "(\\[([";
- var CLOSING_PARENS = ")\\])]";
- var NON_PARENS = "[^".concat(OPENING_PARENS).concat(CLOSING_PARENS, "]");
- var LEAD_CLASS = "[".concat(OPENING_PARENS).concat(PLUS_CHARS, "]");
- var LEAD_CLASS_LEADING = new RegExp("^" + LEAD_CLASS);
- var BRACKET_PAIR_LIMIT = limit(0, 3);
- var MATCHING_BRACKETS_ENTIRE = new RegExp("^(?:[" + OPENING_PARENS + "])?(?:" + NON_PARENS + "+[" + CLOSING_PARENS + "])?" + NON_PARENS + "+(?:[" + OPENING_PARENS + "]" + NON_PARENS + "+[" + CLOSING_PARENS + "])" + BRACKET_PAIR_LIMIT + NON_PARENS + "*$");
- var PUB_PAGES = /\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;
- function isValidCandidate(candidate, offset, text, leniency) {
- if (!MATCHING_BRACKETS_ENTIRE.test(candidate) || PUB_PAGES.test(candidate)) {
- return;
- }
- if (leniency !== "POSSIBLE") {
- if (offset > 0 && !LEAD_CLASS_LEADING.test(candidate)) {
- var previousChar = text[offset - 1];
- if (isInvalidPunctuationSymbol(previousChar) || isLatinLetter(previousChar)) {
- return false;
- }
- }
- var lastCharIndex = offset + candidate.length;
- if (lastCharIndex < text.length) {
- var nextChar = text[lastCharIndex];
- if (isInvalidPunctuationSymbol(nextChar) || isLatinLetter(nextChar)) {
- return false;
- }
- }
- }
- return true;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/PhoneNumberMatcher.js
- function _createForOfIteratorHelperLoose12(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it)
- return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray15(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it)
- o = it;
- var i = 0;
- return function() {
- if (i >= o.length)
- return { done: true };
- return { done: false, value: o[i++] };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _unsupportedIterableToArray15(o, minLen) {
- if (!o)
- return;
- if (typeof o === "string")
- return _arrayLikeToArray15(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor)
- n = o.constructor.name;
- if (n === "Map" || n === "Set")
- return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
- return _arrayLikeToArray15(o, minLen);
- }
- function _arrayLikeToArray15(arr, len) {
- if (len == null || len > arr.length)
- len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- function _classCallCheck12(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties12(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor)
- descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass12(Constructor, protoProps, staticProps) {
- if (protoProps)
- _defineProperties12(Constructor.prototype, protoProps);
- if (staticProps)
- _defineProperties12(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", { writable: false });
- return Constructor;
- }
- var USE_NON_GEOGRAPHIC_COUNTRY_CODE5 = false;
- var EXTN_PATTERNS_FOR_MATCHING = createExtensionPattern("matching");
- var INNER_MATCHES = [
- // Breaks on the slash - e.g. "651-234-2345/332-445-1234"
- "\\/+(.*)/",
- // Note that the bracket here is inside the capturing group, since we consider it part of the
- // phone number. Will match a pattern like "(650) 223 3345 (754) 223 3321".
- "(\\([^(]*)",
- // Breaks on a hyphen - e.g. "12345 - 332-445-1234 is my number."
- // We require a space on either side of the hyphen for it to be considered a separator.
- "(?:".concat(pZ, "-|-").concat(pZ, ")").concat(pZ, "*(.+)"),
- // Various types of wide hyphens. Note we have decided not to enforce a space here, since it's
- // possible that it's supposed to be used to break two numbers without spaces, and we haven't
- // seen many instances of it used within a number.
- "[‒-―-]".concat(pZ, "*(.+)"),
- // Breaks on a full stop - e.g. "12345. 332-445-1234 is my number."
- "\\.+".concat(pZ, "*([^.]+)"),
- // Breaks on space - e.g. "3324451234 8002341234"
- "".concat(pZ, "+(").concat(PZ, "+)")
- ];
- var leadLimit = limit(0, 2);
- var punctuationLimit = limit(0, 4);
- var digitBlockLimit = MAX_LENGTH_FOR_NSN + MAX_LENGTH_COUNTRY_CODE;
- var blockLimit = limit(0, digitBlockLimit);
- var punctuation = "[".concat(VALID_PUNCTUATION, "]") + punctuationLimit;
- var digitSequence = pNd + limit(1, digitBlockLimit);
- var PATTERN = "(?:" + LEAD_CLASS + punctuation + ")" + leadLimit + digitSequence + "(?:" + punctuation + digitSequence + ")" + blockLimit + "(?:" + EXTN_PATTERNS_FOR_MATCHING + ")?";
- var UNWANTED_END_CHAR_PATTERN = new RegExp("[^".concat(_pN).concat(_pL, "#]+$"));
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1;
- var PhoneNumberMatcher = function() {
- function PhoneNumberMatcher2() {
- var text = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
- var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
- var metadata = arguments.length > 2 ? arguments[2] : void 0;
- _classCallCheck12(this, PhoneNumberMatcher2);
- options = {
- v2: options.v2,
- defaultCallingCode: options.defaultCallingCode,
- defaultCountry: options.defaultCountry && isSupportedCountry(options.defaultCountry, metadata) ? options.defaultCountry : void 0,
- leniency: options.leniency || (options.extended ? "POSSIBLE" : "VALID"),
- maxTries: options.maxTries || MAX_SAFE_INTEGER
- };
- if (!options.leniency) {
- throw new TypeError("`leniency` is required");
- }
- if (options.leniency !== "POSSIBLE" && options.leniency !== "VALID") {
- throw new TypeError('Invalid `leniency`: "'.concat(options.leniency, '". Supported values: "POSSIBLE", "VALID".'));
- }
- if (options.maxTries < 0) {
- throw new TypeError("`maxTries` must be `>= 0`");
- }
- this.text = text;
- this.options = options;
- this.metadata = metadata;
- this.leniency = Leniency_default[options.leniency];
- if (!this.leniency) {
- throw new TypeError('Unknown leniency: "'.concat(options.leniency, '"'));
- }
- this.maxTries = options.maxTries;
- this.PATTERN = new RegExp(PATTERN, "ig");
- this.state = "NOT_READY";
- this.searchIndex = 0;
- this.regExpCache = new RegExpCache(32);
- }
- _createClass12(PhoneNumberMatcher2, [{
- key: "find",
- value: function find() {
- var matches;
- while (this.maxTries > 0 && (matches = this.PATTERN.exec(this.text)) !== null) {
- var candidate = matches[0];
- var offset = matches.index;
- candidate = parsePreCandidate(candidate);
- if (isValidPreCandidate(candidate, offset, this.text)) {
- var match = (
- // Try to come up with a valid match given the entire candidate.
- this.parseAndVerify(candidate, offset, this.text) || this.extractInnerMatch(candidate, offset, this.text)
- );
- if (match) {
- if (this.options.v2) {
- return {
- startsAt: match.startsAt,
- endsAt: match.endsAt,
- number: match.phoneNumber
- };
- } else {
- var phoneNumber = match.phoneNumber;
- var result2 = {
- startsAt: match.startsAt,
- endsAt: match.endsAt,
- phone: phoneNumber.nationalNumber
- };
- if (phoneNumber.country) {
- if (USE_NON_GEOGRAPHIC_COUNTRY_CODE5 && country === "001") {
- result2.countryCallingCode = phoneNumber.countryCallingCode;
- } else {
- result2.country = phoneNumber.country;
- }
- } else {
- result2.countryCallingCode = phoneNumber.countryCallingCode;
- }
- if (phoneNumber.ext) {
- result2.ext = phoneNumber.ext;
- }
- return result2;
- }
- }
- }
- this.maxTries--;
- }
- }
- /**
- * Attempts to extract a match from `substring`
- * if the substring itself does not qualify as a match.
- */
- }, {
- key: "extractInnerMatch",
- value: function extractInnerMatch(substring, offset, text) {
- for (var _iterator = _createForOfIteratorHelperLoose12(INNER_MATCHES), _step; !(_step = _iterator()).done; ) {
- var innerMatchPattern = _step.value;
- var isFirstMatch = true;
- var candidateMatch = void 0;
- var innerMatchRegExp = new RegExp(innerMatchPattern, "g");
- while (this.maxTries > 0 && (candidateMatch = innerMatchRegExp.exec(substring)) !== null) {
- if (isFirstMatch) {
- var _candidate = trimAfterFirstMatch(UNWANTED_END_CHAR_PATTERN, substring.slice(0, candidateMatch.index));
- var _match2 = this.parseAndVerify(_candidate, offset, text);
- if (_match2) {
- return _match2;
- }
- this.maxTries--;
- isFirstMatch = false;
- }
- var candidate = trimAfterFirstMatch(UNWANTED_END_CHAR_PATTERN, candidateMatch[1]);
- var candidateIndexGuess = substring.indexOf(candidate, candidateMatch.index);
- var match = this.parseAndVerify(candidate, offset + candidateIndexGuess, text);
- if (match) {
- return match;
- }
- this.maxTries--;
- }
- }
- }
- /**
- * Parses a phone number from the `candidate` using `parse` and
- * verifies it matches the requested `leniency`. If parsing and verification succeed,
- * a corresponding `PhoneNumberMatch` is returned, otherwise this method returns `null`.
- *
- * @param candidate the candidate match
- * @param offset the offset of {@code candidate} within {@link #text}
- * @return the parsed and validated phone number match, or null
- */
- }, {
- key: "parseAndVerify",
- value: function parseAndVerify(candidate, offset, text) {
- if (!isValidCandidate(candidate, offset, text, this.options.leniency)) {
- return;
- }
- var phoneNumber = parsePhoneNumber3(candidate, {
- extended: true,
- defaultCountry: this.options.defaultCountry,
- defaultCallingCode: this.options.defaultCallingCode
- }, this.metadata);
- if (!phoneNumber) {
- return;
- }
- if (!phoneNumber.isPossible()) {
- return;
- }
- if (this.leniency(phoneNumber, {
- candidate,
- defaultCountry: this.options.defaultCountry,
- metadata: this.metadata,
- regExpCache: this.regExpCache
- })) {
- return {
- startsAt: offset,
- endsAt: offset + candidate.length,
- phoneNumber
- };
- }
- }
- }, {
- key: "hasNext",
- value: function hasNext() {
- if (this.state === "NOT_READY") {
- this.lastMatch = this.find();
- if (this.lastMatch) {
- this.state = "READY";
- } else {
- this.state = "DONE";
- }
- }
- return this.state === "READY";
- }
- }, {
- key: "next",
- value: function next() {
- if (!this.hasNext()) {
- throw new Error("No next element");
- }
- var result2 = this.lastMatch;
- this.lastMatch = null;
- this.state = "NOT_READY";
- return result2;
- }
- }]);
- return PhoneNumberMatcher2;
- }();
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/legacy/findNumbers.js
- function findNumbers() {
- var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
- var matcher = new PhoneNumberMatcher(text, options, metadata);
- var results = [];
- while (matcher.hasNext()) {
- results.push(matcher.next());
- }
- return results;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/legacy/searchNumbers.js
- function _defineProperty9(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function searchNumbers() {
- var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
- var matcher = new PhoneNumberMatcher(text, options, metadata);
- return _defineProperty9({}, Symbol.iterator, function() {
- return {
- next: function next() {
- if (matcher.hasNext()) {
- return {
- done: false,
- value: matcher.next()
- };
- }
- return {
- done: true
- };
- }
- };
- });
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/findPhoneNumbersInText.js
- function ownKeys9(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread9(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys9(Object(source), true).forEach(function(key) {
- _defineProperty10(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys9(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _defineProperty10(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function findPhoneNumbersInText() {
- var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
- var matcher = new PhoneNumberMatcher(text, _objectSpread9(_objectSpread9({}, options), {}, {
- v2: true
- }), metadata);
- var results = [];
- while (matcher.hasNext()) {
- results.push(matcher.next());
- }
- return results;
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/searchPhoneNumbersInText.js
- function ownKeys10(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread10(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys10(Object(source), true).forEach(function(key) {
- _defineProperty11(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys10(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _defineProperty11(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function searchPhoneNumbersInText() {
- var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata;
- var matcher = new PhoneNumberMatcher(text, _objectSpread10(_objectSpread10({}, options), {}, {
- v2: true
- }), metadata);
- return _defineProperty11({}, Symbol.iterator, function() {
- return {
- next: function next() {
- if (matcher.hasNext()) {
- return {
- done: false,
- value: matcher.next()
- };
- }
- return {
- done: true
- };
- }
- };
- });
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/getCountries.js
- function getCountries(metadata) {
- return new Metadata(metadata).getCountries();
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/getExampleNumber.js
- function getExampleNumber(country2, examples, metadata) {
- if (examples[country2]) {
- return new PhoneNumber(country2, examples[country2], metadata);
- }
- }
- // ../../../../../../Users/xuruhua/Desktop/zx/new-zx-front-app/node_modules/libphonenumber-js/es6/formatIncompletePhoneNumber.js
- function formatIncompletePhoneNumber(value, optionsOrDefaultCountry, metadata) {
- if (!metadata) {
- metadata = optionsOrDefaultCountry;
- optionsOrDefaultCountry = void 0;
- }
- return new AsYouType(optionsOrDefaultCountry, metadata).input(value);
- }
- export {
- ParseError,
- WHITESPACE,
- VALID_PUNCTUATION,
- isObject,
- Metadata,
- getExtPrefix,
- getCountryCallingCode,
- isSupportedCountry,
- createExtensionPattern,
- VALID_PHONE_NUMBER_WITH_EXTENSION,
- isViablePhoneNumber,
- DIGITS,
- parseDigits,
- parseIncompletePhoneNumber,
- parsePhoneNumberCharacter,
- isPossiblePhoneNumber,
- getNumberType,
- isValidNumber,
- parseRFC3966,
- formatRFC3966,
- formatNumber2 as formatNumber,
- parse,
- normalizeArguments,
- parsePhoneNumberWithError2 as parsePhoneNumberWithError,
- parsePhoneNumber3 as parsePhoneNumber,
- isValidPhoneNumber,
- isPossiblePhoneNumber2,
- validatePhoneNumberLength,
- parsePreCandidate,
- isValidPreCandidate,
- isValidCandidate,
- PhoneNumberMatcher,
- findNumbers,
- searchNumbers,
- findPhoneNumbersInText,
- searchPhoneNumbersInText,
- DIGIT_PLACEHOLDER,
- AsYouType,
- getCountries,
- getExampleNumber,
- formatIncompletePhoneNumber
- };
- //# sourceMappingURL=chunk-SMXOUF54.js.map
|